Commit 200fc82
fix(devx): burn the KNOWN_IMPORT_UNSAFE ledger 10 -> 5 — a main() for the five scripts/ modules that ran on import (#11917)
* fix(pm): make check-governed-prose.mjs inert on import, and drop its dead argv workaround
Its top level ran the whole gate and then called process.exit() — importing it
for its exported predicates terminated the importer mid-import, with exit 0. The
silent-success direction: a caller reading status got "clean" from a gate that
never reported.
The module-scope `process.argv` mutation that withheld `--self-test` from the
sibling import is deleted rather than preserved. check-governed-merges.mjs now
guards both of its module-scope triggers on isEntrypoint(import.meta.url) (main
at :1201, self-test at :1614), so the flag cannot reach either one on an import
path. Measured: importing it with `--self-test` planted in process.argv runs no
self-test, prints nothing, returns its 34 exports. The mutation was never free —
process.argv is process-global, so it edited the importer's argv too.
CLI byte-identical before/after on both paths (default and --self-test): stdout,
stderr and exit code all cmp-clean. Import probe with clean argv: sentinel only,
empty stderr, exit 0. check:entry-guard named the file STALE before its ledger
line was removed; ledger 10 -> 9, gate green.
* fix(devx): give checklist-select.mjs a main(), so importing selectItems does not kill the importer
This one was the fatal shape in the ledger. Its top-level CLI ran on import:
importing it for `selectItems` — the pure resolver the checklist-test skill's
front half is built on — printed a usage block to the importer's stderr and
called process.exit(2) mid-import. The probe's own sentinel never printed.
The self-test block becomes selfTest(), the CLI block becomes main(), and both
run only under isEntrypoint(import.meta.url). No executable line changed other
than its enclosing scope; the process.exit() calls stay exactly where they were.
Verified byte-for-byte against the pristine base tree, since a main() extraction
moves executable lines where a wrap does not — stdout, stderr and exit code all
cmp-clean on six legs: default (usage, exit 2), --self-test, `all --json`,
`area:approvals`, `all --include-blocked`, and `nope.xxx` (the no-match exit-1
path). Import probe with clean argv: sentinel only, empty stderr, exit 0.
check:entry-guard named it STALE before its ledger line went; ledger 9 -> 8.
* fix(devx): give check-release-page-status.mjs a main() so its verdict stops running inside importers
The file exports eleven predicates, and check-release-section-coverage.mjs is a
real reader of that surface — it inherits this gate's scope floor and pins the
two equal in its own self-test. Unguarded, importing any one of those predicates
ran the entire release-page gate and printed its verdict, so a caller's output
carried another gate's OK line above its own.
The run block becomes main(); it and the self-test dispatch now sit behind
isEntrypoint(import.meta.url).
Byte-for-byte against the pristine base tree on both paths, plus both paths of
check-release-section-coverage.mjs — the sibling that reads this module — all
cmp-clean on stdout, stderr and exit code. Import probe with clean argv: sentinel
only, empty stderr, exit 0. check:entry-guard named it STALE first; ledger 8 -> 7.
* fix(devx): give check-error-status-conformance.mjs a main() instead of running the derivation on import
The module exports the whole derivation — parseStandardErrorCodes,
buildConstantIndex, deriveRuntimeStatuses, deriveDoorMap, reconcile and the
message builders. Unguarded, importing any one of them walked the scan root,
read every non-test source file under it and printed this gate's full report
into the importer's stdout before the import returned. Measured on this tree:
the probe's own sentinel printed only after ~8s of another gate's output.
`walk` stays a module-scope function declaration — a declaration is not a side
effect, and the entry-guard rule does not reach one. Everything from
`const update` down becomes main(), behind isEntrypoint(import.meta.url).
Byte-for-byte against the pristine base tree on every code path this file has:
default, --self-test, --report, and --update — for --update, the rewritten
baseline artifact is byte-identical too, not just the stdout. All four legs
cmp-clean on stdout, stderr and exit code. Import probe with clean argv:
sentinel only, empty stderr, exit 0. STALE first; ledger 7 -> 6.
* fix(devx): stop check-query-options-erasure-ratchet.mjs re-execing its importer
The loudest entry in the ledger. Two separate import side effects, fixed two
different ways:
- `ensureStackHeadroom()` at module scope. It re-execs with --stack-size and
then calls process.exit(status), so importing this module REPLACED the
importer's process with a fresh run of this gate. Guarded IN PLACE rather
than moved into main(): its docblock's invariant is an ordering one ("re-exec
once, before any linting -- including before --self-test"), and leaving the
call at its original position in module order is what keeps that ordering
checkable by reading rather than by re-deriving it.
- The tail becomes async main(), with the self-test dispatch, behind the guard.
No module-scope declaration between the two constructs an ESLint instance (all
three `new ESLint` sites are inside functions), so nothing heavy moved across
the re-exec point.
checkHeadroomAdoption() still reads this gate as armed: it tests
/ensureStackHeadroom\s*\(/ over comment-stripped source, which an indented call
satisfies.
CLI byte-identical before/after on both paths — stdout, stderr and exit code —
captured through scripts/pm/os-verify-lock.sh. Import probe with clean argv now
returns in 0.5s with the sentinel only and empty stderr, where before it never
returned at all. STALE first; ledger 6 -> 5.
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 9760d72 commit 200fc82
6 files changed
Lines changed: 344 additions & 285 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
460 | 460 | | |
461 | 461 | | |
462 | 462 | | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | 463 | | |
468 | | - | |
469 | 464 | | |
470 | 465 | | |
471 | 466 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
115 | 116 | | |
116 | 117 | | |
117 | 118 | | |
| |||
1083 | 1084 | | |
1084 | 1085 | | |
1085 | 1086 | | |
1086 | | - | |
1087 | 1087 | | |
1088 | 1088 | | |
1089 | 1089 | | |
| |||
1099 | 1099 | | |
1100 | 1100 | | |
1101 | 1101 | | |
1102 | | - | |
1103 | | - | |
1104 | | - | |
1105 | | - | |
1106 | | - | |
1107 | | - | |
1108 | | - | |
1109 | | - | |
1110 | | - | |
1111 | | - | |
1112 | | - | |
1113 | | - | |
1114 | | - | |
1115 | | - | |
1116 | | - | |
1117 | | - | |
1118 | | - | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
1119 | 1121 | | |
1120 | | - | |
1121 | 1122 | | |
1122 | | - | |
1123 | | - | |
1124 | | - | |
1125 | | - | |
1126 | | - | |
1127 | | - | |
1128 | | - | |
1129 | | - | |
1130 | | - | |
1131 | | - | |
1132 | | - | |
1133 | | - | |
1134 | | - | |
1135 | | - | |
1136 | | - | |
1137 | | - | |
1138 | | - | |
1139 | | - | |
1140 | | - | |
1141 | | - | |
1142 | | - | |
1143 | | - | |
1144 | | - | |
1145 | | - | |
1146 | | - | |
1147 | | - | |
1148 | | - | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
1152 | | - | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
1153 | 1129 | | |
1154 | | - | |
1155 | | - | |
1156 | | - | |
1157 | | - | |
1158 | | - | |
1159 | | - | |
1160 | | - | |
1161 | | - | |
1162 | | - | |
1163 | | - | |
1164 | | - | |
1165 | | - | |
1166 | | - | |
1167 | | - | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
1171 | 1173 | | |
| 1174 | + | |
| 1175 | + | |
1172 | 1176 | | |
1173 | | - | |
1174 | | - | |
1175 | | - | |
1176 | 1177 | | |
1177 | | - | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
1181 | | - | |
1182 | | - | |
1183 | | - | |
1184 | | - | |
1185 | | - | |
1186 | | - | |
1187 | | - | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
1192 | | - | |
| 1178 | + | |
1193 | 1179 | | |
1194 | | - | |
1195 | | - | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
1196 | 1186 | | |
1197 | | - | |
1198 | | - | |
1199 | | - | |
1200 | | - | |
1201 | | - | |
1202 | | - | |
1203 | | - | |
1204 | | - | |
1205 | | - | |
1206 | | - | |
1207 | | - | |
1208 | | - | |
1209 | | - | |
1210 | | - | |
1211 | | - | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
1212 | 1190 | | |
1213 | | - | |
1214 | | - | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
1215 | 1208 | | |
1216 | | - | |
1217 | | - | |
1218 | | - | |
1219 | | - | |
1220 | | - | |
1221 | | - | |
1222 | | - | |
1223 | | - | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
1224 | 1225 | | |
1225 | | - | |
1226 | | - | |
1227 | | - | |
1228 | | - | |
1229 | | - | |
| 1226 | + | |
| 1227 | + | |
| 1228 | + | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1230 | 1234 | | |
1231 | 1235 | | |
1232 | | - | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
0 commit comments