fix: stop test fixtures from deleting the repository's dependencies
Four fixtures linked the installed dependencies into a throwaway root with a single directory symlink at <fixture>/node_modules, then ran pnpm inside that root. pnpm does not recognise the modules directory it finds there and purges it; with CI=true it does so without a prompt. The purge followed the symlink and deleted the repository's own node_modules mid-run, so a test suite uninstalled the workspace it was running in. That is what produced the cascading, file-unrelated failures a full test:unit run reported, and it happened twice while running the suites for the adapter re-review. scripts/lib/fixture-node-modules.ts replaces all four sites: node_modules is a real directory whose entries are individual symlinks, so a recursive delete unlinks the fixture's own links instead of walking through one link into the shared tree. Resolution is unchanged. tests/unit/fixture-node-modules.test.ts performs the exact recursive delete pnpm performs and asserts the source tree survives, and check:adapter-inventory now fails on any reintroduction of the directory-symlink form — verified by putting the old line back and watching the gate reject it. A full tests/unit + tests/integration run now leaves the dependencies intact. removal-fixture, supply-chain and security-followup-archive, the three suites that had to be excluded before, pass in that run. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
af7f35058b
commit
250531aa43
@@ -314,8 +314,50 @@ Run on the landed tree. Only what actually passed is claimed as passing.
|
||||
| --- | --- | --- |
|
||||
| `tests/unit/ci-workflow-generation.test.ts` | 82 failed / 325 passed | Identical on the pre-change baseline (`git stash` comparison). The subprocess gates it spawns cannot run in this sandbox. |
|
||||
| `tests/unit/ci-artifact-contract.test.ts` | fails | Unchanged pre-existing sandbox, cgroup and `/tmp` permission behaviour. |
|
||||
| `tests/unit/removal-fixture.test.ts`, `tests/unit/supply-chain.test.ts`, `tests/integration/security-followup-archive.test.ts` | destructive | `scripts/lib/removal-fixture.ts:45` and `scripts/check-supply-chain-provider-fixtures.ts:62` symlink the real `node_modules` into a temp fixture root and then run `corepack pnpm` there with `CI=true`. pnpm purges the modules directory it does not recognise, **through the symlink**, deleting the repository's own dependencies mid-run. This is a pre-existing repository hazard, outside the 38 findings, and it is why a full `test:unit` run reports cascading failures. |
|
||||
| `tests/unit/security-followup.test.ts` | flaky under load | Passes in a fresh process; the process-group reaping assertion is timing sensitive. |
|
||||
| `tests/unit/security-followup.test.ts`, `tests/unit/provider-guardian-transaction.test.ts` | flaky under full-suite load | Both pass in a fresh process (49 passed). They spawn and reap process groups, so their timing assertions are load sensitive. |
|
||||
|
||||
### Destructive fixture hazard — fixed
|
||||
|
||||
Outside the 38 findings, and found while running the suites for them.
|
||||
|
||||
Four sites linked the repository's installed dependencies into a throwaway
|
||||
fixture with a single directory symlink at `<fixture>/node_modules`:
|
||||
|
||||
- `scripts/lib/removal-fixture.ts`
|
||||
- `scripts/check-supply-chain-provider-fixtures.ts`
|
||||
- `tests/integration/security-followup-archive.test.ts`
|
||||
- `tests/unit/ci-artifact-contract.test.ts`
|
||||
|
||||
Each fixture then runs `pnpm` inside itself. pnpm does not recognise the modules
|
||||
directory it finds there and purges it; with `CI=true` it does so without a
|
||||
prompt. The purge followed the symlink and deleted the **repository's own**
|
||||
`node_modules` mid-run — a test suite uninstalling the workspace it was running
|
||||
in. That is what produced the cascading, file-unrelated failures a full
|
||||
`test:unit` run reported, and it happened twice during this work.
|
||||
|
||||
`scripts/lib/fixture-node-modules.ts` replaces all four: `node_modules` is a
|
||||
real directory whose entries are individual symlinks, so a recursive delete
|
||||
unlinks the fixture's own links instead of walking through one link into the
|
||||
shared tree. `tests/unit/fixture-node-modules.test.ts` performs the exact
|
||||
recursive delete pnpm performs and asserts the source tree survives, and
|
||||
`corepack pnpm check:adapter-inventory` fails on any reintroduction of the
|
||||
directory-symlink form.
|
||||
|
||||
After the fix a full `tests/unit` + `tests/integration` run leaves the
|
||||
dependencies intact and its failures are confined to the two environmental
|
||||
files above plus the two flaky-under-load ones:
|
||||
|
||||
| File | Failed | Attribution |
|
||||
| --- | ---: | --- |
|
||||
| `tests/unit/ci-workflow-generation.test.ts` | 82 | Identical on the pre-change baseline (`git stash` comparison). Its subprocess gates cannot run in this sandbox. |
|
||||
| `tests/unit/ci-artifact-contract.test.ts` | 19 | Unchanged pre-existing sandbox, cgroup and `/tmp` permission behaviour. |
|
||||
| `tests/unit/security-followup.test.ts` | 2 | Passes in isolation. |
|
||||
| `tests/unit/provider-guardian-transaction.test.ts` | 1 | Passes in isolation. |
|
||||
|
||||
1619 passed / 1723 total, and `tests/unit/removal-fixture.test.ts`,
|
||||
`tests/unit/supply-chain.test.ts` and
|
||||
`tests/integration/security-followup-archive.test.ts` — the three that had to be
|
||||
excluded before — now pass in the full run.
|
||||
|
||||
## Rules for updating this ledger
|
||||
|
||||
|
||||
Reference in New Issue
Block a user