Skip to content

feat(review): role + setup foundation (PR 1 of 3)#1241

Open
peyton-alt wants to merge 8 commits into
mainfrom
review-review
Open

feat(review): role + setup foundation (PR 1 of 3)#1241
peyton-alt wants to merge 8 commits into
mainfrom
review-review

Conversation

@peyton-alt
Copy link
Copy Markdown
Contributor

@peyton-alt peyton-alt commented May 20, 2026

https://entire.io/gh/entireio/cli/trails/405

Summary

Foundation PR for the entire review redesign. Pure-additive: no behavior change to existing entire review for users on this PR alone. The cutover (drop legacy picker, add flags, inline prompts, live tokens) lands in PR 2.

  • Settings schemaRole enum (Reviewer / Fixer / Both / Skip) on ReviewConfig and a FixAfterReview mode on EntireSettings + ClonePreferences. Idempotent in-memory migration on settings.Load derives roles from the legacy ReviewFixAgent field (no auto-write; persisted lazily on next settings write).
  • HelpersNormalizeRoles (at-most-one-fixer with alphabetical winner), MigrateLegacyRoles, ReviewersOf, FixerOf, plus a public settings.Save(ctx, *EntireSettings).
  • New subcommand entire review setup — role-first picker (one inline Select per installed agent), then skills + optional instructions only for Reviewer/Both agents. Saves to .entire/settings.json with a display-label banner. Inline Validate refuses a second Fixer/Both pick so the at-most-one-fixer rule shows up immediately, not silently post-pick.

Why two PRs: foundation here is safe to land alone; the run-flow cutover (which deletes the legacy picker, adds --reviewers/--fixer flags, inline post-review fix prompt, recursion guard, invoker-aware fallback, live tokens) is a separate review surface.

Test plan

  • mise run check clean (fmt, lint, 58/58 unit + integration, 4/4 canary). Run post-merge with main.
  • Smoke tested in /tmp/smoke-test: build, entire enable --agent claude-code then add codex + gemini, entire review setup drives the role picker → skills picker → banner → .entire/settings.json persisted.
  • Verified entire review (no args) still hits the legacy picker untouched.
  • Verified in-memory migration is byte-for-byte non-destructive: dropped a legacy settings.json with review_fix_agent: codex, ran a command that calls settings.Load, confirmed sha256 unchanged.
  • Direct unit tests for MigrateLegacyRoles (nil, empty, idempotent, fix-agent-with-no-skills, preserves-existing-roles), NormalizeRoles, ReviewersOf, FixerOf, BuildPickRolesFields, RunSetup, PrintSetupBanner, BuildSetupSkillsFields, subcommand registration.

🤖 Generated with Claude Code


Note

Medium Risk
Introduces new persisted settings fields and an in-memory migration on settings.Load, plus a new interactive review setup flow; while intended to be additive, schema/migration changes can subtly affect downstream settings consumers and review configuration behavior.

Overview
Adds role-based review configuration to settings by introducing settings.Role on ReviewConfig (Reviewer/Fixer/Both/Skip) and a new fix_after_review mode on both project settings and clone preferences.

Implements an idempotent, in-memory legacy migration (settings.MigrateLegacyRoles) run during settings.Load to derive roles from review_fix_agent without auto-writing files, plus helper utilities in review (NormalizeRoles, ReviewersOf, FixerOf).

Introduces a new entire review setup subcommand that walks users through a two-step TUI (pick per-agent roles with a one-fixer constraint, then pick skills/instructions for reviewer agents) and persists the resulting review map, including a post-setup banner; adds comprehensive unit tests for the new schema, migration, and setup flow.

Reviewed by Cursor Bugbot for commit 92f419f. Configure here.

peyton-alt and others added 5 commits May 19, 2026 12:11
Entire-Checkpoint: 0c902d094d5c
Adds Role enum (Reviewer/Fixer/Both/Skip) to ReviewConfig and a
FixAfterReview mode to EntireSettings + ClonePreferences. Provides
NormalizeRoles / MigrateLegacyRoles / ReviewersOf / FixerOf helpers
and runs an idempotent in-memory migration on settings.Load that
derives roles from the legacy ReviewFixAgent field. The schema is
persisted lazily — the next code path that writes settings (e.g.,
`entire review setup`) writes the migrated form.

Foundation for the entire review redesign — no behavior change yet
for users running entire review.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 5ecddc347c0f
Two-step picker: pick a role per installed agent
(Reviewer/Fixer/Both/Skip), then pick skills only for Reviewer/Both
agents. At-most-one-fixer is enforced via NormalizeRoles. The
"Additional instructions" widget uses huh.NewInput so plain Enter
submits — no modifier key needed on any platform.

