Skip to content

feat(extensions): expose authoritative review snapshots - #833

Open
benvinegar wants to merge 3 commits into
mainfrom
feat/extension-review-snapshots
Open

feat(extensions): expose authoritative review snapshots#833
benvinegar wants to merge 3 commits into
mainfrom
feat/extension-review-snapshots

Conversation

@benvinegar

@benvinegar benvinegar commented Aug 22, 2026

Copy link
Copy Markdown
Member

Summary

  • add extension API v8 ctx.review.snapshot() for deeply immutable, provider-neutral projections of the active ReviewStore
  • expose stable file identities, review generation/revision, and complete saved-note anchors including stale and orphaned notes
  • pair attached stores with their producer generation so reloads cannot expose retired state through snapshots or intents
  • add an installable JSON exporter with stale-work detection and create-only output
  • add an installable saved-note navigator that combines complete snapshots, selector dialogs, authoritative anchors, and guarded navigation
  • document the new capability and register its real projection in review conformance coverage

Compatibility

This is additive. Existing patch, source, selection, event, pane, file-view, and highlighting surfaces remain unchanged. Extensions that require snapshots can declare API v8; extensions targeting earlier API generations continue to load.

Testing

  • bun run test — 3023 passed, 10 platform skips
  • bun run test:integration — 121 passed
  • bun run typecheck
  • bun run lint
  • bun run deps:check
  • bun run check:pack
  • bun run check:docs
  • bun run changeset:status
  • independent reviewer pass with no remaining blocker, high, or medium findings

This PR description was generated by Pi using gpt-5.6-sol

@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
hunk-web Ready Ready Preview Aug 23, 2026 1:45am

Request Review

@greptile-apps

greptile-apps Bot commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds extension API v8 with deeply immutable, generation-aware snapshots of authoritative review files and saved notes.

  • Adds the public snapshot types, ReviewStore projection, and command-context controls.
  • Associates attached stores with producer generations to prevent retired state from serving snapshots or intents.
  • Adds an installable JSON exporter, documentation, conformance fixtures, and integration coverage.

Confidence Score: 4/5

The PR appears safe to merge, with only the non-blocking need to colocate the exporter helper unit test with its source module.

The generation-bound producer state, capability lease, immutable projection, and stale-work checks prevent the investigated runtime failures; the sole accepted concern is test organization.

Files Needing Attention: scripts/review-snapshot-export-extension.test.ts

Important Files Changed

Filename Overview
src/app/review/producer.ts Associates stores with publication generations and rejects retired state during reads and intent processing.
src/extensions/reviewSnapshot.ts Projects authoritative review state into copied and deeply frozen public file and note records.
src/extension-api/types.ts Introduces extension API v8 snapshot contracts without importing internal implementation types.
src/ui/App.tsx Adds generation-leased review snapshot controls to each extension command context.
examples/extensions/review-snapshot-export/index.ts Adds a create-only JSON exporter with generation and revision stale-work checks.
scripts/review-snapshot-export-extension.test.ts Covers exporter helpers but violates the repository requirement to colocate unit tests with their source.

Sequence Diagram

sequenceDiagram
    participant E as Extension command
    participant C as Review controls
    participant L as Capability lease
    participant P as ReviewProducer
    participant S as ReviewStore
    E->>C: snapshot()
    C->>L: isLive()
    alt lease expired or generation retired
        C-->>E: null
    else lease remains live
        C->>P: getPositionedReviewState()
        P->>S: getSnapshot()
        S-->>P: immutable state position
        P-->>C: generation + state
        C-->>E: frozen public projection
    end
Loading
Prompt To Fix All With AI
### Issue 1
scripts/review-snapshot-export-extension.test.ts:1-6
**Colocate the exporter unit test**

This unit test exercises helpers in `examples/extensions/review-snapshot-export/index.ts` but resides in the separate `scripts/` directory, making the implementation and its coverage easier to overlook or maintain independently. Move the test beside the extension source to follow the repository's unit-test colocation requirement.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Reviews (1): Last reviewed commit: "feat(extensions): expose authoritative r..." | Re-trigger Greptile

Comment on lines +1 to +6
import { describe, expect, test } from "bun:test";
import { resolve } from "node:path";
import {
resolveSnapshotExportPath,
snapshotPositionMatches,
} from "../examples/extensions/review-snapshot-export";

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.

P2 Colocate the exporter unit test

This unit test exercises helpers in examples/extensions/review-snapshot-export/index.ts but resides in the separate scripts/ directory, making the implementation and its coverage easier to overlook or maintain independently. Move the test beside the extension source to follow the repository's unit-test colocation requirement.

Rule Used: In the modem-dev/hunk repository, the test-colocat... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: scripts/review-snapshot-export-extension.test.ts
Line: 1-6

Comment:
**Colocate the exporter unit test**

This unit test exercises helpers in `examples/extensions/review-snapshot-export/index.ts` but resides in the separate `scripts/` directory, making the implementation and its coverage easier to overlook or maintain independently. Move the test beside the extension source to follow the repository's unit-test colocation requirement.

**Rule Used:** In the modem-dev/hunk repository, the test-colocat... ([source](https://app.greptile.com/modem/github/modem-dev/hunk/-/custom-context?memory=5990bfeb-29e6-49e1-9990-e93d64aaf4e1))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Moved the test beside the example implementation as examples/extensions/review-snapshot-export/index.test.ts and updated its relative imports. Targeted tests, typecheck, and lint pass. Fixed in 4c52518.

This comment was generated by Pi using gpt-5.6-sol

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