Skip to content

fix(tests): session_queue ~/state test sets USERPROFILE next to HOME (#692, class 5) - #925

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/692-session-queue-userprofile
Nov 7, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/692-session-queue-userprofile

Conversation

@cdeust

@cdeust cdeust commented Nov 7, 2026

Copy link
Copy Markdown
Owner

Summary

Next slice of #692, class 5. test_root_and_job_paths_preserve_intake_context[~/state] (tests_py/hooks/test_session_queue.py) failed on Windows in run 38008915302 (job 114084097957, image windows-2025-vs2026):

AssertionError: assert WindowsPath('C:/Users/runneradmin/state/methodology/session-end-queue') == (WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/test_root_and_job_paths_preser0/state') / 'methodology/session-end-queue')

Root cause (in the test). The test set HOME only. On Windows, Path.expanduser (ntpath, Python ≥ 3.8) reads USERPROFILE, falls back to HOMEDRIVE+HOMEPATH, and ignores HOME. So ~/state resolved to C:\Users\runneradmin\state, outside the test root. session_queue.queue_root expands ~ the way each platform does, so the product is fine. The test now sets USERPROFILE next to HOME, as tests_py/_hermetic_hook_env.py and the other home-sensitive tests already do.

The other class-5 item named for this run, test_capture_dispatch::test_spawn_or_transport_failure_is_logged_and_telemetried, is already fixed on main by 52ce518 (#693), which pins is_supported=True. This PR has no change for it.

Refs #692

Type of change

  • Bug fix (non-breaking change which fixes an issue) — a test defect, no production code changed

Test plan

  • pytest tests_py/hooks/test_session_queue.py (Linux): 14 passed.
  • An ntpath.expanduser("~/state") simulation with the runner's variables gives C:\Users\runneradmin/state with HOME alone and C:\tmp\t/state once USERPROFILE is set. That matches the failing assertion above.
  • ruff check and ruff format --check on the changed file: OK. python scripts/check_craftsmanship.py: OK.
  • Not verified: nothing ran on Windows. The fix rests on the log and on the ntpath simulation. The Windows re-measurement is still on Windows: full-suite debt of 194 failing tests (measured 2026-10-10), fix order by root cause #692's list of remaining slices.

Audit notes

  • One test file and one CHANGELOG entry. No production code, no new constants.

Coding-standards compliance

  • §2.2 Layer dependency direction preserved.
  • §9 No dead code, no TODOs.

Breaking changes

None.

Reviewer checklist

  • CHANGELOG.md updated under ### Fixed.
  • No secrets / credentials / PII in the diff.
  • CI passes on the latest commit (pending).

Generated by Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-07T09:25:07.885880Z 7533609 New commits
🔒 Security Review ✅ Completed 2026-11-07T09:26:24.395846Z 7533609 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Claude finished @cdeust's task in 50s —— View job


I'll analyze this and get back to you.

@claude

claude Bot commented Nov 7, 2026

Copy link
Copy Markdown

Review 1 of 3: PR #925

I ran five reviews (code quality, performance, test coverage, documentation accuracy, security). None found a Blocker.

What the reviews confirmed:

  • queue_root (plugins/hypermnesia-mcp-codex/scripts/session_queue.py:26-31) expands paths with Path(configured).expanduser(). On Windows (Python 3.11+), ntpath.expanduser reads USERPROFILE first, so setting it to tmp_path makes the ~/state case hermetic. HOMEDRIVE/HOMEPATH are never read.
  • The test's other assertions should hold on Windows. pytest resolves tmp_path, which matches root.resolve(). cwd is recorded from Path.cwd() right after chdir(tmp_path). .strip() handles the " relative " case.
  • Setting HOME and USERPROFILE together matches tests_py/_hermetic_hook_env.py and the other tests that depend on the home directory.
  • The CHANGELOG entry is under [Unreleased] → ### Fixed and its claims about expanduser are correct.

I could not run pytest or ruff locally because this job's permissions didn't allow it. CI is the check.

Notes, no action before merge

Verdict: approve

cdeust commented Nov 7, 2026

Copy link
Copy Markdown
Owner Author

This branch is 6 commits behind main (4a196c2). The autosquash rebase onto origin/main applies cleanly (99274c4 locally, tests_py/hooks/test_session_queue.py: 14 passed). The --force-with-lease push was refused by this session's permission policy, so the branch is unchanged (54dadc3). It needs a rebase by a human or a session that is allowed to rewrite the branch.


Generated by Claude Code

…692, class 5)

Run 38008915302 (windows-latest, Suite) failed
test_root_and_job_paths_preserve_intake_context[~/state] in
tests_py/hooks/test_session_queue.py. The test set HOME only; on Windows
Path.expanduser reads USERPROFILE (ntpath, Python >= 3.8) and falls back
to HOMEDRIVE+HOMEPATH, so "~/state" resolved under the runner's profile,
not tmp_path. Test defect, not a product one: session_queue.queue_root
expands "~" the platform's way.

Refs #692

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_018kyZYsqjqvVrsjKfbTBS2U
@cdeust
cdeust force-pushed the fix/692-session-queue-userprofile branch from 54dadc3 to 7533609 Compare November 7, 2026 09:24
@claude

claude Bot commented Nov 7, 2026 •

Copy link
Copy Markdown

Claude finished @cdeust's task in 37s —— View job


Review 2 of 3: PR #925

The rebased patch has the same scope as before: 7 lines added in 2 files, the test change plus the CHANGELOG entry. Because the code didn't change, I did not run new review agents. This job's permissions did not let me run pytest, ruff or gh pr checks, so CI on 7533609 is the check.

Verdict: approve

@claude

claude Bot commented Nov 7, 2026

Copy link
Copy Markdown

Review 2 of 3: PR #925

The last review covered 54dadc3, and it found no Blockers. Since then the branch was only rebased onto main. It is now 7533609, with one commit and no new commits. The rebased patch has the same scope: tests_py/hooks/test_session_queue.py (+3) and CHANGELOG.md (+4), 7 additions and 0 deletions, the same as before. The changed lines match the patch review 1 approved. The test now sets USERPROFILE next to HOME. The CHANGELOG entry is still under [Unreleased] → ### Fixed. Under the review contract, unchanged code is not audited again, so I did not run new review agents.

I could not run pytest, ruff or gh pr checks in this job because the permission policy didn't allow it. CI on 7533609 is the check.

Notes, no action before merge

Verdict: approve

@github-actions
github-actions Bot merged commit 92fc490 into main Nov 7, 2026
18 checks passed
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.

2 participants