Skip to content

fix: honor pytest testpaths and bootstrap bats on servers - #116

Merged
furedea merged 2 commits into
mainfrom
fix/keep-stray-test-copies-out-of-verification
Sep 17, 2026
Merged

furedea merged 2 commits into
mainfrom
fix/keep-stray-test-copies-out-of-verification

Conversation

@furedea

@furedea furedea commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • fix(hooks): Python verification honors testpaths declared in pyproject.toml, drops changed tests that live outside those paths, and prunes common cache and build directories (.cache, build, dist, target, .tox, __pycache__, .pytest_cache, .ruff_cache, .mypy_cache) by default. Explicit .agents/hooks/rules/related_test_extensions.json mappings still run as written.
  • feat(agents): scripts/agents/install_server.sh installs bats-core 1.13.0 under BATS_PREFIX (default ~/.local/share/bats-core) and links it into BIN_DIR, because the Stop gate treats a missing runner as a failure.

Why

On a shared server the Stop hook collected snapshot copies of tests under .cache/ and experiments/ next to the real suite (238 import mismatches, 8 ImportErrors) and reported bats as unavailable, so every Stop was blocked without any regression in the project.

Verification

  • uv run --frozen pytest on the verification-related tests: 196 passed (3 new selection cases; Red observed for the two behavior changes first)
  • bats tests/agents/install_server.bats: 13 passed
  • ruff format/check, ty, dprint, shellcheck, shfmt, autocorrect, actionlint via lefthook

Rollout

Mac: rebuild. Server: git pull and re-run install_server.sh.

🤖 Generated with Claude Code

furedea and others added 2 commits September 16, 2026 20:17
Discovery walked the whole worktree and only pruned .venv and node_modules.

Snapshot copies under .cache or experiments were collected and failed with import mismatches.

Honor testpaths from pyproject.toml, drop changed tests outside them, and prune cache dirs.

Explicit project mappings still run as written.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
A missing runner counts as a failure, so servers without bats blocked Stop in .bats projects.

Install bats-core from its release archive under its own prefix and link it beside the tools.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Copilot AI lite review requested due to automatic review settings September 16, 2026 11:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@furedea
furedea added this pull request to stack #123 September 16, 2026 15:56
@furedea
furedea merged commit 514d2d1 into main Sep 17, 2026
11 checks passed
@furedea
furedea deleted the fix/keep-stray-test-copies-out-of-verification branch September 17, 2026 02:57
furedea added a commit that referenced this pull request Sep 17, 2026
## Summary

Stacked on #116. `install_server.sh` read as "install a server";
ADR-0030 and the README call it the server bootstrap, so the script and
everything named after it now say `bootstrap_server`.

| Before | After |
| --- | --- |
| `scripts/agents/install_server.sh` |
`scripts/agents/bootstrap_server.sh` |
| `tests/agents/install_server.bats` |
`tests/agents/bootstrap_server.bats` |
| `INSTALL_SERVER_MACHINE`, `INSTALL_SERVER_ENV` |
`BOOTSTRAP_SERVER_MACHINE`, `BOOTSTRAP_SERVER_ENV` |
| `~/.config/dotfiles/install_server.env` |
`~/.config/dotfiles/bootstrap_server.env` |

Follow-ups: README, the CI bats path, the helper functions in
`tests/agents/test-helper/setup.bash`, and the fake rendered file name
in the bats fixtures (`hook_translation.py` -> `hook_adapter.py`,
matching #119). ADR-0030 keeps its original wording as a point-in-time
record.

No host has created `install_server.env` yet, so the settings file
rename has no migration.

## Verification

- `bats tests/agents/bootstrap_server.bats`: 13 passed
- shellcheck, shfmt, actionlint, autocorrect via lefthook

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <[email protected]>
furedea added a commit that referenced this pull request Sep 17, 2026
## Summary

Stacked on #118. Behavior-preserving renames that finish the vocabulary
cleanup of the hooks.

| Before | After | Why |
| --- | --- | --- |
| `agents/hooks/guard_dangerous_git.py` | `guard_git.py` | every guard
is `guard_<target>`, like `guard_command` and `guard_file`; the danger
judgement stays in `git_safety.py` |
| `agents/codex/hooks/hook_translation.py` | `hook_adapter.py` | the
README calls these files Codex hook adapters |
| `tests/agents/hooks/test_dangerous_git_contract.py` |
`test_guard_git.py` | |
| `tests/agents/codex/test_hook_translation_cli.py` |
`test_hook_adapter_cli.py` | |
| `tests/agents/hooks/test_quality_cli.py` | `test_lint_format_cli.py` |
one word for the lint hook |

`lint_format.py` used three words for one concept (`lint_format` in the
file name and `hooks.json`, `lint/format` in the Codex status message,
`Quality check` in its output and in one test file). Its messages now
read `Lint/format failed` / `Lint/format unavailable`, and the tests
alias the module as `lint_format`. Audit log identifiers such as
`guard_dangerous_git.sh` are historical labels and stay unchanged.

Follow-ups: `hooks.json` (11 hook commands), the adapter import and
usage text, `related_test_extensions.json` keys and targets,
`test_verification_rule.py`, `agent_hook.bats`, and the deptry
first-party list. The fake `hook_translation.py` filename inside the
`install_server` bats fixtures is left for a later PR because #116 edits
those files.

## Verification

- `uv run --frozen pytest`: 961 passed
- `bats tests/agents/agent_hook.bats`: rendered harness exposes
`.codex/hooks/hook_adapter.py`
- `deptry`, `vulture`, ruff format/check, ty, dprint via lefthook

## Rollout

Mac: rebuild (hook commands change names). Server: `git pull` and re-run
`install_server.sh`.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <[email protected]>
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