Commit 17708a0
authored
refactor(core): move the LEGACY_ENTITY_NAMES parity check out of an include_str test (#3204)
`legacy_entity_name_tests::legacy_entity_names_match_the_lookup_arms` recovered
the match-arm keys by `include_str!`-ing its own module and comparing them to
`LEGACY_ENTITY_NAMES`. That is a source-text assertion: AGENTS.md bans them, and
#3195's Rust gate flags this exact line. Running that gate against `main` + #3198
reports one violation repo-wide, and this is it.
The site is one hour old. It arrived with #3124 (`cf840556`), in the follow-up
to a review that asked for the const to stop being a second hand-maintained list
-- so the gate is not discovering old debt, it is catching a fix that reached for
the wrong instrument.
MOVED RATHER THAN MARKED. `@source-text-assertion-ok` would have been defensible:
the test carries `assert!(!from_source.is_empty())`, so the vacuity failure the
rule exists to catch cannot happen there. But a marker excuses a violation, and
the violation is avoidable. `scripts/check-legacy-entity-coverage.mjs` already
parses this file's arm keys for its own purposes, so it gains a
`LEGACY_ENTITY_NAMES` comparison and the Rust test goes away. Same call the repo
already made for `check-clash-degenerate-reason-parity.mjs`: a claim about two
SOURCES belongs in a lint, where reading both is the honest thing rather than the
banned thing.
The gate version is STRICTER than the test it replaces:
- an arm with no const entry -> named, exit 1
- a const entry with no arm -> named, exit 1 (the test had this too)
- the const renamed or reshaped -> "no names extracted", exit 1
All three probed, and all three are regression tests in
check-legacy-entity-coverage.test.mjs, which mutates a copy of the real source in
a temp tree and asserts the gate turns red. The third matters most: two empty
sets agree about everything, and the test being replaced could only guard its own
half of that.
`every_listed_name_resolves_as_legacy` stays -- it reads no source text and pins
that the const holds arm keys rather than base-type names.
VERIFIED
#3198's gate against this tree: OK (593 .rs files, 110 reads, 0 assertions).
So #3198 lands green with no marker and no allowlist row.
cargo test --workspace --no-fail-fast: 2156 passed, 0 failed.
cargo clippy --workspace --exclude ifc-lite-wasm --all-targets -- -D warnings: clean.
It caught the orphaned `use std::collections::BTreeSet` that `cargo test`
was happy to leave -- the warning-vs-error gap AGENTS.md warns about.
590 script tests, check-source-text-assertions, check-test-wiring: all green.
`pnpm lint`'s unused-locals step fails in this worktree, and does so IDENTICALLY
on unmodified main with the same install state -- an `--ignore-scripts` install
leaves no `dist/`, so those packages cannot compile standalone. Environmental,
null-probed, not caused by this diff.
Credit to @BIMvoice: the const and its parity idea are his, from the #3124
follow-up. Only where the check lives changes.1 parent cf84055 commit 17708a0
3 files changed
Lines changed: 98 additions & 34 deletions
File tree
- rust/core/src
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
254 | 254 | | |
255 | 255 | | |
256 | 256 | | |
257 | | - | |
258 | 257 | | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
263 | 271 | | |
264 | | - | |
265 | | - | |
266 | | - | |
267 | | - | |
268 | | - | |
269 | | - | |
270 | | - | |
271 | | - | |
272 | | - | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | 272 | | |
294 | 273 | | |
295 | 274 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
90 | 107 | | |
91 | 108 | | |
92 | 109 | | |
| |||
198 | 215 | | |
199 | 216 | | |
200 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
201 | 248 | | |
202 | 249 | | |
203 | 250 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
102 | 102 | | |
103 | 103 | | |
104 | 104 | | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
105 | 143 | | |
106 | 144 | | |
107 | 145 | | |
| |||
0 commit comments