feat(signals): add deterministic structural-improvement assessment - #4822
Conversation
…4742) Adds src/signals/improvement.ts, the positive-axis counterpart to slop.ts's risk-only score (sub-issue E of epic #4737): a buildStructuralImprovementAssessment entrypoint that combines four deterministic inputs -- REES's complexity-delta and duplication-delta findings (#4740/#4741), a patch-coverage-delta figure reusing Codecov's own codecov/patch numbers, and a test-evidence signal reusing slop.ts's own buildMissingTestEvidenceFinding -- into one { improvementScore, band, findings } result, mirroring SlopAssessment's shape deliberately. Deterministic tier only, matching the epic's tier split: no LLM call lives here, and the LLM-tier judgment (ModelReview.valueAssessment, already shipped) is combined at the surfacing layer in a later sub-issue, never blended into this score. This module carries no gate/blocker power -- it is a pure, standalone computation consumed only by its own tests, the same activation-wiring-only pattern the epic's foundation sub-issue already used. Bands are none/minor/moderate/significant, plus a distinct insufficient-signal band for a PR where none of the four inputs had anything to measure (e.g. docs-only) -- so an analyzer's silence is never misread as "measured, found no improvement" (score 0 alone cannot distinguish those two cases). Two of the four inputs are honest gaps rather than live data: REES is a separate deployable (not a workspace member, not in the root tsconfig), so the complexity/duplication-delta types are structurally mirrored here rather than imported, and nothing in this codebase currently threads REES's structured findings (as opposed to its rendered prompt text) into the main app, or extracts a structured number from Codecov's check-run text. Wiring a live source for both is follow-up work, not part of this change.
|
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 #4822 +/- ##
=======================================
Coverage 94.23% 94.24%
=======================================
Files 442 443 +1
Lines 38845 38892 +47
Branches 14150 14173 +23
=======================================
+ Hits 36607 36654 +47
Misses 1577 1577
Partials 661 661
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review result - approve/merge recommendedReview updated: 2026-07-11 01:34:51 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.
|
Summary
src/signals/improvement.ts(sub-issue E of epic Epic: PR improvement signal — quality-delta scoring as the positive-axis counterpart to slop-risk #4737): abuildStructuralImprovementAssessmententrypoint that mirrorsslop.ts's shape (input type, weighted-findings formula, banding function) but on the positive axis. It combines four deterministic inputs into{ improvementScore, band, findings }:patchCoverageDeltaPercentfigure, intended to reuse Codecov's owncodecov/patchbefore/after number rather than recomputing it.slop.ts's ownbuildMissingTestEvidenceFindingrather than re-derivingisCodeFile/isTestFileheuristics.ModelReview.valueAssessment, already shipped) is a separate axis combined at the surfacing layer in a later sub-issue (PR panel: new advisory improvement-signal section #4744), never blended into this score.insufficient-signalband for a PR where none of the four inputs had anything to measure (e.g. docs-only), distinct from a genuinenoneverdict (measured, found no improvement) -- both shareimprovementScore === 0, so the band is the only way to tell them apart.#4738/#4753already used for this epic's feature-flag foundation. The surfacing sub-issue (PR panel: new advisory improvement-signal section #4744) wires a real caller later.Two of the four inputs are honest gaps, not live data, and this PR does not attempt to close them (out of scope for this sub-issue):
review-enrichment/) is a separate deployable -- its ownpackage.json/tsconfig.json, not a root workspace member, not in the roottsconfig.jsoninclude-- soComplexityDeltaFinding/DuplicationDeltaFindingare not importable here; the input type structurally mirrors their shape instead (ComplexityDeltaLike/DuplicationDeltaLike).src/review/enrichment-wire.tsend-to-end: today it only splices REES's pre-rendered{ promptSection, systemSuffix }text into the AI review prompt and never parsesbrief.findingsat all -- there is currently no channel that threads REES's structured findings into the main app. Likewise,src/review/grounding-wire.ts/src/review/unified-comment.tsonly carry Codecov's check-run text summary (e.g. "60% of diff hit (target 97%)") for human display; nothing in this codebase's signal pipeline extracts a structured before/after number from Codecov today. Wiring a live source for both is follow-up work for a later sub-issue, not this one.Scope
type(scope): short summaryConventional Commit format.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlintnpm run typechecknpm run test:coveragelocally --src/signals/improvement.tsis 100% statements/branches/functions/lines in isolation; full unsharded suite (704 files) passed with 0 failures.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=moderate-- 0 vulnerabilities.??/ternary/&&(mixed-sign complexity arrays, NaN/Infinity coverage figures, empty-path changed files, undefined vs explicit-empty arrays) plus golden-fixture band-boundary and determinism/invariant tests mirroringslop.test.ts's own style.Full local gate also run beyond the checklist above:
npm run db:migrations:check,db:schema-drift:check,selfhost:env-reference:check,selfhost:validate-observability,cf-typegen:check,test:engine-parity,test:driver-parity, the@jsonbored/gittensory-engineworkspace suite,build:miner,test:miner-pack,rees:test,ui:openapi:settings-parity,ui:version-audit,docs:drift-check,manifest:drift-check,engine-parity:drift-check,command-reference:check, andui:test-- all green.engine-parity:drift-checkconfirms this new file has no mirrored twin underpackages/gittensory-engine/src/signals/(verified, not assumed), so it is exempt from the hand-duplicated-pairs check.Safety
detail/action/publicTextis either static prose or interpolates only integer/numeric counts (mirroringslop.ts's own "only an integer count is interpolated" pattern), and tests assert the forbidden-term regex never matches.UI Evidence
Not applicable -- this PR has no visible UI, frontend, or docs change.
src/signals/improvement.tsis a pure computation module consumed only by its own unit tests in this PR.Notes