env_config: scrub the managed PYAUTO_ family from the base env (step 3) - #165
Merged
Conversation
…step 3) Strip PYAUTO_* from the ambient environment before applying the profile, so a PYAUTO_ var value for a script run is a function of (profile, script), not of what leaked from a shell rc or an unrelated CI step. Only PYAUTO_* is scrubbed — infra/reproducibility vars (PATH, PYTHONPATH, JAX_ENABLE_X64, NUMBA/MPL) pass through. Paired with the smoke profiles gaining SKIP_WORKSPACE_VERSION_CHECK so the mega-run ambient injection is not lost to the scrub. Proven byte-identical on the mega-run CI env; ambient PYAUTO_SKIP_API_GATE leak 65 to 0. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Jul 22, 2026
Open
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.
Summary
Migration step 3 of the env-profile redesign (PyAutoBuild#161; campaign #155 Phase 3): scrubbed base env.
build_env_for_scriptstrips the managedPYAUTO_*family from the ambient environment before layering the profile, so a PYAUTO_ var's value for a script run is a function of (profile, script) — an ambientPYAUTO_DISABLE_JAX/PYAUTO_SKIP_*the profile is silent on can no longer leak in.Only PYAUTO_* is scrubbed — not infrastructure/reproducibility vars (PATH, PYTHONPATH, JAX_ENABLE_X64, NUMBA_CACHE_DIR, MPLCONFIGDIR). Those are set identically by the profiles and the CI step env, so ambient-vs-profile never causes a reproducibility bug for them; a deny-by-default allowlist over them (the doc's original §5 shape) would risk breaking the least-exercised release path on a single missed key. This is the corrected §5 design (see the #161 thread — the allowlist and the "reproduce against the real CI env" near-miss).
Paired change (must merge together, same branch name so the smoke gate cross-checks): the three
*_workspace_testsmoke profiles gainPYAUTO_SKIP_WORKSPACE_VERSION_CHECK: "1". The mega-run (workspace-validation.yml) injects that var ambiently and the smoke profile was silent on it; without the profile now owning it, the scrub would strip the injection and every mega-run smoke script would failWorkspaceVersionMismatchError. (That is the near-miss a synthetic-clean-env proof missed last attempt.)Proof (measured against BOTH real CI env models, not a synthetic clean env)
SKIP_WORKSPACE_VERSION_CHECK): 65/65 scripts byte-identical PYAUTO_ resolution old-vs-new — the release-validation path does not change at all.SKIP_WORKSPACE_VERSION_CHECK(harmless — the check passes anyway with source installs).PYAUTO_SKIP_API_GATEleaked into 65/65 scripts under old code, 0 under new.API Changes
None — resolver internals. New module constant
MANAGED_ENV_PREFIXES.Test Plan
Generated by the PyAutoLabs agent workflow.