amsd-pipeline-shared 0.5.20 → 0.5.22

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.
@@ -236,3 +236,8 @@ ff9ea38d594f181363c40295ea42012a prompts/templates/writer-plan-section.json
236
236
  4120de0abec9f84c3b0fa98cd2584233 scripts/lib/worktree-rungs.sh
237
237
  515f80e7a9228cdfbc39e71c06066d95 scripts/lib/story-attempt.sh
238
238
  6a31e809386b4114794bb773c850b46b scripts/lib/producers/fix-plan.js
239
+ b3e93b2042f50c5b69133108c8de9711 scripts/lib/prompt-library.js
240
+ a7d52fab41432240f1e2dbffd6710ea5 scripts/lib/project-prompt-builder.js
241
+ dea5be1123db8ab5b054fef8cc1388fe scripts/mint-agents-step.js
242
+ eb4979b0f88ed8449b2e4702d0dff7a5 scripts/lib/prompt-variant.sh
243
+ d4992178558476af4c4c228e6aa63b2d scripts/lib/mint-and-spec.sh
@@ -212,6 +212,7 @@ scripts/lib/kb-store.js
212
212
  scripts/lib/kb-synthesizer.js
213
213
  scripts/lib/langfuse-emit.js
214
214
  scripts/lib/llm-settings-resolve.js
215
+ scripts/lib/mint-and-spec.sh
215
216
  scripts/lib/model-ladder.sh
216
217
  scripts/lib/model-ladders.sh
217
218
  scripts/lib/orchestration-resume.sh
@@ -224,7 +225,10 @@ scripts/lib/plan-scope.js
224
225
  scripts/lib/preflight.sh
225
226
  scripts/lib/prelaunch.js
226
227
  scripts/lib/producers/fix-plan.js
228
+ scripts/lib/project-prompt-builder.js
227
229
  scripts/lib/project-prompt-contract.js
230
+ scripts/lib/prompt-library.js
231
+ scripts/lib/prompt-variant.sh
228
232
  scripts/lib/qa-gate-evidence.sh
229
233
  scripts/lib/relative-paths.js
230
234
  scripts/lib/release-lines.sh
@@ -246,6 +250,7 @@ scripts/lib/tool-timeouts.js
246
250
  scripts/lib/transcript-tool-calls.js
247
251
  scripts/lib/worktree-rungs.sh
248
252
  scripts/llm-handler.sh
253
+ scripts/mint-agents-step.js
249
254
  scripts/preflight-check.sh
250
255
  scripts/preflight-prd-integrity.sh
251
256
  scripts/preflight-static.sh
