close
Skip to content

test(dashboard): make chat-pins transient-I/O test portable on Windows - #2454

Merged
iamwhatever merged 1 commit into
mainfrom
test/windows-chat-pins-io
Aug 10, 2026
Merged

test(dashboard): make chat-pins transient-I/O test portable on Windows#2454
iamwhatever merged 1 commit into
mainfrom
test/windows-chat-pins-io

Conversation

@iamwhatever

Copy link
Copy Markdown
Collaborator

Problem

The Windows backend CI shard fails deterministically:

FAILED test/test_dashboard_chat_pins.py::test_load_transient_io_error_preserves_existing_state
  - Failed: DID NOT RAISE <class 'OSError'>

Why it matters

This is a base breakage on main (the test landed via #1676), so it turns the Windows shard red on every open PR, not just the branch that introduced it — masking real regressions behind a known-failing check.

Fix (symptom → root cause → change)

  • Symptom: the test expects load_chat_pins() to re-raise OSError, but on Windows nothing is raised.
  • Root cause: the test simulated the transient read error with (tmp_path / "chat_pins.json").chmod(0o000). Windows ignores POSIX permission bits for read access — a 0o000 file still opens there — so path.read_text(...) succeeds, load_chat_pins() returns normally, and pytest.raises(OSError) sees no exception. The production code under test is correct; only the failure-injection was non-portable.
  • Change: inject the error at the read boundary instead — monkeypatch.setattr(type(path), "read_text", _failing_read) where _failing_read raises PermissionError (an OSError subclass). This deterministically hits the except OSError: raise branch on every OS. The assertion that in-memory _chat_pins is preserved is unchanged. This mirrors the sibling test test_load_transient_io_error_no_destructive_followon in the same file, which already uses exactly this pattern. As a side benefit it removes the chmod try/finally cleanup dance, which on POSIX could leave an unreadable temp file if the body failed before the finally.

Tests

  • test/test_dashboard_chat_pins.py::test_load_transient_io_error_preserves_existing_state — reworked to inject the transient read error portably; still asserts the OSError re-raise and that valid in-memory pins are not clobbered.
  • Full file re-run locally: 77 passed. isort/flake8 clean. No production code changed.

Manual verification

N/A — unit coverage is sufficient; this is a test-only portability fix and the change is exercised by the reworked test itself on the local (non-Windows) run.

chmod(0o000) does not block reads on Windows (POSIX perm bits are ignored for read access), so load_chat_pins reads successfully and the expected OSError never fires, failing test_load_transient_io_error_preserves_existing_state on the Windows backend shard. Inject the transient read error by monkeypatching read_text to raise PermissionError instead, matching the sibling test_load_transient_io_error_no_destructive_followon in the same file.
@iamwhatever
iamwhatever requested a review from a team as a code owner August 10, 2026 01:54
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Aug 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Opus 4.8 Review — ✅ no blocking findings

Reviewed fbde279add245b774f29e687f56a924819f60906 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] fbde279

Verdict parsed from the review's SHA-scoped output markers for commit fbde279add245b774f29e687f56a924819f60906.

False positive or not applicable? A repository writer can comment:
/ai-review override fable fbde279add245b774f29e687f56a924819f60906: <one-sentence reason>

@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Advisory design-level review of fbde279add245b774f29e687f56a924819f60906 — updated in place on each push; does not block merge.

Design-Verdict: PASS

Test-only portability fix at the true root cause (non-portable failure injection), mirroring the sibling test's established pattern; production code untouched.

[DESIGN-REVIEWED] fbde279

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of fbde279add245b774f29e687f56a924819f60906 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] fbde279

False positive or not applicable? A repository writer can comment:
/ai-review override gpt fbde279add245b774f29e687f56a924819f60906: <one-sentence reason>

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Aug 10, 2026
@iamwhatever
iamwhatever enabled auto-merge (squash) August 10, 2026 02:08
@iamwhatever
iamwhatever merged commit e7f13c2 into main Aug 10, 2026
50 checks passed
@iamwhatever
iamwhatever deleted the test/windows-chat-pins-io branch August 10, 2026 02:08
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Aug 10, 2026
encomjp pushed a commit to encomjp/kirocrew-customapi that referenced this pull request Aug 22, 2026
kirodotdev#2454)

chmod(0o000) does not block reads on Windows (POSIX perm bits are ignored for read access), so load_chat_pins reads successfully and the expected OSError never fires, failing test_load_transient_io_error_preserves_existing_state on the Windows backend shard. Inject the transient read error by monkeypatching read_text to raise PermissionError instead, matching the sibling test_load_transient_io_error_no_destructive_followon in the same file.

Co-authored-by: Joe Guo <zejiangg@amazon.com>
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