chore: add sentrux architectural gating#39
Merged
mattapperson merged 1 commit intomainfrom May 6, 2026
Merged
Conversation
Wire up sentrux via .mcp.json for Claude Code MCP integration and add .sentrux/rules.toml encoding the inner-loop -> lib -> api-shape-helpers layering. CI gains a structural-gate job that installs sentrux v0.5.7 and runs `sentrux gate` against the saved baseline on every PR, blocking merges that regress structural metrics (coupling, cycles, god files, complexity).
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
.sentrux/rules.toml+ baseline that match today's codestructural-gateCI job that blocks PRs which regress structural metricsWhat's in this PR
.mcp.jsonRegisters the sentrux MCP server at the repo root so any Claude Code session inside this checkout gets real-time structural feedback via MCP. Contributors need the sentrux binary installed locally (
brew install sentrux/tap/sentruxor the Linux install script) for the MCP server to run..sentrux/rules.tomlEncodes the package's current layering:
Verified by reading imports:
inner-loop/call-model.tsimports fromlib/;lib/files (anthropic-compat,claude-type-guards,stream-transformers) import fromapi-shape-helpers/;api-shape-helpers/is a leaf.Constraints:
max_cycles=0,max_coupling="B",max_cc=15,no_god_files=true. Layer direction + three explicit boundary rules back up the layering..sentrux/baseline.jsonSnapshot of today's metrics (quality 5195, coupling 0.42, 1 cycle, 9 complex functions).
sentrux gatecompares against this; PRs that make any of these worse will fail CI..github/workflows/ci.yamlNew
structural-gatejob. Installssentrux-linux-x86_64 v0.5.7from GitHub Releases (pinned to the local version so baseline format stays aligned) and runssentrux gate.What this PR deliberately does NOT do
src/lib/(11 files in a strongly-connected component).sentrux checksurfaces it;sentrux gatelocks it at 1 so it can't grow. Fixing is follow-up work.convertToClaudeMessageat 25). Same rationale — gate prevents regression, refactor is separate.max_couplingbelowB. Starter grade; tighten once we know the real coupling number and have taken one PR to adjust.Test plan
sentrux checkrun locally — passes layer + boundary rules, fails on the pre-existing cycle and cc violations (expected, gate is the blocker not check)sentrux gaterun locally against committed baseline — ✓ No degradation detectedpnpm run lint && pnpm run typecheckpass on this branchstructural-gateCI job passes on this PRFollow-ups (not this PR)
src/lib/{async-params, conversation-state, item-types, model-result, next-turn-params, stop-conditions, stream-transformers, tool-context, tool-executor, tool-types, turn-context}.ts.sentrux check.sentrux gate --saveto tighten the baseline, then raisemax_couplingtoward A.