Consolidate binary-mode env-strip lists into a shared data file - #14925
Merged
Merged
Conversation
Collaborator
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
Member
Author
|
@copilot resolve the merge conflicts in this pull request |
Contributor
Resolved the merge conflicts, merged |
cderv
force-pushed
the
task/consolidate-env-strip-vars
branch
from
September 23, 2026 12:53
55aeaf7 to
3867150
Compare
tests/quarto-cmd.ts's kStripEnvVars, run-tests.ps1's $probeStrip, and run-tests.sh's inline env -u chain hand-maintained three copies of the same list, and had already drifted (the shell probes were missing 7 names, including QUARTO_VERSION_REQUIREMENT) at the moment they were introduced in #14706. All three now read tests/binary-mode-strip-env.txt at runtime, with identical parse semantics (trim including CR, skip blanks/#comments, validate ^[A-Za-z_][A-Za-z0-9_]*$, fail closed on missing/empty/malformed). buildBinaryEnv() is split into a pure sanitizeBinaryEnv(ambient, overlay) so the strip/overlay contract is unit-testable without touching Deno.env directly (test-anti-patterns.md forbids Deno.env.set()). The originally planned CI regression guard (setting QUARTO_VERSION_REQUIREMENT on the binary-mode workflow steps) was dropped: verified empirically that both launcher scripts (run-tests.sh's `quarto`, run-tests.ps1's `quarto.cmd`) special-case --version to print a static version and exit without ever invoking Deno, so no environment variable can affect that probe's outcome. The guard would have been dead code.
cderv
force-pushed
the
task/consolidate-env-strip-vars
branch
from
September 23, 2026 13:18
3867150 to
b4c5704
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
tests/quarto-cmd.ts'skStripEnvVars,run-tests.ps1's$probeStrip, andrun-tests.sh's inlineenv -uchain hand-maintained three copies of the same environment-variable list, introduced together in #14706. They had already drifted at that point: the shell/PowerShell probes were missing 7 names present in the TypeScript list, includingQUARTO_VERSION_REQUIREMENT.Fix
All three now read a single tracked file,
tests/binary-mode-strip-env.txt, at runtime, with identical parse semantics: trim (including a trailing CR), skip blank lines and#comments, validate each name against^[A-Za-z_][A-Za-z0-9_]*$, and fail closed on a missing, unreadable, empty, or malformed file.buildBinaryEnv()is split into a puresanitizeBinaryEnv(ambient, overlay)so the strip/overlay contract (overlay applied after removal, may reintroduce a stripped name) is unit-testable without mutatingDeno.envdirectly.Verification
A CI guard that set
QUARTO_VERSION_REQUIREMENTon the binary-mode workflow steps was considered and dropped. Both launcher scripts special-case--versionto print a static version and exit without invoking Deno at all, so no environment variable can affect that probe's outcome regardless of whether the strip list is correct — the guard would have been dead code.Test plan
tests/unit/binary-mode-strip-env.test.ts) cover the parsed list shape and thesanitizeBinaryEnv()strip/overlay/non-mutation contractFOO=barrun-tests.shandrun-tests.ps1against an installed quarto outside the checkout, confirming the parsed 16-name list strips correctly end to endChecklist
I have (if applicable):