Skip to content

refactor(review): move review policy behind VCS providers - #1499

Open
graemefolk wants to merge 1 commit into
backnotprop:mainfrom
graemefolk:refactor/vcs-review-policies
Open

refactor(review): move review policy behind VCS providers#1499
graemefolk wants to merge 1 commit into
backnotprop:mainfrom
graemefolk:refactor/vcs-review-policies

Conversation

@graemefolk

@graemefolk graemefolk commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Code review started as a Git-only feature, so assumptions about Git gradually spread into shared configuration, command parsing, startup, and UI code. As support for Jujutsu, GitButler, and Perforce was added, those shared modules also began listing each provider's diff modes and deciding what their options meant.

That made the architecture harder to extend safely. Adding or changing a provider could require edits across several unrelated parts of the application, and a generic code path could accidentally apply Git behavior to another version-control system.

This refactor gives each version-control provider responsibility for its own review behavior. Shared code now asks the selected provider how to interpret a diff mode instead of maintaining a central list of provider-specific rules.

What changed

  • Added a review policy for each built-in version-control provider.
  • Moved ownership of diff modes, default selection, base handling, and command-line validation into those policies.
  • Changed command parsing to preserve provider-specific diff mode names until the active provider can validate them.
  • Moved compatibility with the existing Git default into the Git policy rather than keeping a Git exception in shared configuration code.
  • Added provider-scoped storage for review defaults without changing a user's saved settings merely by opening a review.
  • Updated both the Bun and Pi implementations, including Pi's vendored sources, to use the same provider behavior.
  • Added tests around provider selection, defaults, command-line options, legacy Git settings, and Bun/Pi parity.

Existing Git, Jujutsu, GitButler, and Perforce review behavior remains unchanged. The practical improvement is that future provider-specific settings and diff modes can be added in the provider that owns them, without teaching the rest of the application about that provider.

Validation

  • Shared configuration, review policy, open-state, and VCS tests
  • Pi extension parity tests
  • Server and Pi TypeScript checks
  • Review and hook production builds
  • Guided Review viewer manifest check
  • Browser verification in Vivaldi for Jujutsu and Git review sessions

Related work

Draft PR #1500 adds the Jujutsu-specific review settings that this structure is intended to support. It currently includes this refactor in its GitHub diff and will be rebased onto main after this PR lands.

@graemefolk
graemefolk force-pushed the refactor/vcs-review-policies branch from 4db9c61 to 78707af Compare September 10, 2026 18:44
chore: sync guide viewer manifest

fix(review): validate provider diff ids before narrowing
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