Skip to content

refactor(review): delete dead wire helpers and hoist duplicated ones into core - #736

Merged
benvinegar merged 4 commits into
mainfrom
claude/review-cleanup-dedup
Aug 14, 2026
Merged

refactor(review): delete dead wire helpers and hoist duplicated ones into core#736
benvinegar merged 4 commits into
mainfrom
claude/review-cleanup-dedup

Conversation

@benvinegar

Copy link
Copy Markdown
Member

First of the cleanup PRs from the post-merge Opus review of the browser-review rebuild: dead code and duplicate helpers. No behavior changes and no renames of surviving symbols (renames are the next PR); net −58 lines.

Dead code (verified zero consumers on main and the phase-4 branch)

  • toHunkReviewAction — an exported identity function whose only reference in the repo was its own declaration, with a doc comment claiming a conformance check that doesn't exist.
  • isTransportableReviewNote — a pure rename of reviewNoteWithinBounds; the conformance wire adapter now points at the real function.
  • normalizeReviewDigest — unconsumed, and contradicted the case-sensitive digest policy every wire path actually enforces.
  • The two empty exclusion lists (WIRE_UNREACHABLE_REVIEW_INTENT_TYPES + deriveReviewActionTypes, SEMANTIC_COMMANDS_WITHOUT_REVIEW_EFFECT) are inlined; the tripwire assertions that would catch a future exclusion stay.

Duplicate helpers hoisted to one owner

  • The { ok: false, code, message } resource-failure shape + failure() constructor existed verbatim in both resourceAssembly.ts and resourceStore.ts — now one shape in core/review/resources.ts beside the error-code union it's parameterized by. The no-op fromProducerFailure field-copy in reviewCommands.ts is gone (the producer failure already structurally satisfies the wire type).
  • The kind→byte-ceiling rule (source 1 MB, else 32 MB) was stated independently by the daemon reader and the producer writer — now reviewResourceCeiling(kind) in core, called from both, so the two tiers cannot drift.
  • requireFile was duplicated across intents.ts and reviewCommands.ts including its user-visible message string; the session copy dies and the pre-checks go through the module's existing ReviewIntentPlanningError → fail() conversion. Wire codes and message text unchanged.
  • utf8ByteLength (STML parser had the last straggler copy), clamp (declared twice inside core/review/), the gap-id format (contentManifest.ts hand-wrote what reviewGapId owns), and the plain-record guard (now asRecord in validation.ts beside hasExactKeys) are each down to one implementation.

One real (if unreachable) bug

parseReviewGeneration hardcoded \d{1,15} while its own formatter accepts any non-negative safe integer — so sequences above 10¹⁵ format to strings the parser rejects, which classifyReviewPublication would then classify as stale and silently drop. The parser regex is now built from the module's own grammar constants with the existing Number.isSafeInteger check as the real gate, and a round-trip test pins 999999999999999, 10¹⁵, and Number.MAX_SAFE_INTEGER.

Gate hardening

  • The "no module writes its own SHA-256 digest pattern" scan now includes src/app/ — where the one real hashing implementation lives (no live violation; the hole is just closed).
  • Three tombstone debt entries referencing symbols that no longer exist (so they asserted nothing) are removed — the shrink-only direction the gate documents.

Gates

