Skip to content

Review policy is Harbor's: rules and versions, rounds with their checks, and the pages (0.25.0) - #30

Merged
adamfortuna merged 1 commit into
mainfrom
review-policy
Nov 15, 2026
Merged

adamfortuna merged 1 commit into
mainfrom
review-policy

Conversation

@adamfortuna

Copy link
Copy Markdown
Contributor

Review policy moves into Harbor: the records, what a rule may say, and the pages. Harbor does not run reviews yet; the host's own flow writes rounds into these records and the pages show them.

What Harbor owns now

  • Records, on the review_* tables (one migration, every table, index and foreign key created only when missing): Harbor::ReviewRule and Harbor::ReviewRuleVersion (every save a version, roll back as a new version), Harbor::ReviewRound and Harbor::ReviewCheckRun, Harbor::ReviewFeedback and Harbor::ReviewEscape.
  • A rule's definition: Harbor::Reviews::RuleDefinition per kind (risk, check, sign-off), Harbor::Reviews::Condition (check and describe a condition) and Harbor::Reviews::Glob.
  • A round as a document: Harbor::Reviews::Document with Progress and the round's title.
  • Pages under Harbor.path, gated by page_reviews: the policy (/factory/reviews), a rule's page and form with versions and roll back, a round with its checks (and .json), and the dashboard. The menu entry is the engine's own route.

What a host supplies (all optional)

  • Harbor::Reviews.detector and Harbor::Reviews.finding_category.
  • config.review_rule_class, config.review_rule_version_class, config.review_document_schema, config.review_pull_request_url, config.review_rule_preview (+ review_rule_preview_sample), config.review_cost.
  • Partials: harbor/reviews/_round_review, harbor/shared/_quality_guide.
  • Every saved rule version is handed to config.export.

With none of it set: no Preview buttons, pull requests are named but not linked, the dashboard has no "Code review" tile, and the document's schema is harbor.review/v1.

Notes for rebasing onto 0.23.0 and 0.24.0

  • This branch is based on 0.22.0 and bumps straight to 0.25.0; the CHANGELOG's "Upgrading from 0.24" assumes it lands after Workflows.
  • Harbor::Reviews::Condition is the validate/describe half of the workflow condition language. Once Workflows is in, it can become a thin alias of that one.
  • The policy page renders harbor/shared/quality_guide when it exists. The Scorers and Proposals release adds that partial with the same locals, so the guide appears with no change here.
  • Shared files touched in small blocks: CHANGELOG.md, README.md (a "Review policy" section before "Webhooks", three lines under "Configuring"), lib/harbor/nav.rb (one entry gets scope: :harbor), lib/harbor/configuration.rb (one block), lib/harbor.rb, config/routes.rb (one block), test/dummy/db/schema.rb, and the menu assertions in test/section_test.rb, test/host_pages_test.rb and test/nav_test.rb.

Tests

test/review_policy_test.rb (records, definitions, the document, export, host classes) and test/review_pages_test.rb (a site with no code of its own writes a rule, edits it, sees and rolls back its versions, and sees a round with its checks; then each hook and partial).

…their checks, and the pages

Harbor::ReviewRule and Harbor::ReviewRuleVersion, Harbor::ReviewRound and
Harbor::ReviewCheckRun, Harbor::ReviewFeedback and Harbor::ReviewEscape are the
records, on the review_* tables (the migration creates each table, index and
foreign key when it is missing). Every save of a rule is a version; a rule is
rolled back by saving an earlier definition as the newest.

Harbor::Reviews::RuleDefinition checks what a rule says, per kind (risk, check,
sign-off), with Harbor::Reviews::Condition for its conditions and
Harbor::Reviews::Glob for its path globs. Harbor::Reviews::Document is a round
as one document, with its progress, cost and the line that says where it is.

Harbor::ReviewsController, ReviewRulesController, ReviewRoundsController and
ReviewDashboardsController serve /factory/reviews: the policy, a rule's page
and form with its versions, a round with its checks (and its .json), and the
dashboard. The menu's Review policy entry is the engine's own route.

A site with no code of its own writes and versions its rules on the page, and
sees a round with its checks once something records one. Harbor does not run
reviews yet: deciding which rules a pull request owes, running the checks and
publishing the result stay with the host, which writes rounds into these
records.

A host declares its own risk detectors and finding categories
(Harbor::Reviews), names its subclasses (review_rule_class,
review_rule_version_class) and its document's schema
(review_document_schema), says where pull requests are
(review_pull_request_url), previews a rule its own way (review_rule_preview,
review_rule_preview_sample) and says what the reviews cost (review_cost). It
adds to the pages with harbor/reviews/_round_review and
harbor/shared/_quality_guide. Every saved version goes to config.export.

0.25.0.
@adamfortuna
adamfortuna merged commit 2f6311e into main Nov 15, 2026
2 checks passed
@adamfortuna
adamfortuna deleted the review-policy branch November 15, 2026 00:11
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