Skip to content

[CR-1][P1] Establish the Code Review reference contract and deterministic fixtures #320

Closed

Description

@BunsDev

Outcome

Produce the reviewed, executable contract that lets the remaining Code Review issues work against the same PR identity, revision, states and four screenshot references. Parent: #319. This slice is contract/fixture work, not a new app scaffold or a static mockup presented as production.

Context and entry points

Audit baseline: TypeSafeAI/modex main cb33db5df00e235f68d36b5fac556dc30e0851f2; refresh it before work. Read #319 for R1–R4, source links, primary research and the research-access limitation. Read AGENTS.md, apps/desktop/package.json, apps/desktop/src/renderer/components/ChangesPanel.tsx, apps/desktop/src/main/engine/git.ts, docs/status.md, and #273. The existing Changes panel reads local working-tree diffs and offers Discard; it must not become a remote-PR filesystem capability.

Product gate: record Val's confirmation that the reconstruction belongs in Modex desktop, not TypeSafe Place or TypeSafe Computer. Proposed placement is not prior approval. Read-only inspection and synthetic contract preparation are permitted before that decision; do not wire a production feature until it is resolved.

Dependencies / ownership

No new-issue prerequisite; #319 is the parent, not a blocker. Produces the shared contract for CR-2/3 and test fixtures for CR-8. One owner owns shared type/IPC changes; consumers must not independently invent incompatible types. Existing #273 contracts are reuse references, not a reason to wait for the whole tracker to close.

Proposed files and interfaces

Confirm placement against the current tree before creating files; these are proposed additions, not verified existing paths:

  • apps/desktop/src/shared/code-review.ts: serializable read models and capabilities.
  • apps/desktop/test/fixtures/code-review.ts: synthetic reference data and fault cases.
  • apps/desktop/test/code-review-contract.test.ts: contract and fixture tests.
  • docs/design/code-review.md: one concise reference/state/ownership contract, with a durable reference manifest or approved asset locations.

Contract decisions to make concrete in that module:

  • PrLocator: supported host, owner, repository name and positive PR number. Initial host is github.com; arbitrary hosts/URLs are not transport endpoints.
  • PrKey: authenticated account ID, host, resolved stable repository ID and PR number. Display names do not authorize access.
  • PrRevision: base branch/ref, base SHA and head SHA. Every diff and AI result binds to a revision; mutable overview fields additionally carry a fetch time.
  • ReadResult<T>: ready/stale/partial/unavailable with payload when appropriate, reason, fetchedAt and pagination/truncation metadata. An unavailable collection is not an empty collection; pending/unknown checks are not passing.
  • Explicit feature capabilities for reads, AI review and each write, with reasons when unavailable. Renderer requests are data-only; cancellation uses a request ID rather than sending an AbortSignal over IPC.

Items to do

  • Reconcile current code/open PRs with [Tracker][CR] Reconstruct the screenshot Code Review workspace end to end #319; identify the actual shell route, theme tokens, bridge/IPC registration, GitHub identity owner, safe Markdown renderer and test fixtures. Record exact existing paths, not guesses. Update downstream entry-point notes if they differ.
  • Inventory every visible control in R1–R4 and classify it as existing/reused, planned in a named child, native chrome, or deliberately unavailable with a reason. Include pin/copy/open-GitHub actions, keyboard navigation, split view, file filtering, popover and both composers.
  • Calibrate screenshot crop/DPR versus CSS geometry before establishing visual targets. Measure major panel boundaries, typography/spacing hierarchy and independent scroll regions. Preserve current Modex tokens; any new token or visible deviation needs an explicit proposal.
  • Record original filename, dimensions, checksum, provenance and storage/access path. Do not publish private screenshots. Missing approved references block a fidelity claim, not unrelated contract work. Build synthetic data matching text density instead of copying unrelated PR/account content.
  • Write failing contract tests, then the minimal shared model and fixtures: R1–R4, empty inbox, unauthenticated, denied, pagination, pending/failed/unknown checks, truncated diff, head change and offline cached data. Keep deterministic timestamps and ordering; no network, model or filesystem mutation in fixtures.
  • Define the narrow read-service operations consumed downstream: list/search PRs, resolve a locator, fetch overview/activity/checks, list files and fetch revision-bound patch/context. Keep remote reads and local Changes APIs separate.
  • Record explicit scope/architecture decisions and obtain review before consumers implement them. Existing shared types may be reused rather than introducing the proposed module when that is smaller.

Acceptance criteria

  • AC1: a second engineer can map every R1–R4 region/control to an owner and test without needing this chat.
  • AC2: fixture tests distinguish two accounts, two repositories with the same PR number, old/new revisions, empty versus unavailable data, and partial versus complete diff coverage.
  • AC3: fixture execution performs zero live GitHub/model requests and zero worktree changes.
  • AC4: source map identifies real extension points; repository placement and significant visual deviations have recorded decisions.
  • AC5: the contract and fixture tests pass; downstream issues link the accepted artifact SHA. No application parity or provider support is claimed from these fixtures.

Validation and handoff

