Skip to content

Commit ec86867

Browse files
fix(dispatch-gates): a migration-entry change derives the cli guidance test that reads every entry (#34893)
Fixes #34760 Clause-②: no Metadata-protocol: none ## 维护者速读 - 改了什么:`dispatch-gates` 新增一条变更种类行:改动 `packages/spec/src/migrations/entries/**` 时,派生清单会点名 cli 的 `migrate-meta-engine-guidance` 测试命令。 - 为什么改:该测试检查每条迁移条目打印给作者的文字不带工单号,但只在 CI 的 Test Core 里跑,本地门禁清单全绿也会在 CI 才红,白费一轮。 - 风险与回滚:只动 `scripts/pm/**` 三个文件,不发布、不新增门禁或 CI 作业;回滚即 revert 本 PR。 - 先看:`scripts/pm/dispatch-gates.data.mjs`(新行与根目录常量)、`scripts/pm/dispatch-gates.mjs`(`ciSubset` 绑定与 STALE 判定)、`scripts/pm/dispatch-gates.self-test.mjs`(新测试段)。 - 两分钟验证:`node scripts/pm/dispatch-gates.mjs --commands packages/spec/src/migrations/entries/retired-defs/17.api__CreateViewRequest.ts 2>/dev/null | grep -c migrate-meta-engine-guidance`,预期输出 `1`(main 上为 `0`)。 - 需要你做的:无,席位落地。 ## What changes - **Data** (`dispatch-gates.data.mjs`): a new `CHANGE_KIND_ROWS` row, kind `spec-migration-entry`, naming `pnpm --filter @objectstack/cli exec vitest run test/migrate-meta-engine-guidance.test.ts`, and `SPEC_MIGRATION_ENTRY_ROOTS` (the `entries` directory and its subtree, in CI's `paths:` language), plus the row's deletion criterion in the table header. The row's `why` states the build prerequisite runnably (`pnpm --filter '@objectstack/cli^...' build`): the cli test config does not alias `@objectstack/spec` to source, so a stale spec dist would answer for the edit. - **Engine** (`dispatch-gates.mjs`): the predicate `readBySpecMigrationEntryConsumers` (the same `triggerListCovers` reader the ui/scripts suite row uses), and one extension of the existing CI-job binding. The ui suite gate narrows its runner by prefix; Test Core's runner (`set -- pnpm turbo run test`) names no package and no file, so this gate declares `ciSubset` (the repo path of the one test file). At load, `bindChangeKindRows` holds the name to the one spelling `packageTestSubsetFile` reads, and that file must match `ciSubset`. At resolve, the gate turns STALE when the Test Core job no longer runs the package test task OR the file is gone, so a moved test cannot leave a command that runs nothing. - **Self-test**: a new section (specimens, controls, rendering, runnable union, `--ran` verdict without it, STALE rendering, the load-time refusals, and the live binding plus live file plus owning package). The marker-line census pin moves 751 to 753 because of the two import lines. **One named row, not the general form.** The tree does give a syntactic signal: ten cli test files import `@objectstack/spec/migrations`. But that import is not a reading of the entries' prose. The others drive one conversion, a range or a write, behaviour the spec package's own tests already reach, and one of them is nightly-tier `.e2e`, so the queue never runs it. The guidance test is the only one that holds every entry's printed text, which is what an entry edit changes, and it is the test that was measured missing. A second consumer gets its own row when its own miss is measured. This is written into the `SPEC_MIGRATION_ENTRY_ROOTS` docblock. No new gate, no new check script, no new CI job and no new `pnpm check:*` (the card's ruling). `scripts/pm/**` ships nothing, so this PR carries `skip-changeset`. ## Tests <details><summary>Re-check (card) and controls, at head 8463c44</summary> - `--commands packages/spec/src/migrations/entries/retired-defs/17.api__CreateViewRequest.ts`: 73 commands, **1** naming `migrate-meta-engine-guidance`. On `origin/main` d947a93 the count was 0 of 72. The card's own path `entries/index.ts` does not exist, so a real file under `entries/` was used. - CONTROL `packages/spec/src/ui/view.zod.ts`: 0. CONTROL `packages/spec/src/migrations/registry.ts.template`: 0. The `entries` directory itself: 1. </details> <details><summary>Self-test</summary> - `node scripts/pm/dispatch-gates.mjs --self-test --fast`: `✓ dispatch-gates self-test (fast tier): 2249 cases pass; 9 slow section(s) deferred.` - `pnpm check:pm-dispatch-gates` (fast tier off CI): the same verdict line, plus `✓ check:pm-dispatch-gates --self-test: the exit contract holds…`. The slow tier is NOT MEASURED locally (reason: off-CI default is the fast tier, and the run is longer than the container's foreground cap). CI runs it. </details> <details><summary>Ablation (one shot, committed fix first, via scripts/ablation-replace.mjs)</summary> - Mutation: the predicate binding `'spec-migration-entry': (path) => readBySpecMigrationEntryConsumers(path),` changed to `'spec-migration-entry': () => false,`. The tool reported `anchor 1 -> 0`, and the injected text was counted at 1 on disk. - Under the mutant: re-check count **0**, and the fast self-test **exited 1** with 10 failing cases. Among them: `through the whole table, …17.api__CreateViewRequest.ts derives the guidance test`, `⭐ a run record carrying every derived command BUT the guidance test is NOT ok, and names it unrun`, and the STALE-rendering case. - Restore: `blob == HEAD (6c5fd05) and git diff HEAD is empty`. </details> <details><summary>The derived command runs as written</summary> `pnpm --filter '@objectstack/cli^...' build && pnpm --filter @objectstack/cli exec vitest run test/migrate-meta-engine-guidance.test.ts` under the verify lock: `Test Files 1 passed (1)`, `Tests 3 passed (3)`, `VERDICT command-exit 0`. </details> ## Acceptance notes - `--commands` on the parent directory `packages/spec/src/migrations` is deliberately not covered by the roots, because the registry template and generator beside `entries/` are not what the test reads. A surface given as `packages/spec` does not derive the row either. - While writing the matcher, `check:pnpm-filter-targets` flagged it. The first spelling of the regex and of the refusal text read as two dead `--filter` targets. Both were respelled in 8463c44, and the gate is green. ## Verification Gate union on the final head 8463c44: `dispatch-gates --commands` derived 63 families. All 63 were run locally with exit 0. `check:i18n-coverage` first answered exit 3 (PREREQUISITE NOT MET, cli not built), then exit 0 after its stated build: `OK (14 config(s), 423 baselined untranslated string(s), none new)`. The `--ran` reconciliation answered: `✓ dispatch-gates --ran: 63 derived famil(ies) accounted for — 63 run, 0 NOT-MEASURED`. `overlap-check`: `VERDICT clean exit 0` (origin/main and one open PR sharing the data file merge cleanly). CI families are cited from this PR's check-runs in the report. --- _Generated by [Claude Code](https://claude.ai/code/session_012MmDsS4GoHCgYwA2uv3n3C)_ --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent aa0fde3 commit ec86867

3 files changed

Lines changed: 181 additions & 6 deletions

File tree

‎scripts/pm/dispatch-gates.data.mjs‎

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,15 @@ export const ESCAPABLE_LITERAL_LEDGER_ROWS = Object.freeze([
951951
* each test "really" reads does NOT qualify: that map is a second thing
952952
* that goes stale, and the run is cheap enough not to need one (measured
953953
* below).
954+
* - spec-migration-entry entry: when a workflow runs the cli
955+
* migrate-meta-engine-guidance test as a step of its own, under an
956+
* invocation the discovery reads, the row can name that family instead of
957+
* standing in for the Test Core job; and when the job stops running the
958+
* package test task, or the test file is moved or deleted, the binding goes
959+
* STALE by itself. ⛔ Widening it to every cli test that imports the
960+
* published migrations subpath does NOT qualify as a repair of anything:
961+
* that import is a syntactic reach, not a reading of the entries' prose
962+
* (see `SPEC_MIGRATION_ENTRY_ROOTS`).
954963
* - population-net entries (#31257, fifteen): when the gate's own source
955964
* declares a population this derivation can MATCH (a subtree it really
956965
* walks, beside a filter the derivation reads), the ordinary path match
@@ -1302,6 +1311,19 @@ export const CHANGE_KIND_ROWS = [
13021311
},
13031312
],
13041313
},
1314+
{
1315+
kind: 'adds, edits or deletes an ADR-0087 migration entry under packages/spec/src/migrations/entries (the generated registry the published migrations subpath serves, read from the PATH)',
1316+
matches: 'spec-migration-entry',
1317+
gates: [
1318+
{
1319+
name: 'pnpm --filter @objectstack/cli exec vitest run test/migrate-meta-engine-guidance.test.ts',
1320+
ciJob: 'Test Core',
1321+
ciRunner: 'set -- pnpm turbo run test',
1322+
ciSubset: 'packages/cli/test/migrate-meta-engine-guidance.test.ts',
1323+
why: "it spawns `os migrate meta --all` once and holds the block the terminal prints for EVERY semantic entry in the registry (surface, why: from `reason`, verify: from `acceptanceCriteria`) to carry no tracker number, so an entry whose prose cites one, or a new entry in any family, moves it. It is a cli test, so no check family and no spec package test covers it: CI runs it only inside the Test Core shards' package test task, and a card editing entry text learned of a red one a CI round later, after a fully green local ledger. It reads the entries through the PUBLISHED migrations subpath, which the cli test config does not alias to source, so build the cli dependency closure first or a stale spec dist answers for your edit: pnpm --filter '@objectstack/cli^...' build . Repair the entry's prose to state the lesson in words; ADR ids stay",
1324+
},
1325+
],
1326+
},
13051327
];
13061328

13071329
/**
@@ -1321,6 +1343,26 @@ export const UI_SCRIPTS_SUITE_ROOTS = Object.freeze([
13211343
'ui/scripts/**',
13221344
]);
13231345

1346+
/**
1347+
* The roots whose change the cli `migrate-meta-engine-guidance` test can see, in CI's own `paths:` language
1348+
* (matched by `triggerListCovers`, as `UI_SCRIPTS_SUITE_ROOTS` is). The test reads every semantic entry of
1349+
* the generated migration registry, and that registry is generated from the files under `entries/` (the
1350+
* `GENERATED_MODULE_SOURCES` row below names the same directory), so a change there is what moves it. The
1351+
* bare directory is listed beside its subtree because a dispatch surface is often given as that directory.
1352+
*
1353+
* ONE named test, not every cli test that imports the published migrations subpath. That import is a
1354+
* reliable SYNTACTIC signal (ten cli test files carry it on this tree) but not a reading of the entries'
1355+
* prose: the others import the chain to drive one conversion, a range or a write, and pin behaviour the
1356+
* spec package's own tests already reach, while one of them is nightly-tier and never runs in the queue.
1357+
* The guidance test is the one that holds every entry's printed text, which is what an entry edit moves,
1358+
* and the one measured missing on a green local ledger. A second consumer earns its own row on its own
1359+
* measured miss.
1360+
*/
1361+
export const SPEC_MIGRATION_ENTRY_ROOTS = Object.freeze([
1362+
'packages/spec/src/migrations/entries',
1363+
'packages/spec/src/migrations/entries/**',
1364+
]);
1365+
13241366
/**
13251367
* The globs that MANDATE a model tier for any card whose file surface touches
13261368
* them, as DATA. This is the one list in this file besides CHANGE_KIND_GATES,

‎scripts/pm/dispatch-gates.mjs‎

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@ import {
487487
ESCAPABLE_LITERAL_LEDGER_ROWS,
488488
CHANGE_KIND_ROWS,
489489
UI_SCRIPTS_SUITE_ROOTS,
490+
SPEC_MIGRATION_ENTRY_ROOTS,
490491
MANDATORY_TIER_GLOB_ROWS,
491492
SUSPECT_TIER_GLOB_ROWS,
492493
GENERATED_MODULE_SOURCES,
@@ -506,6 +507,7 @@ export {
506507
RETIRED_TIER_WORDS,
507508
GENERATED_MODULE_SOURCES,
508509
UI_SCRIPTS_SUITE_ROOTS,
510+
SPEC_MIGRATION_ENTRY_ROOTS,
509511
};
510512

511513
// Re-exported so this tool's self-test drives the SAME predicates the gate
@@ -12083,6 +12085,40 @@ export function readByUiScriptsSuite(path, roots = UI_SCRIPTS_SUITE_ROOTS) {
1208312085
return triggerListCovers(roots, path.replace(/^\.\//, '')) !== null;
1208412086
}
1208512087

12088+
/**
12089+
* Does this input path sit under the migration-entry sources the cli guidance test reads?
12090+
*
12091+
* The same reader as `readByUiScriptsSuite`, over `SPEC_MIGRATION_ENTRY_ROOTS`: a file or the directory
12092+
* under `packages/spec/src/migrations/entries`, in CI's own `paths:` language, and nothing beside it — not
12093+
* the registry template, not the generator, not the spec manifest.
12094+
*/
12095+
export function readBySpecMigrationEntryConsumers(path, roots = SPEC_MIGRATION_ENTRY_ROOTS) {
12096+
return triggerListCovers(roots, path.replace(/^\.\//, '')) !== null;
12097+
}
12098+
12099+
/**
12100+
* The one shape a PACKAGE-TEST subset gate's name may take: `pnpm --filter PKG exec vitest run FILE`, FILE
12101+
* relative to that package, one file and no other argument. Returns the FILE, or null.
12102+
*
12103+
* A gate standing in for a job that runs every package's test TASK (Test Core's `turbo run test`) cannot
12104+
* narrow that runner by prefix the way the ui suite narrows its own: the runner names no package and no
12105+
* file, so the local subset is spelled another way. It declares `ciSubset`, the repo path of the one file it
12106+
* runs, and this is the spelling the binding holds its name to — so the name and the path cannot name two
12107+
* different files, and a respelled name refuses at load instead of resolving by accident.
12108+
*/
12109+
export function packageTestSubsetFile(name) {
12110+
const m = /^pnpm --filter\s(\S+) exec vitest run (\S+)$/.exec(name);
12111+
return m ? m[2] : null;
12112+
}
12113+
12114+
/**
12115+
* Is a package-test subset gate's binding whole? `ciSubset` is a repo path ending in the FILE its name runs.
12116+
*/
12117+
export function packageTestSubsetIsWhole(gate) {
12118+
const file = packageTestSubsetFile(gate.name);
12119+
return typeof gate.ciSubset === 'string' && file !== null && gate.ciSubset.endsWith(`/${file}`);
12120+
}
12121+
1208612122
/**
1208712123
* Does a live workflow still run the CI job a change-kind gate is the local SUBSET of (#26318)?
1208812124
*
@@ -12128,6 +12164,7 @@ const CHANGE_KIND_PREDICATES = Object.freeze({
1212812164
'cli-command-literal': (path) => carriesACliCommandLiteral(path),
1212912165
'adr-anchored-file': (path) => breaksAnAdrAnchor(path),
1213012166
'ui-scripts-suite-input': (path) => readByUiScriptsSuite(path),
12167+
'spec-migration-entry': (path) => readBySpecMigrationEntryConsumers(path),
1213112168
// One per population net (#31257), each bound to its own net.
1213212169
...Object.fromEntries(Object.entries(POPULATION_NETS).map(([key, net]) => [key, (path) => reachesPopulationNet(path, net)])),
1213312170
'published-readme-claim': (path) => takesAReadmeClaim(path),
@@ -12144,12 +12181,16 @@ export function bindChangeKindRows(rows, predicates = CHANGE_KIND_PREDICATES) {
1214412181
}
1214512182
// A CI-job-subset gate (`ciJobRunsRunner`) carries both halves of its binding, and its name narrows
1214612183
// the runner it stands in for — refused at load, so a half-declared row cannot resolve by accident.
12184+
// A PACKAGE-TEST subset (`ciSubset`) narrows a runner that names no file, so its name is held to the
12185+
// one spelling `packageTestSubsetFile` reads, naming the file `ciSubset` names, instead.
1214712186
for (const gate of row.gates) {
12148-
const bound = gate.ciJob !== undefined || gate.ciRunner !== undefined;
12149-
if (bound && !(typeof gate.ciJob === 'string' && typeof gate.ciRunner === 'string' && gate.name.startsWith(`${gate.ciRunner} `))) {
12187+
const bound = gate.ciJob !== undefined || gate.ciRunner !== undefined || gate.ciSubset !== undefined;
12188+
const narrows = gate.ciSubset !== undefined ? packageTestSubsetIsWhole(gate) : gate.name.startsWith(`${gate.ciRunner} `);
12189+
if (bound && !(typeof gate.ciJob === 'string' && typeof gate.ciRunner === 'string' && narrows)) {
1215012190
throw new Error(
1215112191
`dispatch-gates: change-kind row '${row.kind}' gate '${gate.name}' declares a CI-job binding that is not whole — ` +
12152-
'a gate standing in for a CI job carries both `ciJob` and `ciRunner`, and its name begins with that runner',
12192+
'a gate standing in for a CI job carries both `ciJob` and `ciRunner`, and its name begins with that runner — ' +
12193+
'or, for a package-test subset, carries `ciSubset` and is spelled as a pnpm filter on one package, then `exec vitest run FILE`, with `ciSubset` ending in that FILE',
1215312194
);
1215412195
}
1215512196
}
@@ -12194,6 +12235,7 @@ export function changeKindGates(paths, resolveInvocation, kinds = CHANGE_KIND_GA
1219412235
why: gate.why,
1219512236
command: resolveInvocation(gate.name, gate),
1219612237
...(gate.ciJob ? { ciJob: gate.ciJob, ciRunner: gate.ciRunner } : {}),
12238+
...(gate.ciSubset ? { ciSubset: gate.ciSubset } : {}),
1219712239
})),
1219812240
});
1219912241
}
@@ -12204,10 +12246,12 @@ export function changeKindLines(paths, resolveInvocation, kinds = CHANGE_KIND_GA
1220412246
const lines = [];
1220512247
for (const { kind, hits, gates } of changeKindGates(paths, resolveInvocation, kinds)) {
1220612248
lines.push(` ${kind}: ${hits.join(', ')}`);
12207-
for (const { name, why, command, ciJob, ciRunner } of gates) {
12249+
for (const { name, why, command, ciJob, ciRunner, ciSubset } of gates) {
1220812250
lines.push(
1220912251
command
1221012252
? ` - ${command} — ${why}`
12253+
: ciSubset
12254+
? ` - ⚠ ${name}: STALE — no workflow job named '${ciJob}…' runs '${ciRunner}' any more, or ${ciSubset} is gone. The job was renamed or retired, or the test moved; fix CHANGE_KIND_GATES in this script.`
1221112255
: ciJob
1221212256
? ` - ⚠ ${name}: STALE — no workflow job named '${ciJob}…' runs '${ciRunner}' any more. The job was renamed or retired; fix CHANGE_KIND_GATES in this script.`
1221312257
: ` - ⚠ ${name}: STALE — no workflow runs a gate under this name. It was renamed or retired; fix CHANGE_KIND_GATES in this script.`,
@@ -15671,7 +15715,12 @@ function derive(paths, { showResidue = false, mode = 'human', runRecord = [], si
1567115715
// rows: the card this section answers is about two renderings of one
1567215716
// derivation drifting apart, so a second traversal here would reintroduce it.
1567315717
const resolveInvocation = (name, gate = null) => {
15674-
if (gate?.ciJob) return ciJobRunsRunner(gate, workflowEntries) ? name : null;
15718+
if (gate?.ciJob) {
15719+
// A package-test subset also owes its file: a moved or deleted test renders STALE, never a command
15720+
// that runs nothing (vitest exits non-zero on a filter matching no file, but only once someone runs it).
15721+
if (gate.ciSubset !== undefined && !existsSync(nodePath.join(ROOT, gate.ciSubset))) return null;
15722+
return ciJobRunsRunner(gate, workflowEntries) ? name : null;
15723+
}
1567515724
const entry = byCheck.get(name);
1567615725
return entry ? runnableInvocation(entry) : null;
1567715726
};

‎scripts/pm/dispatch-gates.self-test.mjs‎

Lines changed: 85 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,9 @@ import {
286286
zeroSegmentForms,
287287
readByUiScriptsSuite,
288288
UI_SCRIPTS_SUITE_ROOTS,
289+
readBySpecMigrationEntryConsumers,
290+
SPEC_MIGRATION_ENTRY_ROOTS,
291+
packageTestSubsetFile,
289292
adrAnchorTargets,
290293
breaksAnAdrAnchor,
291294
carriesACliCommandLiteral,
@@ -5542,6 +5545,86 @@ export function selfTest({ tier = 'full' } = {}) {
55425545
t('…and so does one whose name does not narrow its runner',
55435546
(() => { try { bindChangeKindRows([{ kind: 'k', matches: 'test-file', gates: [{ name: 'pnpm vitest run', ciJob: 'Test UI', ciRunner: 'pnpm --dir ui exec vitest run', why: 'w' }] }]); return false; } catch (e) { return String(e.message).includes('CI-job binding that is not whole'); } })());
55445547

5548+
// ── The cli guidance test a migration-entry change owes (#34760) ───────────
5549+
//
5550+
// `packages/cli/test/migrate-meta-engine-guidance.test.ts` holds every semantic
5551+
// entry's printed block to carry no tracker number, and CI runs it only inside
5552+
// Test Core's package test task, so an entry edit learned of a red one a CI
5553+
// round after a green local ledger. The entry stands in for that job as a
5554+
// PACKAGE-TEST subset (`ciSubset`): pinned here are the predicate on the entries
5555+
// tree and beside it, the rendering and the runnable union, the `--ran` verdict
5556+
// without it, the STALE branch, the name's one spelling, and the binding and the
5557+
// file against the live tree.
5558+
const GUIDE = 'pnpm --filter @objectstack/cli exec vitest run test/migrate-meta-engine-guidance.test.ts';
5559+
const GUIDE_SPECIMENS = Object.freeze([
5560+
'packages/spec/src/migrations/entries/retired-defs/17.api__CreateViewRequest.ts',
5561+
'packages/spec/src/migrations/entries',
5562+
'./packages/spec/src/migrations/entries/semantic/x.ts',
5563+
]);
5564+
const GUIDE_CONTROLS = Object.freeze([
5565+
'packages/spec/src/ui/view.zod.ts',
5566+
'packages/spec/src/migrations/registry.ts.template',
5567+
'packages/spec/src/migrations/entries-other/x.ts',
5568+
'packages/cli/test/migrate-meta-engine-guidance.test.ts',
5569+
]);
5570+
const guideEntry = CHANGE_KIND_GATES.filter((k) => k.gates.some((g) => g.name === GUIDE));
5571+
const guideGate = guideEntry[0]?.gates.find((g) => g.name === GUIDE) ?? {};
5572+
t('⭐ exactly one entry in the table names the cli guidance test, bound to the Test Core job and the spec-migration-entry predicate',
5573+
guideEntry.length === 1 && guideGate.ciJob === 'Test Core'
5574+
&& CHANGE_KIND_ROWS.filter((r) => r.gates.some((g) => g.name === GUIDE)).map((r) => r.matches).join() === 'spec-migration-entry');
5575+
t('the roots are the entries directory and its subtree, in the trigger language',
5576+
SPEC_MIGRATION_ENTRY_ROOTS.includes('packages/spec/src/migrations/entries/**') && SPEC_MIGRATION_ENTRY_ROOTS.includes('packages/spec/src/migrations/entries'));
5577+
for (const specimen of GUIDE_SPECIMENS) {
5578+
t(`a migration-entry surface reaches the guidance test (${specimen})`, readBySpecMigrationEntryConsumers(specimen));
5579+
}
5580+
for (const control of GUIDE_CONTROLS) {
5581+
t(`CONTROL: ${control} is outside the entries tree`, !readBySpecMigrationEntryConsumers(control));
5582+
}
5583+
const guideResolved = (name, gate = null) => (gate?.ciJob ? name : `pnpm ${name}`);
5584+
const throughTableGuide = (p) => changeKindLines([p], guideResolved).some((l) => l.includes(`- ${GUIDE} —`));
5585+
for (const specimen of GUIDE_SPECIMENS) {
5586+
t(`through the whole table, ${specimen} derives the guidance test, anchored on the delimiter`, throughTableGuide(specimen));
5587+
t(`…and the runnable union carries it for ${specimen}`, commandsFor({ kindGroups: changeKindGates([specimen], guideResolved) }).includes(GUIDE));
5588+
}
5589+
for (const control of GUIDE_CONTROLS) {
5590+
t(`…and ${control} derives no guidance line and no guidance command`,
5591+
!throughTableGuide(control) && !commandsFor({ kindGroups: changeKindGates([control], guideResolved) }).includes(GUIDE));
5592+
}
5593+
const guideLine = changeKindLines([GUIDE_SPECIMENS[0]], guideResolved, guideEntry).find((l) => l.includes(`- ${GUIDE} —`)) ?? '';
5594+
t('the guidance line states its build prerequisite, runnably', guideLine.includes("pnpm --filter '@objectstack/cli^...' build"));
5595+
t('…and carries no tracker number in the text a dev is shown', guideLine !== '' && !/#\d{4,5}\b/.test(guideLine));
5596+
const guideDerived = commandsFor({ kindGroups: changeKindGates([GUIDE_SPECIMENS[0]], guideResolved) });
5597+
const guideWithout = runReconciliation({
5598+
derived: guideDerived,
5599+
record: parseRunRecord(guideDerived.filter((c) => c !== GUIDE).map((c) => `${c} :: exit 0`).join('\n')),
5600+
});
5601+
t('⭐ a run record carrying every derived command BUT the guidance test is NOT ok, and names it unrun',
5602+
!guideWithout.ok && guideWithout.unrun.some((u) => u.command === GUIDE));
5603+
const guideWith = runReconciliation({ derived: guideDerived, record: parseRunRecord(guideDerived.map((c) => `${c} :: exit 0`).join('\n')) });
5604+
t('CONTROL: the same record WITH the guidance test is ok', guideWith.ok);
5605+
const guideStale = changeKindLines([GUIDE_SPECIMENS[0]], () => null, guideEntry);
5606+
t('an unresolvable package-test binding renders STALE, naming the job, the runner and the file it lost',
5607+
guideStale.filter((l) => l.includes(`⚠ ${GUIDE}: STALE`) && l.includes("job named 'Test Core…'") && l.includes(guideGate.ciSubset ?? '\u0000')).length === 1);
5608+
// The name's one spelling, and the load-time refusals it backs.
5609+
t('the package-test subset spelling reads its FILE', packageTestSubsetFile(GUIDE) === 'test/migrate-meta-engine-guidance.test.ts');
5610+
t('…and refuses a second argument or another runner',
5611+
packageTestSubsetFile(`${GUIDE} --project unit`) === null && packageTestSubsetFile('pnpm --filter @objectstack/cli run test') === null);
5612+
const bindRefuses = (gate) => {
5613+
try { bindChangeKindRows([{ kind: 'k', matches: 'test-file', gates: [{ why: 'w', ...gate }] }]); return false; } catch (e) { return String(e.message).includes('CI-job binding that is not whole'); }
5614+
};
5615+
t('a package-test subset whose ciSubset names another file REFUSES at load',
5616+
bindRefuses({ name: GUIDE, ciJob: 'Test Core', ciRunner: 'set -- pnpm turbo run test', ciSubset: 'packages/cli/test/other.test.ts' }));
5617+
t('…and so does one without its job half', bindRefuses({ name: GUIDE, ciSubset: guideGate.ciSubset }));
5618+
t('CONTROL: the live row binds whole', !bindRefuses({ name: GUIDE, ciJob: guideGate.ciJob, ciRunner: guideGate.ciRunner, ciSubset: guideGate.ciSubset }));
5619+
// Against the LIVE tree: the job still runs the package test task, and the file the name runs is the
5620+
// file `ciSubset` names, inside the package `--filter` names.
5621+
t('⭐ the binding resolves against the LIVE workflows — Test Core still runs the package test task', ciJobRunsRunner(guideGate, discoverFamilies().workflowEntries));
5622+
t('⭐ the named test file exists on this tree', typeof guideGate.ciSubset === 'string' && existsSync(nodePath.join(ROOT, guideGate.ciSubset)));
5623+
t('…inside the package the name filters on', (() => {
5624+
const pkgDir = guideGate.ciSubset?.slice(0, -('/' + packageTestSubsetFile(GUIDE)).length) ?? '';
5625+
try { return JSON.parse(readFileSync(nodePath.join(ROOT, pkgDir, 'package.json'), 'utf8')).name === '@objectstack/cli'; } catch { return false; }
5626+
})());
5627+
55455628
// ── The metadata-form edge (#9116) ────────────────────────────────────────
55465629
//
55475630
// The bundles' OTHER producer, and the half no owning-package test can reach:
@@ -8242,7 +8325,8 @@ export function selfTest({ tier = 'full' } = {}) {
82428325
// 738 -> 744 (#30763): the ADR anchor corpus import and its comment.
82438326
// 744 -> 748 (#31257): the two imported gate readers and their comment.
82448327
// 748 -> 751 (#31292): the workspace-enumerator import and its comment.
8245-
'scripts/pm/dispatch-gates.mjs:751 inherited-population',
8328+
// 751 -> 753 (#34760): the data import and its re-export each gained SPEC_MIGRATION_ENTRY_ROOTS.
8329+
'scripts/pm/dispatch-gates.mjs:753 inherited-population',
82468330
// Ninth row, added with the declaration it names: the recogniser's mailbox
82478331
// doorbell battery pins the seven key templates verbatim in the pm-dispatch
82488332
// references' project-forms.md, a population claim on a governed file, so

0 commit comments

Comments
 (0)