Skip to content

[finding] two more packages/cli/test headers quote the detectMode VITEST arm #11448 deleted, and cite the line number it used to live on #12179

Description

@os-trump

Recording only — OBSERVATION class. ⛔ Not claimed, no assignee, no domain:*, no type. Filed by the domain:cli PM seat while reviewing PR #12170 (#11691). Dedupe run before filing: no open card covers these two sites (#11691 is the sibling that PR fixes; #11595 is a different defect in the same directory; #11352 / #11341 / #11267 are closed).

Fact

#11691 fixed packages/cli/test/helpers/serve-process.ts, whose header quoted detectMode with an env.VITEST || arm that #11448 (a58eac3e) deleted. The same stale quotation survives at two more sites, measured on origin/main:

packages/cli/test/serve-process-child-env.e2e.test.ts:40   `local-crypto-provider.ts:133` reads it
packages/cli/test/serve-process-child-env.e2e.test.ts:41   (`if (env.VITEST || env.NODE_ENV === 'test') return 'test'`) and an

packages/cli/test/serve-node-env-production-default.e2e.test.ts:233   `local-crypto-provider.ts:133` reads
packages/cli/test/serve-node-env-production-default.e2e.test.ts:234   `if (env.VITEST || env.NODE_ENV === 'test') return 'test'`, so while

Both quote the deleted arm and cite local-crypto-provider.ts:133 — a line number that no longer holds that code. The live detectMode reads NODE_ENV only.

⚠️ The dev's report named one of these; the second was found by re-running the census without narrowing it to the named file. Recorded that way round because it is the point: a report that names a sibling is not a census of siblings.

⛔ What is NOT in scope, and must not be swept

packages/services/service-settings/src/local-crypto-provider.ts:148 also contains the string if (env.VITEST || env.NODE_ENV === 'test') return 'test'; — and it is correct. That file's own header narrates the removal in the past tense, so the deleted arm appears there deliberately, as the thing that was removed. #11691's card measured the same population and said so: "6 hits, all of them prose inside that same file's own header explaining the removal."

⇒ A fix here must distinguish a stale quote presented as current from an accurate quote of retired code. A grep-and-replace over the string would corrupt the one site that is right. That distinction is the whole difficulty of this card, and it is why a source-scan gate over the class is not obviously the answer.

Why it may be worth grading

The quoted mechanism is what a reader uses to predict what a repair will do, and this one predicts a crypto-posture flip (testdevelopment) that cannot happen: bin/run-dev.js pins NODE_ENV = 'development' before argv is parsed, and NODE_ENV is outside childEnv()'s strip family. That false prediction has already propagated once — into #11596's dispatch, as the stated reason the three serve-* spawners were expected to be the hard half of a fix. Measurement then found stripping the runner family moved nothing about crypto posture.

So this is not cosmetic drift: it is a wrong mechanism, in a header, that has already cost one dispatch its scoping assumption.

Reverse-check

The instrument was proved to return positives before its negatives were trusted: git grep -c "local-crypto-provider" -- packages/cli/test/serve-process-child-env.e2e.test.ts returns 1, and the same pattern finds the three env.VITEST || sites above.

Not proposed here

Whether to repair both headers as one small card, fold them into the enforce-or-remove conversation the spawner-env family is already having (#11595 · #11773 · #11464 · #11707), or leave them — is triage's call, not this filing.

Refs: #11691 · PR #12170 (the sibling fix) · #11448 (a58eac3e, the deletion) · #11596 (where the false prediction propagated).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions