Port os Python hooks (session_start.py, pre_tool_use.py, checks.py, state.py) to Ruby #1525
Labels
No labels
P0
P1
P2
P3
bug
category/code-change
category/cross-repo
category/eval-run
category/investigation
category/no-test-target
category/owner-ruling
category/prose-artifact
category/recurring-chore
category/structure
category/umbrella
crc-refactor
create
delete
enhancement
filed-by/agent
filed-by/user
frozen
lint-rule
needs-info
needs-triage
next
plugin/cc-architect
plugin/os
plugin/os-adr
plugin/os-aidd-lint
plugin/os-backlog
plugin/os-context
plugin/os-doc-hygiene
plugin/os-sdlc
plugin/os-vault
project/cc-os
ready-for-agent
ready-for-human
recurring
review
rule-proposal
update
waiting
wayfinder:grilling
wayfinder:map
wayfinder:map
wayfinder:research
wayfinder:task
wayfinder:task
wontfix
worklist/deviations
worklist/lint-rule
worklist/new-implement-build
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jared/cc-os#1525
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The journey tracer records in-process Ruby messages only. os ships four Python hook files, 869 lines:
hooks/session_start.py(120, aggregated status pass),hooks/pre_tool_use.py(176,file_locked: truefrontmatter guard),hooks/checks.py(420, status-check registry) andhooks/state.py(153, per-project state). The two registered hooks are entry points by the 2026-11-02 ruling and are untraceable while Python. Same mechanism as #1522.Reproduce
n/a: feature ticket; the gap is structural.
Approach
Port the four files to Ruby under a lib module, with thin
hooks/session_start.rbandhooks/pre_tool_use.rbwrappers, as #1522 did for os-backlog. Port the Python tests (tests/pre_tool_use_test.py,tests/hook_test.py) to Minitest and delete the Python files. Output must stay byte-identical for the same stdin and project state. The existing ticket "Run the os plugin's Python hook tests under the os-sdlc gates" becomes obsolete once the hooks are Ruby.Required work: none beyond the acceptance criteria.
Origin
VERDICT: CREATE
Work started by hand (agent port, as #1522) in worktree ticket-os-hooks.
Resolution
Done: Ported the four os hook files to Ruby under OsHooks (Zeitwerk): StatusPass, StateDir, ProjectConfig, LockGuard, Frontmatter, eight checks in OsHooks::Checks with Registry::ALL keeping the same names and output text; thin hooks/session_start.rb and pre_tool_use.rb; hooks.json runs ruby; new bin/status-checks (--json, --stamp-version) replaces the checks.py/state.py calls that /os:fix made; Python hooks and tests deleted; every Python case ported to Minitest with one use_case tag per hook; doc pointers updated.
Evidence: main
88b5e3a5(6f04fc4f). Parity matrix 82 cases (35 SessionStart, 39 PreToolUse, 4 --json, 3 stamp): 81 byte-identical on stdout, stderr, exit and file tree; the one difference is the internal-error path where Ruby reports one stderr line and Python was silent, kept by the fail-loudly rule and invariant 12 updated. Suite on main after merge: 176 runs, 0 failures. Rubocop: 109 files, no offenses.Follow-ups: none; invariant 6 names a Python-vs-Ruby ADR-note comparison test that never existed, dropped since the Python is gone; bin/test comment about hook_test.py refers to other plugins, left