Repository navigation
feat(packs): warn on low per-rule rewrite precision (UPT-65) - #198
Merged
lucasbraum merged 1 commit intoOct 17, 2026
Conversation
pack test computes each mechanical rule's precision (real true positives against scored false positives), prints it, and flags rules below RULE_PRECISION_WARNING (80%). Warning only: no status or run mode changes. verification.json records the counts (mechanical); docs/compatibility.md lists them per rule. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
lucasbraum
added a commit
that referenced
this pull request
Oct 17, 2026
…sing on UPT-65 pack test --write on the rebased branch, ground truth unchanged: both records gain the per-rule `mechanical` counts #198 added (browser enable-logs 2/0; react enable-logs 4/0, integration-names 0/1, which the UPT-65 warning flags below 80%). Statuses, tallies and truth digests are the same as before the rebase. docs/compatibility.md regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Lucas Braum <[email protected]>
lucasbraum
added a commit
that referenced
this pull request
Oct 17, 2026
…87) (#201) Fixes UPT-87. ## Reconciliation first The committed `verification.json` said 69% (89 TP / 40 FN). A fresh local `pack test react --offline` measures **107 TP / 22 FN (83%)**, and CI's `pack react` job on 4c3dc23 measures the same numbers (artifact `pack-test-react` of run 39009240360). So it is a stale record, not the environment: #198 left the react tally as it was (its message says so), and the scorer changed in #143 and #155 after the record was written. ## Reach, then rules (22 breaking misses) | cause | misses | |---|---| | reached; the compiler reports at the use site, truth marks the `RefObject<T>` declaration (`ref-object-nullable`) | 16 | | `global-jsx-namespace` with no finding in the file | 4 | | `generic` in dev-docs | 2 | Most of the 16 declarations use the global `React.RefObject` with no react import, so `detect` never read them. ## Change - `ref-object-nullable` gets a syntax-tree `detect`: `RefObject<T>` / `React.RefObject<T>` where `T` is an element type or a type parameter bounded by one, has no `null`, and is not a cast. - The pack also reads every project file containing `RefObject<` (same pattern as the ai pack, UPT-33). - Near-miss fixtures: `| null`, `RefObject<number>`, a cast. A cast is excluded because it would be a breaking false positive at `TldrawUiContextualToolbar.tsx:56` (truth lists :55, not :56); :55 stays missed. - `verification.json`, README and `docs/compatibility.md` regenerated. ## Before / after (same pinned ground truth, not touched) | | before (measured) | after | |---|---|---| | breaking recall | 83% (107/129) | **94.6% (122/129)** | | breaking FP | 0 | 0 | | unverified FP | 8 | 8 | | `ref-object-nullable` | 38 TP / 16 FN | 53 TP / 1 FN | | other rules | unchanged | unchanged | Pack stays verified; thresholds untouched. ## Remaining 7 misses - `dev-docs/src/pages/index.tsx:1`, `dev-docs/src/components/Homepage/index.tsx:1` (excalidraw): its tsconfig says it is not used in compilation. - `examples/excalidraw/with-nextjs/src/app/page.tsx:19`: a separate example package, outside the analyzed program. - `apps/dotcom/client/tsconfig.json:15` (tldraw): a config file; truth marks the cause, no diagnostic lands there. - `ButtonIconCycle.tsx:23`, `apps/examples/src/ExampleWrapper.tsx:111`: global-JSX sites with no finding in the file; **not investigated beyond that**. - `TldrawUiContextualToolbar.tsx:55`: the cast, see above. Suspect truth entries to review (not changed): :55 vs :56 above are the same cast, one listed and one not. Core tests pass (`pnpm test` in `packages/core`). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Lucas Braum <[email protected]> Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.
Closes UPT-65 (warning phase only).
pack testnow computes precision for every rule with a rewrite, breaking or not. The rule set is the same one the gate already calls mechanical (rewriterules plusPack.mechanical). Precision is real true positives (public repos) over those plus every scored false positive, the same counts the UPT-48 gate reads. A rule belowRULE_PRECISION_WARNING(80%) is flagged inpack testoutput and in the new per-rule table indocs/compatibility.md. Warning only: no gate reason, no status change, no change tounexercisedor to how any rule runs. Ground truth and existing thresholds are untouched.verification.jsongainsmechanical(per-rule TP/FP) so the docs can read it. I added only that field to each record from a full localpack testrun of all 17 packs. Every other field is left as it was, including the drift that was already there (joi and openai status, react and zod breaking tallies), so no--writesilently changed a status.Also:
formatRecordnow counts the comma after an inline list. Biome does, andunexercisedis no longer the last key.Current numbers (all rewrite rules)
express and ioredis have no rewrite rules.
Proposed threshold: 80%
Every exercised rewrite is at 100% except two. The data has a wide gap between 8%/50% and 100%, so any cut from 51% to 100% gives the same result today. I propose 80%: it tolerates one FP in five, which leaves room for small-sample rules, and it still catches both outliers.
If this became a gate, these would switch to assisted:
react-router/dom-imports: 29 TP, 336 FP (335 in getlago/lago-front, 1 in Arize-ai/phoenix). These are deprecatedreact-router-domimport moves the real upgrades didn't make. It already rewrites only with--include-deprecated.next/middleware-proxy: 1 TP, 1 FP (benshabbat/GamesForMyKids, deprecated). This is a small sample: one more real site would move it.No pack's status would change: both packs stay verified, because neither FP is breaking.
Tests
contract.test.ts: a low-precision rule is flagged and the pack stays verified.pack.test.ts: per-rule rewrite lines and the warning are printed, and the run still passes.docs-packs.test.ts: the matrix carries the rewrite table and the README doesn't.pnpm docs:packs --checkandbiome check .are clean. The core pack tests pass. In the CLI suite only the telemetry-sender and third-party-notices tests fail, which also fail locally on main.🤖 Generated with Claude Code