Repository navigation
ci: component-aware pre-commit hook for the monorepo - #959
Merged
Merged
Conversation
AnthonyRonning
force-pushed
the
ci/monorepo-precommit-hook
branch
from
September 17, 2026 01:54
296bd56 to
6d0d855
Compare
Contributor
|
Maple development preview: https://74d06e16.maple-ca8.pages.dev Commit: Uses development API, billing, flags and PCR configuration. Cloudflare Access applies. |
Replace the Research-only pre-commit hook with an orchestrator that classifies staged paths (scripts/ci/hook_change_detection.py) and runs each affected component's own .githooks/pre-commit inside that component's Nix flake, so local checks use the same pinned tools as CI. Without Nix the same commands run from PATH with a warning. Per component the hook mirrors the credential-free lint/test lanes of the workflows: Research prettier/eslint/tsc/bun test and src-tauri fmt/tests; Agent fmt, workspace clippy and tests (MAPLE_HOOK_FULL=1 runs `just ci`); SDK Rust fmt/clippy/--lib tests/doc and TypeScript prettier/build/unit tests; proxy fmt/clippy/test/doc/machete; OpenSecret fmt/clippy/test with the dev-shell hooks disabled; updates prettier/tsc/test; actionlint and the scripts/ci unit tests for repository inputs. Integration suites, cargo-deny, nix flake check and packaging stay in CI. Shared crates do not fan out to their consumers. Git's hook environment (GIT_INDEX_FILE, GIT_DIR, ...) is unset before the checks run so nested git commands in tests never touch the committing checkout. Also: delete the dead sdk/setup-hooks.sh and legacy SDK hook, mark the new component hook directories inert in the CI classifiers, wire the new classifier tests into the flake check, compare resolved paths in test_opensecret_workflows so it passes on macOS, and document the hook in AGENTS.md, the component guides and skills. Co-Authored-By: Claude Fable 5.1 <[email protected]>
ExternalAgentHost takes a `runtime: AgentRuntimeHandle` since the account scope moved into the handle, but the Codex integration test still set the removed `account_scope` field, so the maple-agent test target no longer compiled on any platform. Co-Authored-By: Claude Fable 5.1 <[email protected]>
AnthonyRonning
force-pushed
the
ci/monorepo-precommit-hook
branch
from
September 17, 2026 02:42
f29561a to
7ce063c
Compare
This branch was successfully deployed
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
Replaces the Research-only
.githooks/pre-commitwith a monorepo-aware hook:.githooks/pre-commitclassifies staged paths with the newscripts/ci/hook_change_detection.pyand runs each affected component's own.githooks/pre-commitinside that component's Nix flake (root.#cifor Research, updates and repo checks; theapps/maple-agent,sdk,proxyandservices/opensecret?submodules=1flakes for the rest). Without Nix it runs the same commands fromPATHand warns that results may differ.bun run format:check|lint|typecheck|test; src-tauricargo fmt --check+cargo test --locked --all-targets(CI runs no Clippy there, and-D warningsfails on the vendoredpatches/crates).cargo fmt, one workspace Clippy pass, workspace tests.MAPLE_HOOK_FULL=1runs the fulljust ci.cargo test --lib/doc; TypeScript prettier, build, top-level unit tests.cargo machete(same asproxy-rust.yml).OPENSECRET_DEV_POSTGRES/ENV/CONTAINERS=0; refuses with instructions when the submodules are not checked out.scripts/ciunit tests.bun audit,nix flake check, wrangler dry-run and packaging stay in CI. Shared crates (proxy, Rust SDK) do not fan out to their consumers.GIT_INDEX_FILE,GIT_DIR, ...) before running component checks and guards against re-entry, so nestedgitcommands in the scripts/ci tests operate on their own fixture repositories, never on the committing checkout.MAPLE_HOOK_SKIP=1,MAPLE_HOOK_FULL=1,MAPLE_HOOK_NO_NIX=1,MAPLE_HOOK_ONLY=a,b.Also in this PR:
sdk/setup-hooks.shand the legacy SDK hook (it grepped^rust/and could never have run from the monorepo root)..githooks/directories inert in the three CI classifiers, with tests, and wirestest_hook_change_detection.pyinto the flakechange-detectioncheck.test_opensecret_workflows.pycompares resolved paths so it passes on macOS (/tmpvs/private/tmp).AGENTS.md(new "Pre-commit hook" section), README, the Research/OpenSecret/Agent guides and the affected skills;setup-hooks.shprints the new summary.Verification
Each component was run through the real hook in its Nix shell on macOS:
nix build .#checks.<system>.change-detectionjust ci)The PR commit itself was made through the hook (repo checks ran under git's real hook environment). Docs-only staged sets select nothing; the no-Nix fallback reports the missing tool clearly.
Agent test fix
apps/maple-agenttest targets did not compile on master:ExternalAgentHosttakesruntime: AgentRuntimeHandlesince the account scope moved into the handle, but the Codex integration test still set the removedaccount_scopefield. The second commit fixes the fixture;just ci(the full Linux matrix) passes locally on macOS. The hook caught this on the first local run, which is the point of the PR.🤖 Generated with Claude Code