The legacy in-flow picker on `entire review` is unchanged in this
commit; Chunk 3 replaces it with a `Run: entire review setup`
pointer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: 4efdb600636d
@peyton-alt peyton-alt requested a review from a team as a code owner May 20, 2026 22:36
Copilot AI review requested due to automatic review settings May 20, 2026 22:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Foundation work for the upcoming entire review redesign: introduces role-based review configuration (Reviewer/Fixer/Both/Skip), in-memory migration from legacy config, and a new entire review setup subcommand to capture roles + skills, while keeping the existing entire review flow unchanged in this PR.

Changes:

  • Add Role + FixAfterReview settings schema (project + clone preferences) and in-memory legacy migration on settings.Load.
  • Add entire review setup two-step interactive flow (pick roles per installed agent, then skills/instructions for reviewer-side agents) and a post-setup banner.
  • Add role helpers (NormalizeRoles, ReviewersOf, FixerOf) plus comprehensive unit tests for migration/setup/roles.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
t1.txt Adds a new text file (appears unrelated to the feature).
cmd/entire/cli/settings/settings.go Adds Role, FixAfterReview settings fields, applies clone pref override, and triggers in-memory legacy role migration during load.
cmd/entire/cli/settings/settings_test.go Adds tests for Role.Valid and settings JSON round-tripping with roles/modes.
cmd/entire/cli/settings/migration.go Implements MigrateLegacyRoles to upgrade legacy review configs in-memory.
cmd/entire/cli/settings/migration_test.go Adds tests ensuring migration is in-memory only and schema saves/loads as expected.
cmd/entire/cli/review/setup.go Implements entire review setup flow: role picker, skills picker, save, and banner output.
cmd/entire/cli/review/setup_test.go Adds tests for setup flow, field construction, banner output, and subcommand registration.
cmd/entire/cli/review/roles.go Adds role normalization and query helpers used by setup/run flows.
cmd/entire/cli/review/roles_test.go Adds tests for normalization behavior and helper outputs.
cmd/entire/cli/review/cmd.go Registers the new setup subcommand under entire review.
Comments suppressed due to low confidence (1)

cmd/entire/cli/settings/settings.go:742

  • The new fix_after_review setting is merged from JSON but never validated (unlike commit_linking). A hand-edited invalid value would silently load and could cause unexpected behavior later. Add validation during load/merge (e.g., allow only "" and "always") and return a clear error for invalid values.
	if err := mergeRawStringNonEmpty(raw, "fix_after_review", (*string)(&settings.FixAfterReview)); err != nil {
		return err
	}

Comment thread cmd/entire/cli/review/setup.go
Comment thread cmd/entire/cli/review/setup.go Outdated
Comment thread cmd/entire/cli/settings/settings.go
Comment thread t1.txt Outdated
Comment thread cmd/entire/cli/settings/settings.go
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 92f419f. Configure here.

Comment thread cmd/entire/cli/review/setup.go
Comment thread cmd/entire/cli/review/setup.go Outdated
Comment thread t1.txt Outdated
peyton-alt and others added 2 commits June 4, 2026 11:42
- Remove stray t1.txt CI-trigger artifact.
- review setup: persist only the review map to clone-local preferences
  (.git/entire/preferences.json) via SaveReviewConfig instead of saving
  the full merged settings object to .entire/settings.json. The old path
  promoted clone-local/local-override values — and, on a settings.Load
  error, an empty EntireSettings with Enabled=false — into the committed
  project file. SaveReviewConfig writes just the review keys and refuses
  to clobber a malformed preferences file. Updates the subcommand help to
  match. (Cursor High + Copilot)
- review setup: map context.Canceled to a SilentError so Ctrl+C during
  the role/skills form aborts quietly instead of printing
  "roles picker: ...: context canceled".
- fix_after_review: introduce a non-empty "ask" sentinel
  (FixAfterReviewAsk) so a clone-local preference can override a
  project-level "always" back to Ask. Empty string still means
  "no override / inherit". Add FixAfterReviewMode.Valid().
- settings.Load: validate review roles and fix_after_review after
  merge+migration, rejecting hand-edited values that would otherwise
  load silently with surprising behavior.
- Tests: invalid-role / invalid-mode rejection, clone "ask" overriding
  project "always", and setup persisting to clone-local (not project).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
# Conflicts:
#	cmd/entire/cli/settings/settings.go
#	cmd/entire/cli/settings/settings_test.go
@peyton-alt peyton-alt changed the title feat(review): role + setup foundation (PR 1 of 2) feat(review): role + setup foundation (PR 1 of 3) Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants