Skip to content

fix(tests): isolate loader test from the machine's global links - #279

Merged
lukemaj merged 1 commit into
mainfrom
fix/277-muse-loader-limit-test
Nov 23, 2026
Merged

lukemaj merged 1 commit into
mainfrom
fix/277-muse-loader-limit-test

Conversation

@lukemaj

@lukemaj lukemaj commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What changed: The Project Direction loader test now isolates the Claude, OpenCode and Muse global-link locations, as it already did for Codex and Grok, so the muse subtest passes on every machine.
Why: The test read the machine's real ~/.config/muse/AGENTS.md link and real PREFERENCES.md; on a maintainer machine that pushed muse's encoded stdout to 16,595 bytes, over Muse's 16,384-byte limit, so the hook correctly reported that limit instead of the 10,000-byte one the test expects.
So what: Rebased on main after #278 merged and re-bumped to 17.6.2; independent review runs on this head; the user decides the merge.

Closes #277

Diagnosis

Neither side was stale. Both limits are real and current since #228 (47e6ac5): MAX_CONTEXT_BYTES = 10000 for every host, plus a 16,384-byte stdout ceiling for Muse (bin/project-direction hook_output, documented in docs/musecode.md). When both are exceeded the hook names the stdout limit, which is correct.

The defect was test isolation. invoke() set CODEX_HOME and GROK_HOME to fixture paths but left CLAUDE_CONFIG_DIR, OPENCODE_CONFIG_DIR and XDG_CONFIG_HOME resolving to the real machine. Probe on origin/main with the same fixture:

host context bytes stdout bytes instructions target
codex 12,928 - fixture (missing)
claude 16,207 - real ~/.claude/CLAUDE.md + real preferences
muse 16,212 16,595 > 16,384 real ~/.config/muse/AGENTS.md + real preferences

On a machine without those links (CI) the muse output stays under 16,384 and the test passes, which is why it is red only locally.

Changes

  • tests/test_project_direction_loader.py invoke(): set CLAUDE_CONFIG_DIR, OPENCODE_CONFIG_DIR, XDG_CONFIG_HOME to fixture paths. No hook or limit changes. Muse's stdout-limit branch stays covered by tests/test_muse.py.
  • Version 17.6.1 -> 17.6.2 (patch) via versionctl prepare, on main 8e1eb30 (after fix(orchestration): accept user authority relayed by the parent #278).

Proof

  • Failing before: the issue's command on clean origin/main (77d76de): '10,000-byte' not found in 'The encoded hook output has 16,595 UTF-8 bytes, over the 16,384-byte stdout limit...'.
  • On head c7960c0: python3 -m unittest discover -s tests -p 'test_*.py': 515 OK.
  • bin/versionctl release-check: release candidate OK: v17.6.2 at c7960c0.
  • Previous head 2ecc420 (17.6.1) passed independent review; this head needs its own review.

Elon record

Website impact: none (test-only change; no public content).

🤖 Generated with Claude Code

@lukemaj

lukemaj commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Independent review of 2ecc42068eca6d4ad5e685062c657726d11b4544 against 77d76deb49e3fbfaa85a5d950327d8ed246548c5. Pass. No blocking findings.

  • Reproduced the parent test’s Muse failure in the PR worktree using the unchanged loader: the real native link and private preferences produced 16,595 encoded stdout bytes. With the fixture link, Muse reported the shared 10,000-byte context limit, with no stdout overflow. The 16,384-byte Muse stdout cap and precedence when both limits are exceeded are unchanged in bin/project-direction.
  • invoke() now supplies fixture paths for every native target resolved by default_target(). The probe confirmed the parent detected real Claude, OpenCode, and Muse links, and the head found only the empty fixture targets for all five harnesses. Tests that intentionally supply a link still use their own fixtures. The all-host test covers the 10,000-byte fallback for all five harnesses, and test_quoted_context_falls_back_for_muse_encoded_stdout_only separately covers Muse’s 16,384-byte wire ceiling.
  • Independently ran python3 -m unittest tests.test_project_direction_loader tests.test_muse (70 passed), python3 -m unittest discover -s tests -p 'test_*.py' (515 passed), bin/versionctl release-check (v17.6.1 at the reviewed SHA), and git diff --check HEAD^ HEAD (clean). The full suite emitted unrelated trigger-audit ResourceWarning messages and exited zero.
  • The version files and changelog agree on 17.6.1. The PR body includes the Human summary, Elon record, and coordination with fix(orchestration): accept user authority relayed by the parent #278. The second PR to merge needs to rebase and bump again.

The Project Direction loader test isolated Codex and Grok homes but not
Claude, OpenCode or Muse, so on a machine with a real Muse link and
PREFERENCES.md the muse subtest crossed the 16,384-byte stdout limit and
reported that limit instead of the 10,000-byte one. Closes #277.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lukemaj
lukemaj force-pushed the fix/277-muse-loader-limit-test branch from 2ecc420 to c7960c0 Compare November 23, 2026 16:17
@lukemaj

lukemaj commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

Independent review, round 2, of c7960c00ad4ccf9ed1f4e32cb809c1f52b584a01 against 8e1eb3044fd41c6b90a755bf6ada207ff199413d. Pass. No blocking findings.

  • The head is one commit on top of the fix(orchestration): accept user authority relayed by the parent #278 merge. The complete diff contains the byte-identical loader test from round 1, version changes from 17.6.1 to 17.6.2 in VERSION and all five declared mirrors, and one new 17.6.2 changelog entry. The fix(orchestration): accept user authority relayed by the parent #278 procedure changes and its 17.6.1 changelog entry are preserved. git diff --check origin/main HEAD passed.
  • Running the base test source with the unchanged loader reproduced the Muse assertion: 16,595 encoded stdout bytes exceeded the 16,384-byte wire cap, so the hook named that cap. The new helper points Claude, OpenCode and Muse at fixture directories, and the candidate test passes for all five harnesses with the shared 10,000-byte context fallback. The separate Muse stdout-cap test also passed.
  • On the exact head, python3 -m unittest tests.test_project_direction_loader passed all 55 tests and bin/versionctl release-check passed for v17.6.2. The PR body accurately describes the diagnosis, scope, base and version bump. Its 515-test full-suite result is author-provided proof, which I did not rerun.

@lukemaj
lukemaj merged commit b18bc9f into main Nov 23, 2026
2 checks passed
@lukemaj
lukemaj deleted the fix/277-muse-loader-limit-test branch November 23, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test_every_host_falls_back_to_required_reads_past_the_limit fails for host=muse on main

1 participant