Skip to content

Add pre-commit hook + protocol conformance tests#56

Open
strix-tkellogg wants to merge 2 commits intomainfrom
quality/pre-commit-and-conformance-tests
Open

Add pre-commit hook + protocol conformance tests#56
strix-tkellogg wants to merge 2 commits intomainfrom
quality/pre-commit-and-conformance-tests

Conversation

@strix-tkellogg
Copy link
Copy Markdown
Collaborator

Summary

  • Pre-commit hook (scripts/install_pre_commit_hook.sh) runs pyright (advisory, auto-skipped on <2GB RAM) + pytest (blocking) before every commit
  • 17 new conformance tests exercising LoggingWriteGuardBackend through CompositeBackend with the exact positional arg patterns that caused the Keel crash (PR Fix LoggingWriteGuardBackend.agrep_raw signature mismatch #55)
  • Fixes pre-existing broken imports in test_config_folders.py and test_write_guard.py (WriteGuardBackend moved to readonly_backend but imports weren't updated)

What this catches

If any backend wrapper method uses **kwargs instead of explicit positional args, these tests fail immediately with TypeError — the exact class of bug from PR #55.

Note for agents

Commits will take ~30 seconds longer due to the pytest run in the pre-commit hook. Account for this with longer timeouts on git commit operations.

Test plan

  • 219 tests pass, 3 skipped (pre-existing), 0 failures
  • Hook correctly skips pyright on low-memory servers
  • Hook blocks commits when tests fail
  • Conformance tests cover: grep_raw, agrep_raw, read, aread, ls_info, als_info, glob_info, aglob_info, write, edit, execute, event logging

🤖 Generated with Claude Code

Pre-commit hook runs pyright (advisory, skipped on low-memory servers)
+ pytest (blocking) before every commit. Conformance tests exercise
LoggingWriteGuardBackend through CompositeBackend with the exact
positional arg patterns that caused the Keel crash (PR #55).

Also fixes pre-existing broken imports in test_config_folders.py and
test_write_guard.py (WriteGuardBackend moved to readonly_backend).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment on lines +20 to +23
# Activate venv if it exists
if [ -f ".venv/bin/activate" ]; then
source .venv/bin/activate
fi
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@strix-tkellogg no! Use uv for all this. So much cleaner to just uv run pyright ...

Per Tim's review: uv run is cleaner than activating venv directly.
Removes venv activation, uses uv run pyright and uv run pytest instead.
Adds PATH fix for ~/.local/bin since git hooks don't inherit full shell env.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.

3 participants