Repository navigation
Conversation
…dable output (#404, #401, #408) - #404: the VERDICT ladder could still name "SessionEnd has never fired" over a more specific PostToolUse-exiting-early cause already printed above it, on an aged store. Moved the arm below both PostToolUse arms that name a cause, leaving its priority over "capture is working" and "PostToolUse never fired at all" unchanged. - #401: a legacy store migrated to external mode with git backup enabled could never reach the SessionEnd FAIL verdict again, because 50-git-backup.sh deletes the .gitignore file doctor.sh read as its install baseline. bootstrap-dirs.sh now writes a dedicated .install-marker instead, unconditional of storage mode, that nothing else has any reason to touch. - #408: added `doctor.sh --json`, a provisional machine-readable resolution surface (resolved directory + storage mode) for external callers that would otherwise have to reimplement session_dir_slug. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Self-review (Explore + oss:auditor, both independently) found that _json_escape() handled backslash, double-quote and newline but passed every other control byte (a raw tab, a carriage return) through unescaped -- invalid inside a JSON string literal per RFC 8259, and POSIX filesystems permit both in a real path. `tr '[:cntrl:]' ' '` replaces the earlier `tr '\n' ' '`, flattening the whole class the same lossy-but-valid way the newline case already was, rather than only the one byte that had a test. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
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
Three issues bundled into one lane because they all touch
scripts/doctor.sh:/remember:doctor's VERDICT ladder could still name "SessionEnd has never fired" over a more specific, already-printed PostToolUse diagnosis ("wired and running, but exiting early") on an AGED store. Moved that arm below the two PostToolUse arms that already name a cause, leaving SessionEnd's own priority over "capture is working" and over "PostToolUse never fired at all" untouched -- both pinned by existing tests.FAILverdict again, becausehooks.d/after_save/50-git-backup.shdeletes.gitignore, whichdoctor.shused to read as its install baseline.bootstrap-dirs.shnow writes a dedicated.install-markerinstead (unconditional of storage mode, gated on it not already existing) that nothing else in the codebase has any reason to touch. A store already degraded by this composition self-heals the next time any hook sourcesbootstrap-dirs.sh.scripts/doctor.sh --json, a provisional machine-readable resolution surface (schema_version, one of three states --resolved/resolved_assumed_project_dir/could_not_resolve-- plusremember_dir/storage_mode/project_dirorreason) for an external caller that would otherwise have to reimplementsession_dir_slug.A self-review round (Explore + oss:auditor, run independently against the first commit) both found the same real gap: the new
--jsonmode's_json_escape()handled backslash, quote and newline but not other C0 control bytes (a raw tab or CR), which produces invalid JSON per RFC 8259 for a path containing one. Fixed in a follow-up commit with its own red-then-green test, since it was small, same file, same subsystem, and the mechanism was fully understood.Test plan
tests/test_doctor_verdict_ordering_404.py-- new, red before the ladder reorder, green after; includes the positive control (SessionEnd still reachable with no PostToolUse arm at all).tests/test_doctor_session_end_survives_backup_cleanup_401.py-- new, red before the marker swap, green after; includes the positive control (still WARNs, doesn't manufacture a FAIL, when nothing has ended).tests/test_doctor_json_408.py-- new, four cases: resolved, resolved_assumed_project_dir, could_not_resolve (never carriesremember_dir), and the control-byte escaping fix.python3 .oss/assemble_changelog.py --check-- clean, three fragments (404.fixed.md, 401.fixed.md, 408.added.md) plus the pre-existing 407.fixed.md.tests/test_slug_index_297.py::test_concurrent_session_starts_do_not_lose_a_rowreproduces on unmodifiedmaintoo (2/5 failures with this branch's changes stashed) -- not a regression from this diff.