feat(review): add boundary-safe test-generation advisory (#1972)#3794
Conversation
Detects a small, precise set of boundary-condition patterns (off-by-one array/index bounds, null/undefined branches, empty-collection checks) touched by a PR's diff with no accompanying test evidence, and returns an advisory finding plus a LOCAL-execution test-generation action spec (criteria/hints only, mirroring local-write-tools.ts's no-cloud-write boundary -- gittensory never writes or runs test code). Gated by the new review.test_generation .gittensory.yml knob, wired through focus-manifest.ts exactly like review.effort_score/ changed_files_summary (default OFF, byte-identical when unset). Exposed via a new gittensory_suggest_boundary_tests MCP tool alongside the existing gittensory_check_slop_risk / gittensory_check_issue_slop pure-metadata tools.
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3794 +/- ##
=======================================
Coverage 93.33% 93.34%
=======================================
Files 317 318 +1
Lines 32467 32515 +48
Branches 11901 11913 +12
=======================================
+ Hits 30303 30351 +48
Misses 1530 1530
Partials 634 634
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-06 10:54:41 UTC
✅ Suggested Action - Approve/Merge
Review summary Nits — 6 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
) #3794 and #3795 both landed a review.test_generation entry in .gittensory.yml.example and config/examples/gittensory.full.yml within an hour of each other; the rebase collision was resolved for the field itself in focus-manifest.ts but left two separate documentation blocks per file (one per PR's framing) instead of one. Collapse each pair into a single entry that keeps the fuller behavioral description alongside the operator-flag callout, matching how every other kill-switched review.* field documents itself once.
Summary
Implements #1972 (boundary-safe test generation). Adds a new deterministic,
config-gated advisory: when a PR's diff touches a small, precise set of
boundary-condition patterns (off-by-one array/index bounds, null/undefined
branches, empty-collection checks) with no accompanying test evidence
anywhere in the PR, it surfaces a
boundary_test_generation_availablefinding plus a LOCAL-execution test-generation action spec (criteria and
framework-agnostic hints only — never generated test code, mirroring
src/mcp/local-write-tools.ts's no-cloud-write boundary: gittensorysupplies the content, the contributor's own agent scaffolds and runs it).
Full server-side test-code generation was explicitly scoped OUT per the
issue — generated test code would need a human to verify it is even
correct anyway, which risks false confidence. The pattern set is
deliberately small (3 kinds) since false positives are worse than a
narrow true-positive set here.
New
.gittensory.ymlknobreview.test_generation(bool | null),wired through
src/signals/focus-manifest.tsexactly like the existingreview.effort_score/review.changed_files_summaryboolean flags(parse, empty-manifest defaults ×3,
presentcheck, serializeround-trip, and a dedicated
resolveTestGenerationEnabledresolvermirroring
resolveReviewPreMergeChecks). Default OFF; a repo with noconfig is byte-identical to today since nothing calls the new detector
unless a caller opts in.
Exposed as a new
gittensory_suggest_boundary_testsMCP tool alongsidethe existing
gittensory_check_slop_risk/gittensory_check_issue_sloppure-metadata tools (no repo/auth access needed — the caller supplies
changed-file paths + patch text, never full source).
Design decision (conservative, smallest-scope): rather than wiring this
into the AI-review orchestration in
src/queue/processors.ts(a verylarge integration surface for a narrow, config-gated advisory), I kept
the new detector/finding/spec as standalone pure functions plus the
config knob and the MCP tool — the closer, smaller existing analogue
(
gittensory_check_slop_risk's pure-metadata MCP-tool pattern) ratherthan the heavier unified-comment rendering pipeline. It is NOT wired
into the scored
slop.tscomposite (buildSlopAssessment), since thatwould change
slopRiskfor every repo that opts in and entangle withslopGateMode: blockthresholds in ways not asked for by the issue.Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally — full unsharded run: 510 test files (508 passed, 2 skipped by design), 10215 tests passed, 0 failed. New filesrc/signals/boundary-test-generation.ts: 100% lines (36/36), 100% branches (23/23). Touchedsrc/signals/focus-manifest.ts: 99.92% lines, 99.38% branches (only pre-existing unrelated gaps remain). Touchedsrc/mcp/server.ts: 98.12% lines, 94.14% branches (pre-existing gaps unrelated to this change; verified none of my added lines are in the uncovered set).npm run test:workersnpm run build:mcpnpm run test:mcp-packnpm run ui:openapi:checknpm run ui:lintnpm run ui:typechecknpm run ui:buildnpm audit --audit-level=moderatetest/unit/boundary-test-generation.test.ts(26 tests covering every pattern kind, both branch sides, the fail-safe no-patch path, the MAX_TOUCHES cap, snippet truncation, and dedup),test/unit/mcp-suggest-boundary-tests.test.ts(3 tests for the new MCP tool), plus extended coverage intest/unit/focus-manifest.test.tsfor the newreview.test_generationparse/round-trip/resolver.Also ran (not in the template checklist, but part of the full local gate):
npm run db:migrations:check,npm run db:schema-drift:check,npm run cf-typegen:check,npm run selfhost:env-reference:check,npm run docs:drift-check,npm run command-reference:check,npm run ui:openapi:settings-parity,npm run ui:test,npm run test:engine-parity,npm run rees:test— all green. No regeneration was needed for any of them (no API/OpenAPI/Cloudflare-binding/Drizzle-schema/self-host-env changes in this PR).Safety
gittensory_suggest_boundary_tests, tested; no OpenAPI/HTTP route change.)UI Evidencesection below with screenshots. (N/A — backend/MCP only, no visible UI change.).gittensory.yml.exampleandconfig/examples/gittensory.full.ymldocumentation for the newreview.test_generationknob; did not touchCHANGELOG.md.)UI Evidence
N/A — this PR has no visible UI/frontend change (backend signal + MCP tool only).
Notes
offby default.