@@ -1203,6 +1203,10 @@ _run_codeline_loop() {
1203
1203
  # THE DECLARATION IS THE CODELINE'S RESULT (lib/handlers/record-declared-pass.js).
1204
1204
  "$NODE_BIN" "$SCRIPT_DIR/lib/handlers/record-declared-pass.js" "$_prd_path" "$_cl" || true
1205
1205
  # ITS OTHER RELEASE LINES STILL SHIP (lib/release-lines.sh): passed is the operator's word for the codeline's own line.
1206
+ if ! lane_codeline_set_restore "$_cl_prd"; then
1207
+ error "[orch] Codeline '${_cl}': its own recorded agents and prompts are not there — its release lines do not run on another codeline's set"
1208
+ _overall=1; continue
1209
+ fi
1206
1210
  _run_release_lines "$_cl" "$_cl_prd" "$_wt" "${LOG_DIR:-/tmp}/lanes/${_cl}" "$_log_file" "$_phase_filter" "$0" "$_prd_path" || _overall=1
1207
1211
  continue
1208
1212
  fi
@@ -1215,6 +1219,12 @@ _run_codeline_loop() {
1215
1219
  warning "[orch] Set EPAM_PARALLEL_CODELINES=0 if these lanes integrate with each other."
1216
1220
  fi
1217
1221
 
1222
+ # LANES THAT RUN TOGETHER SHARE ONE ACTIVE SET (operator, 2026-10-22: "prompts/profiles BY codeline"): they start only when
1223
+ # their codelines' recorded sets are the same (lib/prompt-variant.sh parallel_lanes_codeline_set_restore); otherwise none starts.
1224
+ if [ "${#_p_cls[@]}" -gt 0 ] && ! parallel_lanes_codeline_set_restore "${_p_prds[@]}"; then
1225
+ error "[orch] Parallel lanes not started: each lane must work from its own codeline's set — EPAM_PARALLEL_CODELINES=0 runs them one at a time"
1226
+ _overall=1; _p_cls=()
1227
+ fi
1218
1228
  log "[orch] Launching ${#_p_cls[@]} codeline(s) in PARALLEL..."
1219
1229
  _lane_idx=0
1220
1230
  while [ "$_lane_idx" -lt "${#_p_cls[@]}" ]; do
@@ -1476,12 +1486,22 @@ _run_codeline_loop() {
1476
1486
  # THE DECLARATION IS THE CODELINE'S RESULT (lib/handlers/record-declared-pass.js).
1477
1487
  "$NODE_BIN" "$SCRIPT_DIR/lib/handlers/record-declared-pass.js" "$_prd_path" "$_cl" || true
1478
1488
  # ITS OTHER RELEASE LINES STILL SHIP (lib/release-lines.sh): passed is the operator's word for the codeline's own line.
1489
+ if ! lane_codeline_set_restore "$_cl_prd"; then
1490
+ error "[orch] Codeline '${_cl}': its own recorded agents and prompts are not there — its release lines do not run on another codeline's set"
1491
+ _overall=1; continue
1492
+ fi
1479
1493
  _run_release_lines "$_cl" "$_cl_prd" "$_wt" "${LOG_DIR:-/tmp}/lanes/${_cl}" "$_log_file" "$_phase_filter" "$0" "$_prd_path" || _overall=1
1480
1494
  continue
1481
1495
  fi
1482
1496
 
1483
1497
  _rebuild_cross
1484
1498
  log "[orch] Codeline '${_cl}' — ${_n_stories} stories → ${_wt}"
1499
+ # THE LANE WORKS FROM ITS OWN CODELINE'S SET (operator, 2026-10-22: "prompts/profiles BY codeline"): restored before any of its
1500
+ # agents run (lib/prompt-variant.sh lane_codeline_set_restore); a codeline with no recorded set does not run on another's.
1501
+ if ! lane_codeline_set_restore "$_cl_prd"; then
1502
+ error "[orch] Codeline '${_cl}': its own recorded agents and prompts are not there — the lane does not run on another codeline's set"
1503
+ _overall=1; continue
1504
+ fi
1485
1505
 
1486
1506
  # A SEQUENTIAL LANE GETS ITS OWN LOG_DIR TOO. The parallel loop scoped it (2026-07-29: state
1487
1507
  # files read back across lanes); this loop did not, so every lane shared phase-baseline-sha.txt
@@ -97,10 +97,32 @@ function verifyRepair({ repo, base, branch, profile, layer, abortKind, install }
97
97
  wtTip = worktree(repo, branch, profile.test.fixtures);
98
98
  const green = runTests(wtTip, tests, profile, install);
99
99
  if (green.status !== 0 || !profile.test.greenPatterns.every((r) => r.test(green.out))) return bad('the test fails with the fix: not GREEN', { files, red: red.out, green: green.out });
100
- return { ok: true, why: 'RED on the base, GREEN with the fix', files, tests, red: red.out, green: green.out };
100
+ // NOTHING THAT USES THE CHANGED FILE IS BROKEN (LIVE-AMSD-2974-11, 2026-10-22: a RED/GREEN fix broke the test that reads the record
101
+ // listing every changed file, and the doctor never ran it): each existing user is run on the fix; one that passed on the base fails it
102
+ const regression = usersOf(repo, branch, src, tests, profile);
103
+ const broken = regression.filter((t) => runTests(wtTip, [t], profile, install).status !== 0 && runTests(wtBase, [t], profile, install).status === 0);
104
+ if (broken.length) return bad(`the fix breaks ${broken.join(', ')}, which passed on the base: an existing user of the changed file`, { files, red: red.out, green: green.out, regression });
105
+ return { ok: true, why: 'RED on the base, GREEN with the fix, and every existing user of the changed file still passes', files, tests, regression, red: red.out, green: green.out };
101
106
  } finally { if (wtBase) drop(repo, wtBase); if (wtTip) drop(repo, wtTip); }
102
107
  }
103
108
 
109
+ /**
110
+ * The component's existing tests that use a changed file: a test that names it, or names a file of the component that names it (a record
111
+ * listing it, a script calling it). The repair's own tests and the profile's forbidden (monolithic) tests are not among them.
112
+ */
113
+ function usersOf(repo, rev, src, own, profile) {
114
+ const { repairDirs, testDirs, testFile, forbiddenTests } = profile.scope;
115
+ const named = (names, dirs) => {
116
+ if (!names.length) return [];
117
+ const r = git(repo, 'grep', '-l', '-F', ...names.flatMap((n) => ['-e', n]), rev, '--', ...dirs);
118
+ return r.status === 0 ? r.stdout.split('\n').filter(Boolean).map((l) => l.slice(rev.length + 1)) : [];
119
+ };
120
+ const base = (fs_) => [...new Set(fs_.map((f) => path.posix.basename(f)))];
121
+ const referrers = named(base(src), repairDirs).filter((f) => !src.includes(f));
122
+ return named(base([...src, ...referrers]), testDirs)
123
+ .filter((f) => testFile.test(f) && !own.includes(f) && !forbiddenTests.some((r) => r.test(f))).sort();
124
+ }
125
+
104
126
  // ── the reinstall: the component's own installer, then every packaged file compared byte for byte ─────────────────────
105
127
  const show = (repo, rev, rel) => spawnSync('git', ['-C', repo, 'show', `${rev}:${rel}`], { encoding: 'buffer', maxBuffer: 64 * 1024 * 1024 });
106
128
 
@@ -21,12 +21,19 @@ const fs = require('fs');
21
21
  * A STORY THAT SPANS CODELINES IS SPECIFIED PER CODELINE. In a lane's PRD (story.codeline = the lane)
22
22
  * the spec mark from another lane is not this lane's spec: AMSD-2974's three site lanes skipped their
23
23
  * spec pass on a resume because cxshared's spec had stamped the story (2026-10-01). The lane's own
24
- * fix-site entry is the mark that this codeline was investigated.
24
+ * fix-site entry is the mark that this codeline was investigated — but only when specification.codeline
25
+ * is itself unknown. Once it names a lane, that name is definite: AMSD-2974 run 11 attempt 5 had it
26
+ * naming cxshared on every consumer lane's own PRD copy, and the fixSiteAnalysisPerCodeline fallback
27
+ * (populated once, for every codeline together, by the cross-codeline detective pass) wrongly read each
28
+ * consumer's own entry there as proof its OWN coordinator review had run, when it never had.
25
29
  */
26
30
  function lacksOwnLane(s) {
27
31
  if (!Array.isArray(s.codelines) || s.codelines.length < 2 || !s.codeline) return false;
32
+ const specCodeline = s.specification && s.specification.runId ? s.specification.codeline : undefined;
28
33
  // This lane's own spec pass stamped its codeline on the spec (spec-mode-runner.js stampSpecification).
29
- if (s.specification && s.specification.runId && s.specification.codeline === s.codeline) return false;
34
+ if (specCodeline === s.codeline) return false;
35
+ // A KNOWN different lane is a definite mismatch — never excused by the legacy fallback below.
36
+ if (specCodeline) return true;
30
37
  const own = s.fixSiteAnalysisPerCodeline;
31
38
  return !(own && Object.prototype.hasOwnProperty.call(own, s.codeline));
32
39
  }