Use repository pnpm instructions. Run pnpm build && pnpm test; document environmental failures. Target the new contract test using the actual compiled path confirmed by the build. UI wiring, if any is approved, also requires pnpm test:e2e. Record contract SHA, source map, reference availability and exact results in the PR and a short checkpoint. Do not merge or release.

Long-running goal prompt

Implement CR-1 in TypeSafeAI/modex as the smallest reviewed contract-and-fixture slice for #319. Read the live issue, parent, AGENTS.md, source and open PRs first. Verify main and worktree ownership; never edit primary checkout. Resolve the recorded product-placement gate before feature wiring. Inspect the actual shell, GitHub identity and bridge rather than guessing their filenames. Make one shared revision/account-scoped read contract and deterministic R1–R4 fixtures, reusing existing types when appropriate. Write failing tests first, implement minimally, and record what each screenshot control really requires. Keep local Changes/discard entirely separate from remote data. Do not publish unapproved screenshots, invent the missing research report, migrate frameworks, add a new agent runtime or call live providers. Produce an accepted source/reference map, passing contract tests and a reviewable signed PR. At each checkpoint record branch/full SHA, decisions, tests/evidence, unresolved gates and one next action. Stop when authorization or a required reference/decision is absent; do not treat a plan or fixture as a shipped feature.

Follow-up / resume prompt

Resume CR-1 by rereading #319 and this issue's latest decisions and PR. Verify the owned worktree, current main and actual diff; rerun the contract smoke test. Determine which source mappings, reference assets and decisions were truly accepted. Continue only the smallest missing contract/fixture acceptance item. Never replace missing screenshot evidence with generated look-alikes or rewrite a consumer's accepted contract silently. Update the checkpoint and downstream artifact link with the exact SHA and test results. Leave unresolved placement/reference approvals visible; do not merge.

Independent review prompt

Review CR-1 against R1–R4 and current source, not the implementer's summary. Check identity/revision separation, unavailable versus empty data, control coverage, reference privacy and whether proposed paths/capabilities are being misrepresented as existing. Reject unnecessary new infrastructure and unsupported parity claims. Report acceptance IDs, evidence and concrete blockers; do not modify or approve unrelated work.

Activity

  1. added
    enhancement
    on Oct 19, 2026
  2. BunsDev commented on Oct 19, 2026

    @BunsDev
    ContributorAuthor

    Decisions from Val, 2026-10-19

    Val confirmed these in a planning session today. They settle this issue's product gate, so Gate A (#320–#324) can start wiring.

    1. Placement: Modex desktop. The Code Review workspace goes in apps/desktop, inside the existing shell. It does not go in River Oaks, TypeSafe Place or TypeSafe Computer. The River Oaks PRs in the screenshots are only the content being reviewed.

    2. References R1–R4 stay out of the repository. They are on Val's Mac:

      ID File Pixels on disk
      R1 ~/Desktop/Screenshot 2026-10-18 at 15.38.42.png 1766×1057
      R2 ~/Desktop/Screenshot 2026-10-18 at 15.38.52.png 3536×2102
      R3 ~/Desktop/Screenshot 2026-10-18 at 15.38.55.png 3538×2098
      R4 ~/Desktop/Screenshot 2026-10-18 at 15.40.30.png 3528×2094

      Do not commit them, or what they show (real PR text, names, avatars). Fixtures stay synthetic. The session found these paths by file name and checked R1 by eye. The Desktop is not a permanent home, so update this comment if the files move.

      R1 matches [Tracker][CR] Reconstruct the screenshot Code Review workspace end to end #319's table. R2–R4 on disk are about 1.73× the sizes [Tracker][CR] Reconstruct the screenshot Code Review workspace end to end #319 lists, at the same aspect ratio, so [Tracker][CR] Reconstruct the screenshot Code Review workspace end to end #319's audit probably measured 2048-wide copies. Calibrate [CR-8][P1] Verify Code Review fidelity, accessibility, recovery and end-to-end safety #327's crop and scale against these originals. Neither set of numbers is a CSS viewport or DPR measurement.

    3. GitHub reads use the user's gh CLI login. CR-2 ([CR-2][P1] Add a main-owned, revision-aware GitHub PR read service #321) reuses the path thread-context.ts already takes for a checkout's PR context: github.com remotes only, fixed endpoints, gh api … --hostname github.com --method GET. No new sign-in, no GitHub App, and Modex stores no token. This covers reads only. Writes ([CR-7][P1] Add explicit review actions and head-guarded GitHub merge #326) keep their own authorization gate, and the GitHub App item under docs/status.md's Next (acting on repositories) is unchanged.

    Coven-Harness: Claude Code / claude-opus-5-5

  3. self-assigned this
    on Oct 20, 2026
  4. BunsDev commented on Oct 22, 2026

    @BunsDev
    ContributorAuthor

    The R1–R4 reference screenshots are gone (Val confirmed on 2026-10-22). They are not at ~/Desktop, and Spotlight finds no file by those names. #372 updates the design page: the manifest (sizes, scale, SHA-256s, measured geometry) stays as the record of what they were, and fidelity checks measure against those numbers. Any re-capture needs its own row and checksums, and must not be read as one of the originals.

    Coven-Harness: Claude Code / claude-opus-5-5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions