|
25 | 25 | # scripts/ and agent prose outside the pm-dispatch rulebook skip it, while |
26 | 26 | # scripts/pm/** whole, the rulebook, a `.claude/**` shell script, a data file a |
27 | 27 | # relative specifier names and a scripts/ file of an unlisted kind still run |
28 | | -# it; a pull request touching only packages/*/src/** runs no PM self-test, and |
29 | | -# `schedule` and `push` still run it over the very changes the PR path skips. |
| 28 | +# it; a test under a package's scripts/ skips it unless a manifest or a |
| 29 | +# workflow names it; a pull request touching only packages/*/src/** runs no PM |
| 30 | +# self-test, and `schedule` and `push` still run it over the very changes the |
| 31 | +# PR path skips. |
30 | 32 | # |
31 | 33 | # Since #19753 it covers migration_registry, the one family that ADDS a gate |
32 | 34 | # to the PR path: an entry, the generated registry, the generator and the two |
@@ -85,13 +87,17 @@ mkdir -p "$UP/packages/a/scripts" "$UP/packages/a/src" "$UP/apps/site/src" "$UP/ |
85 | 87 | "$UP/packages/spec/src/migrations/entries/semantic" "$UP/packages/spec/scripts" |
86 | 88 | printf '{"name":"fixture","private":true}\n' > "$UP/package.json" |
87 | 89 | printf 'packages:\n - packages/*\n' > "$UP/pnpm-workspace.yaml" |
88 | | -printf '{"name":"a"}\n' > "$UP/packages/a/package.json" |
| 90 | +printf '{"name":"a","scripts":{"check:gate":"vitest run scripts/gate.test.ts"}}\n' > "$UP/packages/a/package.json" |
89 | 91 | printf 'export const a = 1;\n' > "$UP/packages/a/src/index.ts" |
90 | 92 | printf 'export const t = 1;\n' > "$UP/packages/a/src/index.test.ts" |
91 | 93 | printf '{"rows":[]}\n' > "$UP/packages/a/src/data.json" |
92 | 94 | printf '#!/usr/bin/env bash\necho foo\n' > "$UP/packages/a/foo.sh" |
93 | 95 | printf 'dist/\n' > "$UP/packages/a/.gitignore" |
94 | 96 | printf 'console.log(1);\n' > "$UP/packages/a/scripts/build.mjs" |
| 97 | +# Two tests under a package's scripts/: one a check:* command in its manifest |
| 98 | +# names (a gate source), one nothing names (#22076). |
| 99 | +printf 'export const g = 1;\n' > "$UP/packages/a/scripts/gate.test.ts" |
| 100 | +printf 'export const b = 1;\n' > "$UP/packages/a/scripts/build.test.ts" |
95 | 101 | printf 'export const site = 1;\n' > "$UP/apps/site/src/page.tsx" |
96 | 102 | printf '# guide\n' > "$UP/docs/guide.md" |
97 | 103 | printf '# page\n' > "$UP/content/docs/page.mdx" |
@@ -128,6 +134,7 @@ printf 'export const registry = [];\n' > "$UP/packages/spec/src/migrations/regis |
128 | 134 | printf 'export const entry = 1;\n' > "$UP/packages/spec/src/migrations/entries/semantic/17.x.ts" |
129 | 135 | printf 'export const gen = 1;\n' > "$UP/packages/spec/scripts/build-migration-registry.ts" |
130 | 136 | printf 'export const schemas = 1;\n' > "$UP/packages/spec/scripts/build-schemas.ts" |
| 137 | +printf 'export const merge = 1;\n' > "$UP/packages/spec/scripts/conversions-merge.test.ts" |
131 | 138 | git_q -C "$UP" add -A |
132 | 139 | git_q -C "$UP" commit -q -m 'C0: root' |
133 | 140 | C0=$(git_q -C "$UP" rev-parse HEAD) |
@@ -544,6 +551,20 @@ run_case 'merge_group: a package-local script is a gate source (the derivation f |
544 | 551 | expect_rc 0 |
545 | 552 | expect_verdicts comment_mask_corpus pm_dispatch_gates declared_population_live bare_root_worklist self_test_workflow_commands |
546 | 553 |
|
| 554 | +S=$(scenario M:packages/a/scripts/build.test.ts) |
| 555 | +run_case 'merge_group: a test under a package scripts/ that no manifest or workflow names is product test code to the PM self-test, which skips (#22076)' "$REPO" merge_group '' "$C0" |
| 556 | +expect_rc 0 |
| 557 | +expect_warnings '' '' |
| 558 | +expect_verdicts slot_lookup query_options_erasure comment_mask_corpus declared_population_live bare_root_worklist self_test_workflow_commands |
| 559 | +expect_reason pm_dispatch_gates 'no changed path is in its read-set' |
| 560 | + |
| 561 | +S=$(scenario M:packages/a/scripts/gate.test.ts) |
| 562 | +run_case 'merge_group: a test under a package scripts/ that a check script names is a gate source and still runs the PM self-test' "$REPO" merge_group '' "$C0" |
| 563 | +expect_rc 0 |
| 564 | +expect_warnings '' '' |
| 565 | +expect_verdicts slot_lookup query_options_erasure comment_mask_corpus pm_dispatch_gates declared_population_live bare_root_worklist self_test_workflow_commands |
| 566 | +expect_reason pm_dispatch_gates 'packages/a/scripts/gate.test.ts (M, workspace)' |
| 567 | + |
547 | 568 | S=$(scenario M:scripts/pm/os-verify-lock.sh) |
548 | 569 | run_case 'merge_group: the lock script runs its own self-test and every family that reads scripts/' "$REPO" merge_group '' "$C0" |
549 | 570 | expect_rc 0 |
@@ -763,6 +784,20 @@ expect_warnings '' '' |
763 | 784 | expect_verdicts entry_guard pm_dispatch_gates declared_population_live bare_root_worklist self_test_workflow_commands |
764 | 785 | expect_reason pm_dispatch_gates 'scripts/pm/README.md (M, scripts)' |
765 | 786 |
|
| 787 | +# The shape the card measured paying the step: a spec source, tests under |
| 788 | +# packages/spec/scripts/ that nothing wires as a gate, and a changeset. |
| 789 | +git_q -C "$REPO" checkout -q -B feature-22076-spec-tests "$C0" |
| 790 | +printf 'export const merge = 2;\n' > "$REPO/packages/spec/scripts/conversions-merge.test.ts" |
| 791 | +printf 'export const index = 3;\n' > "$REPO/packages/spec/src/index.ts" |
| 792 | +printf -- '---\n"spec": patch\n---\nthe shared entry\n' > "$REPO/.changeset/shared-entry.md" |
| 793 | +git_q -C "$REPO" add -A |
| 794 | +git_q -C "$REPO" commit -q -m 'F6: a spec source, an unwired test under packages/spec/scripts, a changeset' |
| 795 | +run_case 'pull_request: a spec source, an unwired test under packages/spec/scripts and a changeset run no PM self-test (#22076)' "$REPO" pull_request main '' |
| 796 | +expect_rc 0 |
| 797 | +expect_warnings '' '' |
| 798 | +expect_verdicts slot_lookup query_options_erasure comment_mask_corpus declared_population_live bare_root_worklist self_test_workflow_commands |
| 799 | +expect_reason pm_dispatch_gates 'no changed path is in its read-set' |
| 800 | + |
766 | 801 | git_q -C "$REPO" checkout -q -B feature-19753 "$C0" |
767 | 802 | printf 'export const entry = 2;\n' > "$REPO/packages/spec/src/migrations/entries/semantic/17.x.ts" |
768 | 803 | git_q -C "$REPO" commit -q -am 'F3: an entry edited on a feature branch, registry not regenerated' |
@@ -867,7 +902,7 @@ pin_step migration_registry 'pnpm --filter @objectstack/spec check:migration-reg |
867 | 902 |
|
868 | 903 | # ── Verdict ───────────────────────────────────────────────────────────────── |
869 | 904 | # #4690: a battery that ran nothing is a failure, never a pass. |
870 | | -if [ "$cases" -lt 68 ] || [ "$checks" -lt 354 ]; then |
| 905 | +if [ "$cases" -lt 71 ] || [ "$checks" -lt 369 ]; then |
871 | 906 | echo "SELFTEST FAILED: only $cases case(s) / $checks check(s) ran -- the battery is short" |
872 | 907 | exit 1 |
873 | 908 | fi |
|
0 commit comments