Skip to content

UI library: add exhaustive page coverage contract - #619

Merged
zacjones93 merged 50 commits into
codex/ui-semantic-contrastfrom
codex/ui-page-coverage-contract
Jul 15, 2026
Merged

UI library: add exhaustive page coverage contract#619
zacjones93 merged 50 commits into
codex/ui-semantic-contrastfrom
codex/ui-page-coverage-contract

Conversation

@zacjones93

@zacjones93 zacjones93 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • discover every registered TanStack route from generated routeTree.gen.ts files and reconcile it one-to-one with source route declarations
  • discover Docusaurus docs/category decisions and explicit Team Memory, OG Worker, and PostHog service surfaces
  • keep the human plan separate from deterministic generated JSON and Markdown ledgers
  • validate app registration, route identity/classification, scenarios, axes, dynamic params, dispositions, layout coverage, blockers, and hash-checked evidence
  • add scaffold/generate/check scripts, a required CI check, exhaustive contract tests, and LAT documentation

This is contract/infrastructure only. It does not change page/component/domain behavior and does not add browser evidence.

Reconciled baseline

Surface Records
TanStack routes, including roots 275
Docusaurus decisions 41
Service decisions 12
Total 328
Page/page-layout 239
Explicit non-page decisions 89

The 239 visual records plus 17 redirect-only records reconcile to 256 browser-addressable patterns. The earlier ~203 estimate treated many trailing-slash index pages as layout-only; the generated/source identity contract correctly keeps those records as pages.

All 239 visual records are explicitly unassessed with pending placeholders. There are zero fabricated verified scenarios.

Validation

  • Node 24.14.0 / pnpm 9
  • pnpm check:page-coverage
  • focused page-coverage suite: 15 tests
  • full WODsmith Start suite: 138 files / 2,921 tests
  • full pre-push lint and type-check
  • lat check
  • git diff --check

Summary by cubic

Adds an exhaustive page coverage contract that reconciles all registered TanStack routes, docs, and service surfaces with a human-owned plan. Generates deterministic JSON/MD ledgers, enforces the contract in tests/CI, proves service delegation paths, and binds proxy coverage to a canonical import; no runtime or UI changes.

  • New Features
    • Repo-wide discovery of routes, docs, and services with canonical path normalization, redirect-only handling, and accurate page vs. layout classification.
    • Plan-first flow: edit docs/ui-library/page-coverage.plan.json; generate docs/ui-library/page-coverage-ledger.json and .md.
    • Validation of route identity, dynamic params, scenarios/axes, dispositions, layout coverage, and evidence hashes; fail-closed on service route drift; proxy coverage bound to a canonical import; delegation paths proven.
    • Scripts/CI: page-coverage:scaffold, page-coverage:generate, check:page-coverage; CI runs pnpm check:page-coverage.

Written for commit 0570c05. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • New Features

    • Added a page coverage plan and generated ledger documenting UI pages, documentation routes, and service surfaces.
    • Added coverage summaries by application, route type, disposition, and scenario status.
    • Added commands to scaffold, generate, and validate coverage records.
  • Documentation

    • Added guidance describing page coverage requirements, evidence handling, exclusions, and validation rules.
  • Tests

    • Added comprehensive checks to detect missing, inconsistent, or outdated coverage information during continuous integration.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This PR adds repository-wide page-coverage discovery, plan validation, deterministic JSON/Markdown ledger generation, checked-in coverage artifacts, comprehensive tests, documentation, and a CI contract check.

Changes

Page coverage contract