bun run typecheck clean; bun test over scripts + conformance + core + app/review + session + stml: 1295 pass / 0 fail; bun run lint 0/0 across 698 files; bun run format:check clean. Rebased onto current main (post #733/#727/#728) with gates re-run. Empty changeset (maintenance).


Generated by Claude Code

claude added 4 commits August 14, 2026 17:04
The browser-review rebuild left four unreached paths behind: an identity
function over the action type, an alias for `reviewNoteWithinBounds`, a
lenient digest normalizer that contradicts the module's case-sensitive
policy, and two empty exclusion lists whose only caller subtracted nothing.
Each one is a second name for something core already answers, so the next
reader has to work out which of the two is authoritative.

The exclusion points survive as comments where a real exclusion would go,
and the gate assertions that would catch one keep their tripwires without
depending on the deleted machinery.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018L6h5GBz6RAxRXbgUS4mx4
… into core

Eight small facts were stated twice across the review tiers: the resource
failure shape and its constructor, which ceiling a resource kind is held to,
the plain-record guard, the "file does not exist" rejection and its wording,
UTF-8 byte measurement, an index clamp, and the gap-id format. Each copy is
a place the two can drift, and the audit's own findings are about exactly
that kind of drift going unnoticed.

Core now owns one of each and both tiers import it. The producer's
resource-too-large messages keep their existing wording, including the
path-bearing one a reviewer sees when a source is too large to expand.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018L6h5GBz6RAxRXbgUS4mx4
The parser hardcoded a 15-digit sequence while the formatter accepts any
non-negative safe integer, so a producer that passed 10^15 would publish
generations nothing could read back — and a generation that fails to parse
is treated as stale, which would strand every attached surface.

Building the parser's pattern from the prefix and producer-id rule the
formatter writes by removes the twin that let them disagree; the
safe-integer check stays the real gate on the value.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018L6h5GBz6RAxRXbgUS4mx4
The digest-pattern gate covered the wire and the shared model but not
`src/app`, which is the tier that computes the digests the other two
compare — the one place an inline pattern would do the most damage. There is
no live violation, so widening the scan only closes the hole before someone
falls into it.

Adds the maintenance-only changeset for this cleanup.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018L6h5GBz6RAxRXbgUS4mx4
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hunk-web Ignored Ignored Aug 14, 2026 5:05pm

Request Review

@greptile-apps

greptile-apps Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This maintenance PR removes unused review-wire helpers and consolidates duplicated validation, resource, geometry, and failure-shape utilities into core modules. It also fixes generation parsing across the full non-negative safe-integer range and strengthens review vocabulary and digest-pattern tests.

  • Centralizes resource ceilings and resource-failure construction.
  • Reuses shared file lookup, record validation, gap identifiers, clamping, and UTF-8 measurement.
  • Removes empty exclusion lists and unconsumed wire adapters.
  • Adds regression coverage for 16-digit safe generation sequences.

Confidence Score: 5/5

The PR appears safe to merge; no actionable regression or blocking failure was identified.

The surviving helpers preserve their prior runtime contracts, the generation-parser change aligns parsing with formatting, and the investigated cross-module and wire-shape concerns are contradicted by the repository’s dependency and producer-result structures.

Important Files Changed

Filename Overview
src/core/review/generationOrder.ts Builds the generation parser from shared grammar constants and accepts every sequence the formatter permits.
src/core/review/resources.ts Centralizes per-kind resource ceilings, failure shapes, failure construction, and plain-record validation.
src/app/review/resourceStore.ts Adopts the shared resource ceiling and failure helpers without changing producer failure behavior.
src/session/app/reviewCommands.ts Reuses core file validation and directly returns the already wire-compatible producer resource result.
src/session/reviewProtocol.ts Removes dead adapters and empty exclusions while retaining strict action and resource parsing.
src/session/broker/state.ts Replaces its local resource-ceiling rule with the shared core helper.
src/core/review/validation.ts Adds the shared record guard and removes an unused digest-normalization helper.
src/ui/lib/stml/parse.ts Reuses core UTF-8 byte measurement while preserving the existing truncation implementation.

Reviews (1): Last reviewed commit: "test(review): scan the producer tier for..." | Re-trigger Greptile

@benvinegar
benvinegar merged commit 51f7b88 into main Aug 14, 2026
13 checks passed
benvinegar pushed a commit that referenced this pull request Aug 14, 2026
The dedup and rename PRs (#736, #737) landed while this branch was in
review: the digest implementation moved to src/lib/reviewDigest, the
broker's resource ceiling became core's reviewResourceCeiling, and the
geometry conformance registry took its dimension name. Point the
phase-4 modules at the new homes instead of re-declaring the old ones.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018L6h5GBz6RAxRXbgUS4mx4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants