@code-partner/codepipe-hub 0.14.1-dev.404.g2e5e29f1 → 0.14.1-dev.405.gb14c9aa1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/hub/dist/index.js +13 -3
  2. package/package.json +1 -1
package/hub/dist/index.js CHANGED
@@ -13,7 +13,7 @@ var PLATFORM_VERSION;
13
13
  var init_version_generated = __esm({
14
14
  "../packages/shared/dist/version.generated.js"() {
15
15
  "use strict";
16
- PLATFORM_VERSION = "0.14.1-dev.404.g2e5e29f1";
16
+ PLATFORM_VERSION = "0.14.1-dev.405.gb14c9aa1";
17
17
  }
18
18
  });
19
19
 
@@ -3547,6 +3547,7 @@ function pgJobRepository(db, d = postgresDialect) {
3547
3547
  const harnessClause = q.harnesses.length > 0 ? `AND (${harnessField} IS NULL OR ${harnessField} IN (${q.harnesses.map(() => "?").join(",")}))` : `AND ${harnessField} IS NULL`;
3548
3548
  const heldClause = q.heldTaskIds.length > 0 ? `AND NOT (t.id IS NOT NULL AND j.role NOT IN (${CLUSTER_GATE_EXEMPT_SQL})
3549
3549
  AND t.id IN (${q.heldTaskIds.map(() => "?").join(",")}))` : "";
3550
+ const heldProjectClause = q.heldProjectIds.length > 0 ? `AND j.project_id NOT IN (${q.heldProjectIds.map(() => "?").join(",")})` : "";
3550
3551
  return await db.get(`SELECT ${jobColumns("j.")}
3551
3552
  FROM jobs j
3552
3553
  JOIN projects p ON p.id = j.project_id
@@ -3648,6 +3649,7 @@ function pgJobRepository(db, d = postgresDialect) {
3648
3649
  -- code-review (DEV-686: they judge the task's own delivery) are
3649
3650
  -- never gated. Empty held set this tick -> the clause is omitted.
3650
3651
  ${heldClause}
3652
+ ${heldProjectClause}
3651
3653
  -- DEV-686: eager build/code-review fill FREE slots only \u2014 an unheld
3652
3654
  -- implement-family job (the cluster's critical path) always outranks
3653
3655
  -- them; within a rank it stays FIFO.
@@ -3658,7 +3660,7 @@ function pgJobRepository(db, d = postgresDialect) {
3658
3660
  -- same queued row before either updates it. Lock the candidate (jobs
3659
3661
  -- side only \u2014 the LEFT-JOINed tasks row may be null) and let a
3660
3662
  -- parallel claimer skip past it instead of blocking.
3661
- ${d.claimLock}`, ...projectFilter.params, ...ownerFilter.params, ...laneFilter.params, ...q.harnesses, q.now, ...roleParams, ...roleParams, PLANNING_LANE_MAX_JOBS, ...implCap.params, ...q.heldTaskIds);
3663
+ ${d.claimLock}`, ...projectFilter.params, ...ownerFilter.params, ...laneFilter.params, ...q.harnesses, q.now, ...roleParams, ...roleParams, PLANNING_LANE_MAX_JOBS, ...implCap.params, ...q.heldTaskIds, ...q.heldProjectIds);
3662
3664
  },
3663
3665
  async markClaimed(jobId, sandboxId, executionId, now) {
3664
3666
  await db.run(`UPDATE jobs
@@ -11046,6 +11048,14 @@ async function claimNextJob(db, sandboxId, capabilities, lane) {
11046
11048
  for (const id of await heldByClusterGate(db, projectId)) heldIds.push(id);
11047
11049
  }
11048
11050
  for (const id of await heldByTrancheDeferral(db)) heldIds.push(id);
11051
+ const heldProjectIds = [];
11052
+ const queuedProjects = await db.all(`SELECT DISTINCT j.project_id AS projectId
11053
+ FROM jobs j JOIN projects p ON p.id = j.project_id
11054
+ WHERE j.state = 'queued'
11055
+ AND ${projectFilter.clause} AND ${ownerFilter.clause} AND ${laneFilter.clause}`, ...projectFilter.params, ...ownerFilter.params, ...laneFilter.params);
11056
+ for (const { projectId } of queuedProjects) {
11057
+ if ((await unpinnedSourceRepos(db, projectId)).length > 0) heldProjectIds.push(projectId);
11058
+ }
11049
11059
  const claimed = await claimJob({
11050
11060
  store: pgEngineStore(db),
11051
11061
  audit: async (tx, e) => {
@@ -11119,7 +11129,7 @@ async function claimNextJob(db, sandboxId, capabilities, lane) {
11119
11129
  }
11120
11130
  return changed ? JSON.stringify(spec2) : null;
11121
11131
  }
11122
- }, { ...claimInput, heldTaskIds: heldIds, now: Date.now() });
11132
+ }, { ...claimInput, heldTaskIds: heldIds, heldProjectIds, now: Date.now() });
11123
11133
  if (!claimed) return null;
11124
11134
  const spec = JSON.parse(claimed.job.specJson);
11125
11135
  spec.executionId = claimed.executionId;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-partner/codepipe-hub",
3
- "version": "0.14.1-dev.404.g2e5e29f1",
3
+ "version": "0.14.1-dev.405.gb14c9aa1",
4
4
  "description": "The CodePipe hub, packaged for one machine: the CLI installs it on demand for the local profile.",
5
5
  "type": "module",
6
6
  "main": "./hub/dist/index.js",