Layer / File(s) Summary
Coverage taxonomy and service definitions
apps/wodsmith-start/scripts/page-coverage/config.mjs
Defines registered applications, coverage axes, route dispositions, evidence kinds, service decisions, and stable service route IDs.
Repository surface discovery
apps/wodsmith-start/scripts/page-coverage/discovery.mjs
Discovers and reconciles TanStack routes, Docusaurus pages/categories, and service HTTP or cron surfaces.
Plan scaffolding and validation
apps/wodsmith-start/scripts/page-coverage/validation.mjs
Scaffolds route entries and validates plan structure, scenario coverage, exclusions, descendants, evidence references, and hashes.
Ledger rendering and command wiring
apps/wodsmith-start/scripts/page-coverage/render.mjs, apps/wodsmith-start/scripts/generate-page-coverage-ledger.mjs, apps/wodsmith-start/package.json, package.json
Joins validated plans with discovered routes, renders JSON and Markdown ledgers, and adds scaffold, generate, and check commands.
Tests, checked-in artifacts, and CI gate
apps/wodsmith-start/test/scripts/page-coverage-ledger.test.ts, docs/ui-library/page-coverage.*, lat.md/ui-library.md, .github/workflows/ci.yaml
Adds discovery and validation tests, checked-in plan and ledger outputs, contract documentation, and CI execution of the ledger check.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CI
  participant generatePageCoverageLedger
  participant discoverRepository
  participant validatePlan
  participant LedgerArtifacts
  CI->>generatePageCoverageLedger: run check:page-coverage
  generatePageCoverageLedger->>discoverRepository: discover repository surfaces
  generatePageCoverageLedger->>validatePlan: validate checked-in plan
  validatePlan-->>generatePageCoverageLedger: return validated records
  generatePageCoverageLedger->>LedgerArtifacts: compare rendered JSON and Markdown
  LedgerArtifacts-->>CI: report current or stale outputs
Loading

Possibly related PRs

Poem

A bunny found routes in a burrow of code,
Counted each page on the coverage road.
Plans bloomed with evidence, ledgers aligned,
CI checked every crumb it could find.
Hop, hop—no stale page left behind!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding an exhaustive UI library page coverage contract.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ui-page-coverage-contract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@zacjones93

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/wodsmith-start/scripts/page-coverage/discovery.mjs`:
- Around line 250-264: The parseFrontmatter() implementation should parse the
frontmatter block as YAML instead of splitting lines and coercing only boolean
scalars. Replace the manual parsing logic with the repository’s available
YAML/frontmatter parser, preserving quoted strings and structured values such as
arrays or objects while retaining the existing empty/invalid-frontmatter
fallback behavior.

In `@apps/wodsmith-start/scripts/page-coverage/validation.mjs`:
- Around line 243-246: Update the scenario validation near the scenario ID
uniqueness check to reject any scenario whose id is missing, non-string, or
blank after trimming, before emitting the ledger; retain the duplicate-ID check
for valid identities and reference the scenario mapping in the validation logic.
- Around line 122-146: The repository-boundary check in validateEvidence must
use portable path semantics instead of startsWith. Resolve the repository root
and evidence path, compute relative(repoRoot, absolutePath), and reject the path
when isAbsolute(relativePath) or it starts with .. plus a path separator; retain
the existing missing-file and hash validation.

In `@apps/wodsmith-start/test/scripts/page-coverage-ledger.test.ts`:
- Around line 181-233: Add exactly one `// `@lat`:` specification reference next
to every `it()` test in `page-coverage-ledger.test.ts` that currently lacks one,
including the tests covering route-source validation, app registration,
Docusaurus drift, Hono/worker/cron decisions, dynamic fixtures, unknown axes,
dispositions, layout-only records, and deterministic rendering. Use the existing
nearby tests’ reference format and ensure each test has a unique, relevant spec
reference with no duplicates.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: f15c34d1-048e-41bf-b556-4649de0efeca

📥 Commits

Reviewing files that changed from the base of the PR and between b76ab29 and 397af8a.

📒 Files selected for processing (13)
  • .github/workflows/ci.yaml
  • apps/wodsmith-start/package.json
  • apps/wodsmith-start/scripts/generate-page-coverage-ledger.mjs
  • apps/wodsmith-start/scripts/page-coverage/config.mjs
  • apps/wodsmith-start/scripts/page-coverage/discovery.mjs
  • apps/wodsmith-start/scripts/page-coverage/render.mjs
  • apps/wodsmith-start/scripts/page-coverage/validation.mjs
  • apps/wodsmith-start/test/scripts/page-coverage-ledger.test.ts
  • docs/ui-library/page-coverage-ledger.json
  • docs/ui-library/page-coverage-ledger.md
  • docs/ui-library/page-coverage.plan.json
  • lat.md/ui-library.md
  • package.json

Comment thread apps/wodsmith-start/scripts/page-coverage/discovery.mjs Outdated
Comment thread apps/wodsmith-start/scripts/page-coverage/validation.mjs Outdated
Comment thread apps/wodsmith-start/scripts/page-coverage/validation.mjs
Comment thread apps/wodsmith-start/test/scripts/page-coverage-ledger.test.ts

