Orchestrata Ultimate › Plans › briefs › qwen › Q1-report
Q1 report — One C/C++ toolchain declaration: finish, test and verify
Source: plans/briefs/qwen/Q1-report.md at 8a2cb42ad · last changed 2026-10-11 · first committed 2026-10-11 · 245 lines.
Prose pending.
Plan text
Q1 report — One C/C++ toolchain declaration: finish, test and verify
Executor: Qwen3.8-max (openrouter/qwen/qwen3.8-max-0902) via opencode run.
Worktree: /home/mohamed/workspace/wt-BARE-PYTHON, branch fix/bare-interpreter-gate
(HEAD c1eebd019). Deliverable state: complete, tested, STAGED, not committed.
No STOP condition occurred.
Done-when checklist (§7)
- [x] §6.1 passes, 0 skipped —
83 passed, 1 warning in 69.78s(first pass, before the two out-of-scope fixes; every module re-verified inside the final §6.6 run). - [x] §6.2 outputs exactly as the spec expects (both pasted below).
- [x] ruff/black clean on every changed Python file;
bash -nclean ondeploy/toolchain.sh,deploy/install-orchestrata.sh,deploy/install-tools.sh. - [x] Only the allowed files staged (§4 + the two orchestrator-accepted out-of-scope
edits); generated files left unstaged.
gate.py review-staged→commit review: PASS,6 review(s), no blocking findings,review rc=0. - [x] §6.6 resolver:
"escalate": false,"untested": []. Bounded run through.run_exclusive.sh --force --json: rc 0; totals quoted from.q1/run-q1.json:"test_totals": {"passed": 1678, "failed": 0, "errors": 0, "skipped": 0},"passed": 89, "failed": 0, "total": 89,"reused": {"modules": 0, "tests": 0}(--force: every selected test executed),time_seconds: 170.7,head_commit: c1eebd0196a76938ea2acd863d3a940309ce581b,dirty_sig: dad0683fb091a8a6844f053fc364876b95e2d69f.
Files changed (staged) and why
Pre-written by the orchestrator, verified against §3, staged unchanged unless noted:
| File | State | Why |
|---|---|---|
env/toolchain.env |
NEW | The ONE declaration: CC=/usr/bin/gcc, CXX=/usr/bin/g++ + rationale header. |
deploy/toolchain.sh |
NEW | load_toolchain <file>: refuses missing file / missing key / bare name / non-executable (one FAIL: line, return 1); exports CC/CXX, unsets C_INCLUDE_PATH/CPLUS_INCLUDE_PATH, prints toolchain: CC=... CXX=... (from ...). |
deploy/install-orchestrata.sh |
MOD | Old bare-gcc default + PATH-shadow probe + toolchain override: line replaced by source "$INSTALLER_ROOT/deploy/toolchain.sh" + `load_toolchain "${ORCHESTRATA_TOOLCHAIN_ENV:-$INSTALLER_ROOT/env/toolchain.env}" |
deploy/install-tools.sh |
MOD | Same loader from $REPO; the native build passes CC="$CC" CXX="$CXX" through $SUDO env. |
.envrc |
MOD | export CC=gcc / export CXX=g++ removed; dotenv "env/toolchain.env" is the LAST line. |
scripts/worktree_toolchain.py |
MOD + my fix | declared_toolchain() (raises ToolchainDeclarationError) + pin_system_toolchain() applying the declaration unconditionally and dropping the Guix include vars. My fix: ruff --fix removed the leftover unused import shutil (F401 — the old shutil.which PATH probe is gone; an import, not a helper). |
scripts/worktrees.py |
MOD | _provision_env wraps the pin in try/except ToolchainDeclarationError → ERROR: + return 1. |
scripts/hooks/pre-push |
MOD | Banner text only (describes committed c1eebd019); not edited, staged with the rest per §3. |
tests/deploy/test_toolchain_sh.py |
NEW (pre-written) | 7 tests over the real sourced helper; never run before this task — passed as written, zero fixes needed. |
tests/scripts/test_worktrees_provision.py |
MOD (pre-written) + my fixes | See "tests I had to fix" below. |
Written/fixed by me per §4:
| File | Change |
|---|---|
tests/deploy/test_install_orchestrata_cc.py |
§5.1: replaced test_sync_stage_exports_cc_and_cxx_with_gcc_default with test_sync_stage_uses_the_declared_compilers (asserts record file exists, recorded CC=/usr/bin/gcc/CXX=/usr/bin/g++, stdout toolchain: CC=/usr/bin/gcc CXX=/usr/bin/g++ (from <this worktree>/env/toolchain.env)); replaced test_sync_stage_fails_closed_without_a_compiler_on_path with test_sync_stage_refuses_an_unusable_declaration parametrized over missing / bare-name / not-executable declarations via ORCHESTRATA_TOOLCHAIN_ENV, each asserting returncode != 0 and not record_file.exists(). Every helper kept. Module docstring and _path_with_only_system_gcc's docstring updated (they described the removed default+probe design). |
tests/deploy/test_install_orchestrata_toolchain.py |
§5.2: replaced test_sync_stage_pins_system_gcc_when_shadowed with test_a_shadowing_gcc_on_path_does_not_change_the_compiler (shadow gcc first on PATH + C_INCLUDE_PATH=/tmp/leak; recorded CC/CXX absolute, C_INCLUDE_PATH=<unset>, toolchain: CC=/usr/bin/gcc in stdout, toolchain override: nowhere); replaced test_sync_stage_no_override_when_gcc_already_system with test_an_inherited_bare_cc_is_overridden_by_the_declaration (CC=gcc CXX=g++ inherited → recorded /usr/bin/gcc,/usr/bin/g++); reused the module's existing import of _path_with_only_system_gcc. test_sync_stage_fails_closed_when_a_locked_path_package_does_not_import left unchanged. Every helper kept; _fakebin_with_shadow_gcc's docstring reworded (it described the removed command -v probe). Module docstring updated. |
tests/deploy/test_envrc_toolchain.py |
NEW per §5.3: test_envrc_exports_no_compiler (no `^\s*export\s+(CC |
scripts/build_janus_ft.py |
§4 words only: _pin_system_toolchain docstring and the _build_env comment now state the compiler comes from the env/toolchain.env declaration via worktree_toolchain.pin_system_toolchain, unconditionally, and a missing/bare/non-executable declaration raises ToolchainDeclarationError (build refused). No logic change. |
scripts/build_ft_tree_sitter.py |
§4 words only: same statement in its _pin_system_toolchain docstring and _build_env docstring. No logic change. |
Out-of-scope edits (not in §4's table; both ACCEPTED by the orchestrator mid-task):
| File | Why it was needed |
|---|---|
plans/affected-tests-manifest.json |
§6.6 requires "untested": [], but the first resolve returned "untested": ["deploy/toolchain.sh"]: the stem convention looks for tests/deploy/test_toolchain.py while the spec-mandated spelling is test_toolchain_sh.py (§3/§5.3), and both installers source the helper through a runtime-computed path (source "$INSTALLER_ROOT/deploy/toolchain.sh"), which the AST reference-edge extractor cannot see. Added a rule deploy/toolchain.sh → [test_toolchain_sh.py, test_install_orchestrata_cc.py, test_install_orchestrata_toolchain.py] with a why-field — the same sanctioned mechanism every neighbouring deploy-side shell script uses (deploy/deploy.sh, deploy/retire-plain-units.sh, deploy/install-gitlab-runner-executor.sh). Its own guard suite passes: tests/scripts/test_affected_manifest_rules.py 18 passed. After the rule: escalate: False, untested: []. |
tests/deploy/test_install_tools.py |
The §6.6 run failed 3 tests in this module (test_verify_arm...-class clone tests incl. test_installer_fails_hard_when_systemd_analyze_rejects_a_template) with clone/deploy/install-tools.sh: line 210: clone/deploy/toolchain.sh: No such file or directory. Root cause: the harness _clone_at_head builds a repo from git archive HEAD and overlays ONLY the working-tree install-tools.sh; the installer now sources deploy/toolchain.sh and reads env/toolchain.env, and the uncommitted clone carries neither (env/ is not an archived path at all, so this outlives the commit). The code is right per §3 (fail closed when the loader is absent); the harness was incomplete for the new sibling dependency. Fix: copy deploy/toolchain.sh and env/toolchain.env beside the installer in the clone. Every assertion untouched (not weakened). Module after fix: 9 passed. |
Left unstaged per §4/instructions: reports/run-tests-latest.json (runner-written,
appeared modified), .q1/ (run scratch), .run_exclusive.sh (orchestrator's wrapper),
plans/briefs/qwen/ (this report). The resolver also regenerated
plans/reference-edges.json.affected-scratch (gitignored scratch — absent from
git status). No other generated file (docs/CODEBASE_MAP*.md, plans/ast-*.json,
context.json) appeared modified at any point.
Tests I had to fix in the pre-written modules, and which side was wrong
tests/scripts/test_worktrees_provision.py::test_cmd_provision_pins_toolchain_when_guix_gcc_shadows_system— the pre-written rewrite was wrong twice: (a) it deleted the helper_guix_shim_binwhile this test still called it (guaranteedNameError— the module had never been run); (b) it left the test asserting the removed pre-§3 output (toolchain override:line from the PATH-shadow probe). Per §2 rule 5 I restored_guix_shim_binverbatim, and per §6.1's rule ("a test asserting something §3 does not say is wrong") I re-pointed the assertions at the §3 output:toolchain: CC=/usr/bin/gcc CXX=/usr/bin/g++ (from <repo>/env/toolchain.env)plusdropped C_INCLUDE_PATHandprovenance OK, with the Guix shim still first on PATH to prove PATH no longer decides. The shipped code was correct; only the test was fixed. Also updated the module docstring's stale "Guix-shadowed-gcc pin" phrase to the declaration wording.tests/deploy/test_toolchain_sh.py— written but never run: passed as written, no fixes.tests/deploy/test_install_tools.py— harness incomplete for the §3 design (the tests were right, the harness predated the installer's new sibling dependency); fixed as described above. No assertion changed.
§6 outputs
§6.1 (exact command, from the worktree root):
83 passed, 1 warning in 69.78s (0:01:09)
0 skipped; collection check confirmed all 10 new/rewritten deploy tests ran
(incl. test_sync_stage_refuses_an_unusable_declaration[missing|bare-name|not-executable]).
Post-fix re-verifications: tests/deploy/test_install_tools.py → 9 passed ... in 82.42s;
tests/infra/test_gen_env_profiles.py tests/scripts/test_check_env_fleet_agreement.py
→ 32 passed ... in 11.16s; toolchain/envrc/provision subset → 41 passed in 10.37s.
§6.2 (real behaviour, outside pytest):
$ bash -c 'source deploy/toolchain.sh && load_toolchain env/toolchain.env && echo "CC=$CC CXX=$CXX CIP=${C_INCLUDE_PATH-unset}"'
toolchain: CC=/usr/bin/gcc CXX=/usr/bin/g++ (from env/toolchain.env)
CC=/usr/bin/gcc CXX=/usr/bin/g++ CIP=unset
$ env C_INCLUDE_PATH=/tmp/leak CC=gcc .venv/bin/python -c '...pin_system_toolchain(dict(os.environ))...'
toolchain: CC=/usr/bin/gcc CXX=/usr/bin/g++ (from /home/mohamed/workspace/wt-BARE-PYTHON/env/toolchain.env), dropped C_INCLUDE_PATH
/usr/bin/gcc /usr/bin/g++ False
§6.3: ruff --fix on the changed files → Found 1 error (1 fixed, 0 remaining)
(the unused import shutil in scripts/worktree_toolchain.py); black → 9 files left unchanged (second pass on test_install_tools.py: ruff All checks passed!, black
1 file left unchanged); bash -n deploy/toolchain.sh deploy/install-orchestrata.sh deploy/install-tools.sh → clean.
§6.4 git status --porcelain after staging (final; .q1-affected.json already removed):
M .envrc
M deploy/install-orchestrata.sh
M deploy/install-tools.sh
A deploy/toolchain.sh
A env/toolchain.env
M plans/affected-tests-manifest.json
M reports/run-tests-latest.json
M scripts/build_ft_tree_sitter.py
M scripts/build_janus_ft.py
M scripts/hooks/pre-push
M scripts/worktree_toolchain.py
M scripts/worktrees.py
A tests/deploy/test_envrc_toolchain.py
M tests/deploy/test_install_orchestrata_cc.py
M tests/deploy/test_install_orchestrata_toolchain.py
M tests/deploy/test_install_tools.py
A tests/deploy/test_toolchain_sh.py
M tests/scripts/test_worktrees_provision.py
?? .q1/
?? .run_exclusive.sh
?? plans/briefs/qwen/
§6.5 (run twice — after the first staging and again after the two accepted out-of-scope edits; final):
commit review: PASS
6 review(s), no blocking findings
review rc=0
§6.6 resolver (final staged set): escalate: False, untested: [], 71 paths →
89 modules. Reasons included: env/toolchain.env: keys CC, CXX changed — resolved to 52 test(s) that name them (RUL-032: no escalation); .envrc: resolved via 1 reference edge(s) (tests/deploy/test_envrc_toolchain.py); deploy/toolchain.sh: resolved via manifest-declared coverage.
§6.6 run — first attempt (spec's direct run_tests.py invocation) ended rc 1 with
1672 passed, 6 failed, 0 errors, 0 skipped · 86/89 modules: 3 failures in
tests/deploy/test_install_tools.py (harness gap — fixed above, proven by
clone/deploy/install-tools.sh: line 210: .../toolchain.sh: No such file or directory),
2 in tests/infra/test_gen_env_profiles.py + 1 in
tests/scripts/test_check_env_fleet_agreement.py (tofu/PATH environment — see
finding below; not caused by this change: both modules pass untouched once tofu
is reachable). The authoritative rerun went through the host lock wrapper exactly as
instructed:
$ mkdir -p .q1
$ bash .run_exclusive.sh --force --json <the 71 resolved paths> > .q1/run-q1.json 2> .q1/run-q1.err; echo "run rc=$?"
run rc=0
Totals from .q1/run-q1.json: "test_totals": {"passed": 1678, "failed": 0, "errors": 0, "skipped": 0}; "passed": 89, "failed": 0, "total": 89;
"rerun": {"count": 0, ...}; "solo_retry": null; "reused": {"modules": 0, "tests": 0} (--force); time_seconds: 170.7. Stderr tail: [run_tests] ✅ All safety gates pass, [run_tests] 🧪 89 modules · 8 workers × 6 batches/worker · 420s timeout, [run_exclusive] 21:07:46 run_tests.py rc=0. All safety gates (source
provenance, parallel safety 0.1–0.6, test purity, prolog boundary, rulings lint)
passed; failed_modules: None.
Findings against the spec itself
- §5.1's "Assert: rc 0 for the bootstrap stage reached" is unachievable as an
installer-exit-code assertion. With the sanctioned recording-
uvharness the installer always exits non-zero after the sync stage: the recordinguvnever creates a real.venv, so the free-threaded check fails (FAIL: deployed venv is not free-threaded) — documented as expected in_write_recording_uv's own docstring, and the pre-existing tests never asserted rc there. Implemented per the parenthetical:record_file.exists()is the proof the bootstrap (sync) stage was reached anduv syncexited 0; the installer's rc is not asserted in that test. The refusal tests do assertreturncode != 0(the loader exits before sync). - The spec's §6.6 wait loop self-matches.
timeout 3600 bash -c 'while pgrep -f "scripts/run_tests.py" ...'— thebash -cwrapper's own command line contains the pattern,pgrep -fmatches it (pgrep excludes only itself, not its ancestors), so the loop never exits and returns rc 124 → a false STOP on every invocation. I used the bracket formpgrep -f "scripts/run_tests[.]py"(same semantics, no self-match) until the orchestrator replaced waiting with.run_exclusive.sh. The pgrep approach also cannot guarantee non-overlap (a run can start between the last probe and the exec), which the lock wrapper fixes properly. - §6.6's assumption of an out-of-the-box
"untested": []was wrong fordeploy/toolchain.sh(stem spelling + runtime-computedsource— see the manifest entry above). The spec names the test filetest_toolchain_sh.pyin two places, so the manifest rule is the only fix consistent with §3. - PATH/tofu finding (environment, not this change). The first bounded run's 3
infra failures trace to
infra/gen_env.py::tofu_binary():$TOFUunset,tofuabsent from the opencode session's PATH (it lives at/home/mohamed/bin/tofu, declared in pyproject external-tools: "installed standalone into ~/bin on this host"), so it fell back toterraform1.5.7, which cannot init therequired_version >= 1.6.0root (Error: Unsupported Terraform Core version). Proof it is environmental: both modules pass untouched with~/binon PATH (32 passed in 11.16s). The orchestrator then put/home/mohamed/binon the session PATH permanently. - Minor:
scripts/worktree_toolchain.py's module docstring still opens with the 2026-09-23 shadow-pinning narrative ("PinningCC/CXXto the system compiler"); the function docstrings (pre-written) carry the accurate declaration wording. Left untouched (§3: verify, do not redesign; §4 lists other files for word fixes). Removal/reword candidate for Mohamed.
Helpers that became unused (removal candidates — kept per §2 rule 5, only Mohamed authorises removals)
_path_without_gcc(fakebin)intests/deploy/test_install_orchestrata_cc.py— its only consumer wastest_sync_stage_fails_closed_without_a_compiler_on_path, replaced per §5.1 (a PATH without gcc is no longer a meaningful refusal case: the declaration, not PATH, decides)._guix_shim_bin(tmp_path)intests/scripts/test_worktrees_provision.py— deleted by the pre-written diff while still referenced; I restored it and it is used again bytest_cmd_provision_pins_toolchain_when_guix_gcc_shadows_system, so it is NOT unused now; listed here only to document the delete/restore round trip.
Rule compliance notes
- No bare
python/pytest/pip; every command ran viaenv -u PYTHONPATH .venv/bin/python ...from the worktree root. No new dependencies;pyproject.toml/uv.lockuntouched. No mocks/stubs/fakes/monkeypatch/skips added; function-scope fixtures andtmp_paththroughout; the recording-uvsubprocess seam kept as is (§2 rule 3). Absolute imports only; the banned hedge word (§2 rule 4) appears in no added code, comment or docstring — the only hits in the staged diff are DELETED lines of the old tests. Nothing deleted: every pre-existing helper survives. No commit, push, merge, rebase, reset, stash or branch switch; nothing outside the worktree touched;10.53.1.xnever contacted; the full suite was never run — bothrun_tests.pyinvocations used the explicit resolved paths only.