fix(819): close the fattened-absentFromDisk hole, and retract a third false coverage claim
Round 12 found a BLOCKER, and it is the third instance of one habit of mine in
this change: an affirmative coverage claim I had not measured. The guard said
"Every mutation that could make it blind runs through `expectedTrackedSources`,
which the fixture test pins."
MEASURED FALSE, and reproduced here before fixing. Widening the plugin's own
derivation by `|| path.startsWith('src/components/')` does not run through that
function at all — the fixture test INJECTS `absentFromDisk`, so it structurally
cannot police what the plugin derives. Those files are then subtracted from
`expected`, which disarms the hole-detection direction: a tracked
`src/components/.probe819.ts` holding `pageSize: 100` goes from red — named
correctly by the shortfall test — to 43/43 green.
The co-occurring condition is not exotic. It is exactly the case the shortfall
test exists for and that this repo has measured as PERMANENT rather than
transient: a dotfile, a dot-directory, or a disk/index spelling divergence under
`core.ignorecase` (true on this machine) or NFD/NFC.
CLOSED rather than merely stated, since one assertion does it: a path the WALK
found is on disk by construction, so it can never legitimately be reported
absent. MEASURED green on a clean tree, and red by name under the mutation.
What that closes and what it does not, measured both ways and written down: it
catches any fattening overlapping a walked file. A fattening restricted to paths
the walk cannot see anyway stays inside residual (3) — which is widened from "the
plugin's two lists partition faithfully" to "the plugin's THREE outputs describe
the repository faithfully", since `absentFromDisk` is an output the pair-shaped
wording did not cover.
Also from round 12:
- A pointer said "see residual (3)" as though it were the only blind one; (1)
became blind last round.
- "every extra path is tracked" is inexact on a developer checkout — an untracked
out-of-scope file lands in `others`, so it is accounted for but not tracked.
The conclusion holds; the reason is now stated exactly.
Refs: #819
This commit is contained in:
@@ -166,7 +166,7 @@ The audit #806 asked for, recorded whichever way it came out, because "we looked
|
||||
| `test_workflow_job_guards.py` | `.gitea/workflows/*.y*ml` | **yes** — every tracked workflow's jobs must each declare a `CI_JOB_ROLE`, and the guard-declaring ones must match `## Workflow-job guards` both ways | index-derived from the start (ersatztv#786); registered in `test_guard_populations_derive_from_git.py` so the shared proof covers it |
|
||||
| `test_pr_changed_files.py` | `.gitea/workflows/*.y*ml` | **yes** — "no OTHER workflow writes the review-verdict status", and since ersatztv#748 "every tracked workflow declares a `permissions:` block", with NO exemption list (the one `ci-image.yml` briefly needed was deleted when #744 landed, per #835) | converted. Not on #806's list and found by cold review on the pushed head: an untracked `.yaml` dropped in `.gitea/workflows/` reddened two guards while absent from the index — the issue's list of files to assess was a starting point, not the population |
|
||||
| `test_workflow_persist_credentials.py` | `.gitea/workflows/*.yml` + `*.yaml` | **yes** — every `actions/checkout` in every workflow must drop the persisted credential | derived from the index from the start (#835). Shipped with NO exemption list, which is why it waited for #744: the one non-compliant checkout would otherwise have bought a permanent entry that keeps passing after its reason expires |
|
||||
| `web/src/api/pageSizeCallSites.guard.test.ts` | `import.meta.glob` over `web/src/**/*.{ts,tsx,mts,cts}`, INTERSECTED with the git index | **yes** — an unregistered discovered site fails | converted under #819. The population is the glob INTERSECTED with the git index, and the walk/index divergence is asserted in BOTH directions WITHIN a shared scope: a key the index does not carry is dropped, and a tracked, on-disk, in-scope path that never reached the scanner FAILS rather than shrinking the population silently (that direction catches a dotfile, which the glob cannot match, and a disk/index spelling divergence, which `core.ignorecase` and NFD/NFC normalisation make permanent). The SCOPE itself cancels out of that equality — both sides call one `isInScopeSourcePath` — so narrowing it moves both sets together and no assertion comparing the two sides can see it. That is closed separately, by re-deriving the predicate from its two components over the whole tracked index (`the shared scope predicate is EXACTLY its two documented components`). Two mechanisms carry that. FIRST, the scope predicate is proved by a CLOSED-FORM restatement — it may share no helper, at any depth, with the predicate it checks, since anything shared sits on both sides of the comparison and cancels. FOUR earlier attempts were each measured going green while removing real files: a table of example paths (four of `src/`'s eight directories, missed a 23-file narrowing), a decomposition delegating its filename half to `isScannableSourceFileName` (11 files), one still sharing a `basename` helper (15 files, and blind to a planted call site), and one still sharing the tracked-file array every comparison was derived from (8 files, also blind). SECOND — because that last one showed a restatement cannot police the population it reads — the plugin runs a separate `git ls-files --others` query and the guard requires every in-scope walked path to appear in `tracked ∪ others`; narrowing `tracked` cannot suppress that, since it adds nothing to `others`. FIVE residuals, NOT a claim of closure, each with its direction MEASURED by planting a real `pageSize` call site rather than reasoned about. FAIL-NOISY (they redden a checkout; they cannot hide a call site): (2) a scope term matching no tracked path today survives until the day it first matches one; (4) the WIRING in `listSourceFiles`, indistinguishable on a clean checkout where the walk set and the index set are the same set, so no assertion COMPARING THE TWO POPULATIONS can tell which is passed; (5) `ABSENT_FROM_DISK` emptied. BLIND — each hid a planted `pageSize: 100` with the whole suite green: (1) a COORDINATED edit of the scope predicate and BOTH closed-form restatements, which is three sites and not two, since a second restatement guards `expectedTrackedSources` (measured: the two-site edit reddens, the three-site edit does not) — tolerated because a three-site policy edit is review-visible in a way a one-line slip is not; and (3) a mispartition of the plugin's two lists, which preserves the union any consumer compares and so is invisible from the consuming side — answerable only by testing the derivation directly, and the real-git tests that do so catch an UNCONDITIONAL mispartition, not one keyed on a path pattern. Neither blind residual is tolerated for being harmless. The index is read by `web/vite-plugins/trackedSourceFiles.ts` in Vite's own Node context and handed to the app project as the virtual module `virtual:etv-tracked-source-files`. That is what reaches the index without admitting `@types/node` to `tsconfig.app.json` — the obstacle that deferred this, since wiring those types in was tried and reverted (it leaked Node's `setTimeout` into the app project and broke three unrelated tests). The plugin throws rather than falling back to the unfiltered walk when git fails, reports zero files, or cannot learn the Vite root. Residual, stated: a file tracked but DELETED in the working tree is subtracted deliberately, since an unstaged deletion is a normal developer state and a guard red on one gets ignored (#806); it is distinguished from the hole cases above by an on-disk existence check, not conflated with them |
|
||||
| `web/src/api/pageSizeCallSites.guard.test.ts` | `import.meta.glob` over `web/src/**/*.{ts,tsx,mts,cts}`, INTERSECTED with the git index | **yes** — an unregistered discovered site fails | converted under #819. The population is the glob INTERSECTED with the git index, and the walk/index divergence is asserted in BOTH directions WITHIN a shared scope: a key the index does not carry is dropped, and a tracked, on-disk, in-scope path that never reached the scanner FAILS rather than shrinking the population silently (that direction catches a dotfile, which the glob cannot match, and a disk/index spelling divergence, which `core.ignorecase` and NFD/NFC normalisation make permanent). The SCOPE itself cancels out of that equality — both sides call one `isInScopeSourcePath` — so narrowing it moves both sets together and no assertion comparing the two sides can see it. That is closed separately, by re-deriving the predicate from its two components over the whole tracked index (`the shared scope predicate is EXACTLY its two documented components`). Two mechanisms carry that. FIRST, the scope predicate is proved by a CLOSED-FORM restatement — it may share no helper, at any depth, with the predicate it checks, since anything shared sits on both sides of the comparison and cancels. FOUR earlier attempts were each measured going green while removing real files: a table of example paths (four of `src/`'s eight directories, missed a 23-file narrowing), a decomposition delegating its filename half to `isScannableSourceFileName` (11 files), one still sharing a `basename` helper (15 files, and blind to a planted call site), and one still sharing the tracked-file array every comparison was derived from (8 files, also blind). SECOND — because that last one showed a restatement cannot police the population it reads — the plugin runs a separate `git ls-files --others` query and the guard requires every in-scope walked path to appear in `tracked ∪ others`; narrowing `tracked` cannot suppress that, since it adds nothing to `others`. FIVE residuals, NOT a claim of closure, each with its direction MEASURED by planting a real `pageSize` call site rather than reasoned about. FAIL-NOISY (they redden a checkout; they cannot hide a call site): (2) a scope term matching no tracked path today survives until the day it first matches one; (4) the WIRING in `listSourceFiles`, indistinguishable on a clean checkout where the walk set and the index set are the same set, so no assertion COMPARING THE TWO POPULATIONS can tell which is passed; (5) `ABSENT_FROM_DISK` emptied. BLIND — each hid a planted `pageSize: 100` with the whole suite green: (1) a COORDINATED edit of the scope predicate and BOTH closed-form restatements, which is three sites and not two, since a second restatement guards `expectedTrackedSources` (measured: the two-site edit reddens, the three-site edit does not) — tolerated because a three-site policy edit is review-visible in a way a one-line slip is not; and (3) a misdescription by the plugin's THREE outputs — not only a mispartition of `tracked`/`others`, which preserves the union any consumer compares, but a FATTENED `absentFromDisk`, which subtracts real files from the hole-detection direction. The fattening is now caught wherever it overlaps a file the walk found (a walked path is on disk by construction, so it can never be legitimately absent); restricted to paths the walk cannot see anyway — a dotfile, a case-divergent name — it stays invisible from the consuming side and is answerable only by testing the derivation directly, and the real-git tests that do so catch an UNCONDITIONAL misdescription, not one keyed on a path pattern. Neither blind residual is tolerated for being harmless. The index is read by `web/vite-plugins/trackedSourceFiles.ts` in Vite's own Node context and handed to the app project as the virtual module `virtual:etv-tracked-source-files`. That is what reaches the index without admitting `@types/node` to `tsconfig.app.json` — the obstacle that deferred this, since wiring those types in was tried and reverted (it leaked Node's `setTimeout` into the app project and broke three unrelated tests). The plugin throws rather than falling back to the unfiltered walk when git fails, reports zero files, or cannot learn the Vite root. Residual, stated: a file tracked but DELETED in the working tree is subtracted deliberately, since an unstaged deletion is a normal developer state and a guard red on one gets ignored (#806); it is distinguished from the hole cases above by an on-disk existence check, not conflated with them |
|
||||
| `test_ci_release_path_scan_job.py` | `.gitea/workflows/*.y*ml` + `scripts/**` | **no** — a fixture assembling a tmp harness, asserted about behaviour not membership | takes its file LIST from the index anyway, for hermeticity not completeness: `shutil.copytree` copied whatever was on disk, including untracked files and `scripts/__pycache__`, into a tree whose behaviour the probes then measure. Content still comes from the working tree. The copy is not a git repo, so the two files this step RUNS may not use the helper — see the fixture docstring |
|
||||
| `test_ci_dropped_step_guard.py` | the parsed workflow document (its OWN subject only — the release-path `scan` job runs it in a non-git copy, so it may not derive from the index) | **no filesystem population at all** | unchanged by #806; the SCOPE residual it left open — `MARKED_JOBS` as a hand-written mirror of the required contexts on `main` — was closed by #787, which derives it from `.gitea/required-status-contexts.json` and reconciles that snapshot against the server in `scripts/check-required-contexts.sh`. The cross-workflow half of that claim lives in `test_ci_status_context_uniqueness.py`, which CAN use the index |
|
||||
|
||||
|
||||
@@ -376,8 +376,14 @@ const TRACKED_SOURCE_PATHS: ReadonlySet<string> = new Set(trackedSources.tracked
|
||||
*
|
||||
* Residual, stated: emptying this set is NOT caught by any test here, because on a clean checkout it
|
||||
* is already empty and nothing observes the difference. That is tolerable only because of which way
|
||||
* it fails — an empty set makes the guard RED on an unstaged deletion, never blind. Every mutation
|
||||
* that could make it blind runs through `expectedTrackedSources`, which the fixture test pins.
|
||||
* it fails — an EMPTY set makes the guard RED on an unstaged deletion, never blind.
|
||||
*
|
||||
* FATTENING it is the dangerous direction, and it is not this constant's to police: the fixture
|
||||
* test INJECTS `absentFromDisk`, so it structurally cannot see what the plugin actually derives.
|
||||
* MEASURED — widening the derivation by `|| path.startsWith('src/components/')` hid a planted
|
||||
* `pageSize: 100` in a tracked dotfile there. That is caught now, where it overlaps a walked file,
|
||||
* by the assertion in `every in-scope path the WALK sees is accounted for by git`; restricted to
|
||||
* glob-invisible paths it remains part of residual (3).
|
||||
*/
|
||||
const ABSENT_FROM_DISK: ReadonlySet<string> = new Set(trackedSources.absentFromDisk);
|
||||
|
||||
@@ -554,8 +560,8 @@ export function listSourceFilesFrom(
|
||||
* the original #819 complaint — but it cannot hide a `pageSize` call site from the registry.
|
||||
*
|
||||
* That is NOT true of every residual: the blind directions the cross-check pins all run through the
|
||||
* population SOURCE, and a mispartition that PRESERVES the union is not among them — see residual
|
||||
* (3) at the restatement below.
|
||||
* population SOURCE, and a mispartition that PRESERVES the union is not among them — see residuals
|
||||
* (1) and (3) at the restatement below, which are the blind ones.
|
||||
*/
|
||||
function listSourceFiles(): ScannableSource[] {
|
||||
return listSourceFilesFrom(rawSourceModules, TRACKED_SOURCE_PATHS);
|
||||
@@ -818,7 +824,9 @@ describe('pageSize call-site guard (#650)', () => {
|
||||
// (2) a term matching zero tracked paths today survives until the day it first matches one,
|
||||
// at which point it reddens — so a term becomes visible the moment it AFFECTS a tracked
|
||||
// path, not when it is written.
|
||||
// (3) the plugin's two lists are trusted to PARTITION faithfully.
|
||||
// (3) the plugin's THREE outputs are trusted to describe the repository faithfully — not
|
||||
// just `tracked`/`others` partitioning the on-disk set, but `absentFromDisk` reporting
|
||||
// only files that are really gone.
|
||||
// (4) the WIRING — see `listSourceFiles`, where the index set and the walk set are
|
||||
// indistinguishable on a clean checkout, so no assertion COMPARING THE TWO POPULATIONS
|
||||
// can tell which one is passed.
|
||||
@@ -935,9 +943,9 @@ describe('pageSize call-site guard (#650)', () => {
|
||||
// `others`. An untracked scratch file stays green — it lands in `others` — which is the #819
|
||||
// property itself.
|
||||
// The `isInScopeSourcePath` filter here is a narrowing CONVENIENCE, not a load-bearing term:
|
||||
// dropping it only widens `walked`, and every extra path is tracked and therefore accounted
|
||||
// for, so it cannot hide anything. Measured green when removed; recorded so a later round does
|
||||
// not re-litigate it as an unpinned clause.
|
||||
// dropping it only widens `walked`, and every extra path is still accounted for by git —
|
||||
// tracked, or reported untracked — so it cannot hide anything. Measured green when removed;
|
||||
// recorded so a later round does not re-litigate it as an unpinned clause.
|
||||
const walked = Object.keys(rawSourceModules).map(globKeyToRootRelativePath).filter(isInScopeSourcePath);
|
||||
|
||||
expect(
|
||||
@@ -949,7 +957,26 @@ describe('pageSize call-site guard (#650)', () => {
|
||||
`git reports as a directory rather than as files; (3) the index list was narrowed between ` +
|
||||
`git and this guard — check web/vite-plugins/trackedSourceFiles.ts.`
|
||||
).toEqual([]);
|
||||
// Anti-vacuity: an empty walk would satisfy the filter above trivially.
|
||||
// A path the WALK found is on disk by construction — the glob only yields files that exist —
|
||||
// so it can never legitimately be reported absent. Without this, FATTENING the plugin's third
|
||||
// output silently disarms the hole-detection direction: MEASURED, `absentFromDisk` widened by
|
||||
// `|| path.startsWith('src/components/')` subtracted those files from `expected`, so a tracked
|
||||
// `src/components/.probe819.ts` holding `pageSize: 100` — invisible to the glob, which is the
|
||||
// whole case the shortfall test exists for — went from red to 43/43 green. That is residual
|
||||
// (3) reaching a THIRD output, not the tracked/others pair.
|
||||
//
|
||||
// What this closes and what it does not, measured both ways: it catches any fattening that
|
||||
// overlaps a walked file. A fattening restricted to paths the walk cannot see anyway (a
|
||||
// dotfile, a case-divergent name) is still not caught here, because those never enter `walked`
|
||||
// — that narrower case stays inside residual (3).
|
||||
expect(
|
||||
walked.filter((path) => ABSENT_FROM_DISK.has(path)),
|
||||
'Path(s) the walk FOUND that the plugin also reports as absent from disk. Both cannot be ' +
|
||||
'true, so the absent-set derivation in web/vite-plugins/trackedSourceFiles.ts is reporting ' +
|
||||
'files that exist — which subtracts them from the shortfall check and disarms it.'
|
||||
).toEqual([]);
|
||||
|
||||
// Anti-vacuity: an empty walk would satisfy the filters above trivially.
|
||||
expect(walked.length).toBeGreaterThan(50);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user