@zacjones93 zacjones93 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent stacked review — changes requested

Risk: MEDIUM. The checked-in baseline is internally consistent, but the “exhaustive” drift gate still has three silent false-negative/false-positive paths that should be closed before this layer becomes the source of truth.

  1. [P1] Docusaurus MDX pages bypass discovery. discoverDocs only accepts .md and _category_.json (discovery.mjs:309-311). Docusaurus treats .mdx as a docs page, but a temp fixture containing only docs/hidden.mdx produced 0 records and no error. A future MDX page would therefore ship without a plan entry while check:page-coverage stays green. Include both .md and .mdx in discovery/frontmatter handling and add a fixture asserting the MDX route is inventoried (plus a missing-plan failure).

  2. [P1] Service markers prove listed decisions still exist, not that the service inventory is complete. discoverServices iterates the hard-coded SERVICE_DECISIONS and checks marker presence (discovery.mjs:360-381), while the registry only requires at least one decision per service app (lines 447-458). Adding a new Hono app.get/post/route or Worker path branch leaves every existing marker intact, so CI does not detect the new surface despite the LAT claim that repository-surface drift fails generation. Add source-derived route/mount reconciliation, or another deterministic routing manifest/hash gate that fails when routing code changes without an explicit decision; test an added unlisted Hono endpoint and Worker branch.

  3. [P1] Route classification reads comments as executable route options. classifyTanstackRoute regexes raw option text for component:, server.handlers, and redirect( (discovery.mjs:98-103). Direct proof: { // component: RetiredPage\n beforeLoad: guard } is classified as a page. The brace scanner also does not lex comments/regex literals, so commented braces can truncate/extend the option slice. Use a TypeScript AST or a comment-aware lexer before classification, and add fixtures for line/block comments and regex literals so commented properties cannot create visual/API/redirect records.

  4. [P2] Scenario state-machine validation accepts malformed identities and contradictory pending blockers. A one-scenario plan with scenario.id deleted passes validation; likewise a status: "pending" scenario with a populated blocker passes. The validator only checks duplicate IDs and validates blocker shape for blocked (validation.mjs:207-254). Require a non-empty string ID for every scenario, and enforce blockers only for blocked (or document/test a different explicit rule). Add rejection tests for missing/blank IDs and pending scenarios carrying blockers.

Evidence checked

  • Exact stack: b76ab29b6...397af8aef; 13-file PR diff.
  • Independent tree/source denominator: generated-tree entries + root = Start 212, Crew 37, CRM 17, Ledger 5, Gameday 4, matching source declaration counts and ledger app counts.
  • Ledger: 328 total = 239 page/page-layout + 89 non-page; 17 redirects; 239 pending / 0 blocked / 0 verified. All pending scenarios currently have empty evidence and blockers, so the PR does not fabricate verification.
  • Current Docs inventory reconciles 31 Markdown docs + 10 categories, including 1 draft and 6 navigation-only categories; current routeBasePath/category outputs are consistent.
  • node apps/wodsmith-start/scripts/generate-page-coverage-ledger.mjs --check passed; lat check passed; worktree remained clean.
  • All 14 GitHub checks are green. No inline review threads or submitted reviews exist; CodeRabbit remains in its in-progress summary state.
  • Local pnpm/Vitest and Docs-build reruns were blocked by this worktree’s pnpm store mismatch/non-TTY reinstall guard; CI’s Start test/build/typecheck and E2E checks provide the full-suite signal.
  • GitNexus compare output was stale to an earlier stacked worktree (it reported 174 changed files rather than this PR’s 13), so it was not used as correctness evidence.

@zacjones93

Copy link
Copy Markdown
Contributor Author

Follow-up review fixes are pushed in 675338f.

Addressed:

  • Docusaurus discovery now includes .md and .mdx and parses quoted/structured YAML frontmatter.
  • Team Memory Hono routes, OG worker path branches/fallback, cron triggers, and PostHog wildcard delegation are reconciled from source; added-endpoint and worker-path drift fixtures fail closed.
  • TanStack route options are classified through the TypeScript AST, so line/block comments, commented braces, strings, and regex literals cannot fabricate components.
  • Evidence refs use portable absolute/relative/escape checks, scenario IDs must be nonblank strings, and only blocked scenarios may contain blockers.

Validation:

  • focused page-coverage contract: 18/18
  • full Start suite: 138 files, 2924 tests
  • page-coverage freshness check: passed
  • Start type-check: passed
  • monorepo pre-push lint/type-check: passed (existing warnings only)
  • lat check: passed
  • git diff --check: passed

All four CodeRabbit inline threads have evidence replies and are resolved. Requesting a delta review of 675338f.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

@zacjones93 Thanks for the detailed summary of the follow-up fixes and validation results. I'll run a delta review of commit 675338f now.

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

Delta review of 397af8a..675338f — one remaining finding

[P1] The service drift gate still silently misses valid routing syntax.

The new reconciliation is source-derived only for narrow regex shapes:

  • Hono matches receiver.method(...) only when the receiver immediately precedes the method (discovery.mjs:424-434). Direct fixture: app.get('/health', health).post('/new', added) is accepted with only GET /health registered; the chained POST /new disappears.
  • OG Worker recognizes only path === "..." and same-line path.match(...) (lines 550-570). Direct fixture: if (path.startsWith('/assets/')) return asset() is accepted with only /health and /* decisions, so the special surface is not reconciled.
  • PostHog’s guarantee is raw token presence (lines 581-586). Direct fixture: async fetch(...) { /* proxyRequest(request) */ return new Response('not proxied') } passes and emits the wildcard decision even though fetch never delegates.

This leaves the original completeness problem open whenever routing uses legitimate alternate syntax or a stale call survives in a comment. Make service parsing AST-based/fail-closed too: walk chained Hono call expressions and mounted receivers; enumerate/normalize supported Worker path predicates while rejecting unrecognized path branches; and verify the PostHog fetch method actually calls/returns proxyRequest in its AST. Add the three fixtures above as regression tests.

All prior findings are otherwise resolved: MDX/YAML, TanStack AST classification, scenario ID/pending-blocker validation, and portable evidence refs.

Validation: focused contract 18/18, direct ledger freshness passed, lat check passed, worktree clean. The dependency/lock delta correctly adds yaml@2.8.2; frozen-install CI reached build/test phases. All four prior CodeRabbit threads are resolved with replies; its delta produced no new thread. At review time, build/lint/Crew/typecheck jobs were green, while Start test/typecheck and one E2E shard were still running. GitNexus remains stale to another stacked worktree (176 files reported for this 7-file delta), so it was excluded from correctness evidence.

@zacjones93

Copy link
Copy Markdown
Contributor Author

Addressed the remaining P1 from the delta review in fae7b83.

Tests-first evidence:

  • The exact chained Hono, Worker startsWith, and comment-only PostHog fixtures reproduced the bypasses before the implementation change.
  • Focused contract now passes 22/22, including registered chained routes, normalized prefix routes, direct/assigned proxy returns, unsupported Worker predicate rejection, and string/comment false-positive rejection.

Implementation:

  • Hono methods, chains, mounts, imports, scheduled handlers, and cron comparisons are walked through the TypeScript AST; dynamic route shapes fail closed.
  • OG Worker fetch predicates are AST-enumerated for equality, regex match/test, startsWith prefixes, conditionals, and switches; an unrecognized path predicate is rejected instead of omitted.
  • PostHog only emits its wildcard when the fetch AST returns proxyRequest directly or returns a variable assigned from that call. Comments and strings cannot satisfy delegation.

Validation:

  • focused page-coverage contract: 22/22
  • full Start suite: 138 files, 2928 tests
  • page-coverage freshness: passed
  • Start and monorepo pre-push type-check: passed
  • monorepo pre-push lint: passed (existing warnings only)
  • lat check: passed
  • git diff --check: passed

Requesting another delta review of 675338f..fae7b83. The parent remains open pending reviewer clearance.

@coderabbitai review

Copy link
Copy Markdown
Contributor Author

Final delta review of 675338f..fae7b83 — remaining fail-closed gaps

The exact prior bypasses are fixed, current repository reconciliation is clean, and the 22 focused tests pass. Two closely related AST edge cases still let real service behavior bypass the “exhaustive/fail-closed” contract:

  1. [P1] Worker pathname aliases and inline pathname predicates are silently omitted. discoverWorkerPatterns only records variables initialized directly from a .pathname property, then only inspects conditions that contain that identifier (discovery.mjs:751-805). Both direct fixtures below pass with only the wildcard decision:

    • const path = new URL(request.url).pathname; const isAsset = path.startsWith('/assets/'); if (isAsset) return asset(); return fallback()
    • if (new URL(request.url).pathname === '/health') return health(); return fallback()

    The first hides the path use behind a boolean; the second never creates a tracked path identifier. Both are ordinary syntax, yet neither produces a surface nor an unsupported-predicate error. Track pathname expressions/aliases, or audit every pathname-derived reference and fail whenever it is not consumed by a recognized equality/regex/prefix/switch predicate. Add both fixtures and require an unregistered-surface or unsupported-predicate failure.

  2. [P1] PostHog checks that some same-named delegated value is returned, not that every fetch path returns the proxy result. fetchReturnsDelegation stores identifier text without binding/control-flow identity and succeeds after any qualifying return (lines 844-877). These fixtures both emit /*:

    • let response = new Response('not proxied'); if (false) { const response = proxyRequest(request) } return response (shadowed binding)
    • if (request.method === 'GET') return proxyRequest(request); return new Response('not proxied') (partial delegation)

    This contradicts the LAT guarantee that every method/path delegates. For this worker’s intentionally simple contract, require all reachable fetch returns to be the direct/awaited proxy call or the same top-level binding assigned from it; reject shadowed bindings and any nondelegating return. Add both fixtures as negative tests while keeping the current direct and top-level assigned forms positive.

Evidence

  • Exact 3-file delta inspected; git diff --check clean.
  • Focused page-coverage suite: 22/22 passed.
  • Generator freshness and lat check: passed; worktree remained clean.
  • Current Team Memory mounts/chains, OG equality/regex/fallback, cron triggers, and current PostHog assigned return reconcile without false positives.
  • Prior CodeRabbit threads remain resolved; no new inline thread was present when inspected.
  • Current GitHub delta checks were still running; completed lint/Crew/GitGuardian/Git Town checks were green.

Recommendation: changes requested until these source forms fail closed.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

@zacjones93 Thanks for the detailed write-up on the fixes. I'll run a delta review of fae7b83 now to verify the pathname alias/inline predicate tracking and the stricter PostHog delegation checks (no shadowed bindings, all reachable returns delegating).

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@zacjones93

Copy link
Copy Markdown
Contributor Author

Addressed the final delta findings from issuecomment-4938897198 in 13d3a89.

Tests-first evidence:

  • All four exact fixtures failed before the correction: indirect Worker predicate, inline pathname equality, shadowed PostHog response binding, and method-only partial delegation.
  • Focused page-coverage contract now passes 26/26.

Correction:

  • Worker discovery recognizes direct and inline pathname expressions, follows pathname aliases and boolean predicate bindings, and audits remaining pathname-derived uses. Unsupported flow now fails instead of silently disappearing.
  • Service fetch discovery is tied to the actual default-exported object handler.
  • PostHog requires the named imported proxyRequest and a straight-line final return: either the direct call or one unique, unreassigned top-level binding initialized from it. Conditional control flow, shadowing, partial returns, and unsupported handler shapes fail closed.
  • LAT now states the conservative supported contract explicitly.

Validation:

  • focused contract: 26/26
  • full Start suite: 138 files, 2932 tests
  • page-coverage freshness: passed
  • Start type-check: passed
  • monorepo pre-push lint/type-check: passed (existing warnings only)
  • lat check: passed
  • git diff --check: passed

Requesting the final delta review of fae7b83..13d3a89. The parent remains open pending reviewer clearance.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

@zacjones93 Thanks for the thorough write-up and test evidence on the pathname alias tracking, inline predicate auditing, and the stricter PostHog straight-line delegation checks. I'll run a delta review of 13d3a89 now to verify the fail-closed behavior for the four fixtures (indirect Worker predicate, inline pathname equality, shadowed PostHog binding, and method-only partial delegation).

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@zacjones93

Copy link
Copy Markdown
Contributor Author

Final delta review of fae7b83ed..13d3a89ab — one remaining binding-identity gap

The four requested regressions are fixed: indirect/inline Worker predicates now reconcile, the shadowed response and partial PostHog returns fail, current sources reconcile, and the focused suite is 26/26. One closely related PostHog false positive remains.

[P1] A same-named call is still accepted without proving it is the real proxy import. hasNamedImport checks only the imported/local identifier text and ignores the module specifier (discovery.mjs:999-1012). The fetch audit rejects variable and parameter shadowing only (lines 1037-1043), while isNamedCall also resolves by text alone (lines 990-996). Consequently both exact fixtures below emit the wildcard surface instead of rejecting it:

import { proxyRequest } from "./unrelated"
export default { async fetch(request) { return proxyRequest(request) } }
import { proxyRequest } from "./proxy"
export default { async fetch(request) {
  function proxyRequest() { return new Response("local") }
  return proxyRequest(request)
} }

The second fixture is especially direct: the real import exists, but the returned call is definitely the local non-proxy function. This leaves the source-derived wildcard guarantee satisfiable by identifier spelling rather than binding identity.

For this intentionally conservative contract, require the named import to come from the canonical ./proxy module and reject every fetch-local declaration that binds proxyRequest (including function/class declarations and binding patterns), or resolve the call/import symbols through the TypeScript checker. Add both fixtures as negative tests.

Evidence

  • Exact 3-file delta inspected; git diff --check clean and worktree clean.
  • Worker probes: registered pathname alias chain accepted; missing alias surface rejected; reassigned predicate flow rejected as unsupported.
  • PostHog probes: both fixtures above were ACCEPTED; current straight-line assigned delegation remains accepted.
  • Focused contract: 26/26 passed.
  • Checked-in ledger freshness and lat check: passed.
  • All 14 GitHub checks are green; all four CodeRabbit threads are resolved and its latest delta review posted no new thread.

Recommendation: changes requested until the returned call is tied to the canonical import binding.

@zacjones93

Copy link
Copy Markdown
Contributor Author

Addressed the final binding-identity P1 from issuecomment-4939003365 in 0570c05.

Tests-first evidence:

  • The exact unrelated-module import and fetch-local function-shadow fixtures both failed before the correction.
  • Focused page-coverage contract now passes 28/28.

Correction:

  • proxyRequest must be a same-name named import from the canonical ./proxy module.
  • Fetch-local variables, parameters, destructuring bindings, functions, and classes that bind proxyRequest invalidate the proof.
  • The existing straight-line direct and uniquely bound assigned-return forms remain accepted.
  • LAT now records the unshadowed canonical-import requirement.

Validation:

  • focused contract: 28/28
  • full Start suite: 138 files, 2934 tests
  • page-coverage freshness: passed
  • Start type-check: passed
  • monorepo pre-push lint/type-check: passed (existing warnings only)
  • lat check: passed
  • git diff --check: passed

Requesting the final delta review of 13d3a89..0570c05. The parent remains open pending reviewer clearance.

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

@zacjones93 Thanks for the detailed write-up on the canonical-import binding fix and the negative-test evidence for both fixtures (unrelated-module import, fetch-local function shadow). I'll run a delta review of 0570c05 now to verify the named-import module-specifier check and the expanded shadow-binding rejection (variables, parameters, destructuring, functions, classes).

✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@zacjones93

Copy link
Copy Markdown
Contributor Author

Final-final delta review of 13d3a89ab..0570c0597 — LGTM

No findings. The binding-identity gap from the prior review is closed:

  • The exact unrelated-module import fixture now fails with PostHog proxy wildcard fetch delegation is missing.
  • The exact fetch-local function proxyRequest shadow fixture now fails with the same error.
  • Canonical ./proxy direct and top-level assigned/awaited returns remain accepted.
  • Additional adversarial probes for block-local variable shadowing, destructured shadowing, named function-expression shadowing, and named class-expression shadowing all fail closed.
  • The implementation now requires the canonical ./proxy named import and audits variable, parameter, binding-pattern, function, and class declarations before accepting the straight-line return.

Validation

  • Exact 3-file delta inspected; git diff --check clean and worktree clean.
  • Focused page-coverage contract: 28/28 passed.
  • Full Start suite: 138 files, 2934 tests passed.
  • Checked-in page-coverage ledger freshness: passed.
  • lat check: passed.
  • All 14 GitHub checks are green.
  • All four historical CodeRabbit threads remain resolved; its latest delta invocation has posted no new inline thread.

The source-derived page-coverage contract is clear to proceed from this review.

@zacjones93 zacjones93 closed this Jul 15, 2026
@zacjones93
zacjones93 merged commit d6316c1 into codex/ui-semantic-contrast Jul 15, 2026
53 of 224 checks passed
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.

1 participant