Skip to content

feat(lifecycle): strengthen governed state transitions#35

Merged
lucifer1004 merged 2 commits into
mainfrom
dev
Jul 15, 2026
Merged

feat(lifecycle): strengthen governed state transitions#35
lucifer1004 merged 2 commits into
mainfrom
dev

Conversation

@lucifer1004

@lucifer1004 lucifer1004 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Restart RFC phases on content amendments and migrate stored signatures. Allow unreleased work items to reopen, enforce ADR projection ownership, and add guarded latest-release undo while preserving release syntax.

Summary by CodeRabbit

  • New Features
    • Added guarded release undo to correct the newest local release when the expected version matches.
    • Enforced ADR “projection ownership” validation (including heading-conflict detection) during project checks and ADR acceptance.
    • Added ADR/RFC lifecycle refinements tied to amendment signature/content bumps.
    • Expanded lifecycle support for reopening unreleased, completed work items.
  • Bug Fixes
    • Improved release/work-item validation, conflict diagnostics, byte-for-byte preservation on failure, and changelog rendering consistency.
  • Documentation
    • Updated governance framework and RFC specs, plus CLI help and ADR guidance.

Restart RFC phases on content amendments and migrate stored signatures.
Allow unreleased work items to reopen, enforce ADR projection ownership,
and add guarded latest-release undo while preserving release syntax.
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58a17c99-f8cd-4dd3-81b8-5dd22e0c7fc2

📥 Commits

Reviewing files that changed from the base of the PR and between 4c2efcf and 8d2330d.

⛔ Files ignored due to path filters (3)
  • tests/snapshots/test_scan__scan_valid_adr_reference.snap is excluded by !**/*.snap
  • tests/snapshots/test_tags__check_accepts_registered_tag.snap is excluded by !**/*.snap
  • tests/snapshots/test_tags__check_rejects_unknown_tag.snap is excluded by !**/*.snap
📒 Files selected for processing (9)
  • CHANGELOG.md
  • gov/adr/ADR-0031-unified-artifact-edit-engine-with-ssot-and-format-adapters.toml
  • gov/adr/ADR-0034-use-toml-as-the-canonical-storage-format-for-all-governance-artifacts.toml
  • gov/adr/ADR-0049-adopt-read-only-cockpit-model-for-tui-v2.toml
  • gov/work/2026-07-15-address-pr-35-review-findings.toml
  • src/diagnostic/code/metadata.rs
  • src/diagnostic/code/mod.rs
  • src/ui/messages/artifact.rs
  • src/validate/mod.rs
🚧 Files skipped from review as they are similar to previous changes (5)
  • gov/adr/ADR-0034-use-toml-as-the-canonical-storage-format-for-all-governance-artifacts.toml
  • src/ui/messages/artifact.rs
  • CHANGELOG.md
  • src/validate/mod.rs
  • gov/adr/ADR-0031-unified-artifact-edit-engine-with-ssot-and-format-adapters.toml

📝 Walkthrough

Walkthrough

This PR adds ADR projection-ownership validation, expands RFC and Work Item lifecycle rules, introduces guarded latest-release undo support, updates CLI routing and diagnostics, adds schema migration for RFC signatures, and refreshes governance specifications, records, documentation, and regression tests.

Changes

Governance lifecycle and correction flows

Layer / File(s) Summary
ADR projection ownership
.claude/..., gov/rfc/..., src/validate/..., tests/...
Renderer-owned headings and structured alternatives are documented and validated with E0307; fenced-code headings and historical ADR compatibility are covered by tests.
RFC phase and signature lifecycle
docs/rfc/RFC-0000.md, gov/rfc/..., src/cmd/lifecycle/rfc.rs, src/signature/*, src/cmd/migrate/*
RFC amendments require content signatures, phase progression is gated by amendment state, and schema migration establishes content-only signature baselines.
Release membership and latest-release undo
gov/rfc/RFC-0002/*, src/cmd/lifecycle/release.rs, src/validate/releases.rs, tests/...release...
Release refs must identify unique done Work Items; release undo removes only the newest matching release and preserves state on failure.
Work Item reopening and lifecycle gates
gov/rfc/RFC-0000.md, gov/rfc/RFC-0001/*, src/cmd/move_.rs, src/validate/lifecycle/*, tests/test_move.rs
Unreleased done Work Items can return to active, release-referenced items remain done, timestamps are updated accordingly, and loop artifacts remain unchanged.
CLI contracts and diagnostics
src/cli/*, src/command_router/*, src/diagnostic/*, src/cmd/lifecycle/*
Release creation and undo receive structured parsing, exclusive locking, help/catalog updates, dedicated diagnostics, and clearer lifecycle transition messages.
Governance records and documentation
CHANGELOG.md, docs/rfc/*, gov/adr/*, gov/work/*, gov/config.toml
Normative RFCs, ADRs, work records, project schema version, and changelogs are updated to reflect the new lifecycle and correction contracts.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Operator
  participant CommandRouter
  participant UndoRelease
  participant ReleasesFile
  participant WorkLifecycle
  Operator->>CommandRouter: govctl release undo <expected-version>
  CommandRouter->>UndoRelease: dispatch ReleaseUndo
  UndoRelease->>ReleasesFile: load and check newest version
  ReleasesFile-->>UndoRelease: release history
  UndoRelease->>ReleasesFile: remove newest entry or delete empty file
  UndoRelease-->>Operator: undo result and changelog hint
  Operator->>WorkLifecycle: reopen previously released Work Item
  WorkLifecycle->>ReleasesFile: check release references
  ReleasesFile-->>WorkLifecycle: item is unreleased
  WorkLifecycle-->>Operator: Work Item becomes active
Loading

Possibly related PRs

  • govctl-org/govctl#10: Both changes extend ADR acceptance validation around structural and completeness checks.
  • govctl-org/govctl#32: Both changes modify RFC clause supersession transition validation and diagnostics.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately summarizes the PR’s main focus on strengthening governed lifecycle transitions.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/validate/mod.rs (1)

90-98: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Fix the diagnostic code for placeholder context.

It appears there is a copy-paste error here. The diagnostic for placeholder context is reusing DiagnosticCode::W0103AdrNoRefs from the check above it. Please update it to the appropriate diagnostic code for placeholder context.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/validate/mod.rs` around lines 90 - 98, Update the diagnostic code used in
the placeholder-context check within the validation logic to the dedicated code
for missing or placeholder context, rather than W0103AdrNoRefs. Keep the
existing message, condition, and diagnostic path unchanged.
gov/adr/ADR-0034-use-toml-as-the-canonical-storage-format-for-all-governance-artifacts.toml (1)

44-53: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Remove implementation plans from ADRs.

As per the coding guidelines, ADRs must explain design choices and consequences, and must not be turned into mini-RFCs or implementation plans. These files contain explicit implementation steps, phase rollouts, and task tracking criteria, which violate this rule.

  • gov/adr/ADR-0034-use-toml-as-the-canonical-storage-format-for-all-governance-artifacts.toml#L44-L53: Remove the Implementation Notes section to comply with the ADR guidelines.
  • gov/adr/ADR-0049-adopt-read-only-cockpit-model-for-tui-v2.toml#L36-L41: Remove the Implementation Notes section to comply with the ADR guidelines.
  • gov/adr/ADR-0031-unified-artifact-edit-engine-with-ssot-and-format-adapters.toml#L75-L87: Remove the Migration Plan and Completion Criteria sections as they act as a step-by-step implementation plan.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@gov/adr/ADR-0034-use-toml-as-the-canonical-storage-format-for-all-governance-artifacts.toml`
around lines 44 - 53, Remove the implementation-plan sections from all three
ADRs: delete the “Implementation Notes” section in
gov/adr/ADR-0034-use-toml-as-the-canonical-storage-format-for-all-governance-artifacts.toml
(lines 44-53) and gov/adr/ADR-0049-adopt-read-only-cockpit-model-for-tui-v2.toml
(lines 36-41), and delete the “Migration Plan” and “Completion Criteria”
sections in
gov/adr/ADR-0031-unified-artifact-edit-engine-with-ssot-and-format-adapters.toml
(lines 75-87), preserving the ADR decision and consequence content.

Source: Coding guidelines

🧹 Nitpick comments (1)
src/ui/messages/artifact.rs (1)

166-180: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Omit unnecessary .to_string() allocation.

Since owo-colors implements its styling traits for any type that implements Display, you can call .green() directly on the usize value and avoid the intermediate string allocation.

♻️ Proposed refactor
-            work_item_count.to_string().green()
+            work_item_count.green()

(Note: The same optimization can also be applied to release_created on line 157 outside this change block.)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/ui/messages/artifact.rs` around lines 166 - 180, Update release_undone to
call green() directly on the work_item_count usize instead of converting it with
to_string(), preserving the existing colored output. Apply the same
allocation-free styling to the work-item count in release_created as well.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/validate/lifecycle/tests.rs`:
- Around line 200-205: Add the #[test] attribute directly above
test_work_status_done_to_active so the test runner discovers and executes this
transition test.

---

Outside diff comments:
In
`@gov/adr/ADR-0034-use-toml-as-the-canonical-storage-format-for-all-governance-artifacts.toml`:
- Around line 44-53: Remove the implementation-plan sections from all three
ADRs: delete the “Implementation Notes” section in
gov/adr/ADR-0034-use-toml-as-the-canonical-storage-format-for-all-governance-artifacts.toml
(lines 44-53) and gov/adr/ADR-0049-adopt-read-only-cockpit-model-for-tui-v2.toml
(lines 36-41), and delete the “Migration Plan” and “Completion Criteria”
sections in
gov/adr/ADR-0031-unified-artifact-edit-engine-with-ssot-and-format-adapters.toml
(lines 75-87), preserving the ADR decision and consequence content.

In `@src/validate/mod.rs`:
- Around line 90-98: Update the diagnostic code used in the placeholder-context
check within the validation logic to the dedicated code for missing or
placeholder context, rather than W0103AdrNoRefs. Keep the existing message,
condition, and diagnostic path unchanged.

---

Nitpick comments:
In `@src/ui/messages/artifact.rs`:
- Around line 166-180: Update release_undone to call green() directly on the
work_item_count usize instead of converting it with to_string(), preserving the
existing colored output. Apply the same allocation-free styling to the work-item
count in release_created as well.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f6688dca-0b92-4e7d-944d-9083fa9dfb6d

📥 Commits

Reviewing files that changed from the base of the PR and between 93f2b16 and 4c2efcf.

⛔ Files ignored due to path filters (24)
  • tests/snapshots/test_changelog__changelog_errors.snap is excluded by !**/*.snap
  • tests/snapshots/test_changelog__changelog_render.snap is excluded by !**/*.snap
  • tests/snapshots/test_changelog__changelog_setup.snap is excluded by !**/*.snap
  • tests/snapshots/test_describe__describe_basic.snap is excluded by !**/*.snap
  • tests/snapshots/test_describe__describe_in_initialized_project.snap is excluded by !**/*.snap
  • tests/snapshots/test_describe__describe_with_context_active_work_item.snap is excluded by !**/*.snap
  • tests/snapshots/test_describe__describe_with_context_draft_rfc.snap is excluded by !**/*.snap
  • tests/snapshots/test_describe__describe_with_context_empty_project.snap is excluded by !**/*.snap
  • tests/snapshots/test_describe__describe_with_context_normative_impl_phase_rfc.snap is excluded by !**/*.snap
  • tests/snapshots/test_describe__describe_with_context_normative_spec_phase_rfc.snap is excluded by !**/*.snap
  • tests/snapshots/test_describe__describe_with_context_normative_test_phase_rfc.snap is excluded by !**/*.snap
  • tests/snapshots/test_describe__describe_with_context_proposed_adr.snap is excluded by !**/*.snap
  • tests/snapshots/test_describe__describe_with_context_queued_work_items.snap is excluded by !**/*.snap
  • tests/snapshots/test_help__rfc_root_help.snap is excluded by !**/*.snap
  • tests/snapshots/test_lifecycle__accept_already_accepted_fails.snap is excluded by !**/*.snap
  • tests/snapshots/test_lifecycle__accept_rejected_adr_fails.snap is excluded by !**/*.snap
  • tests/snapshots/test_lifecycle__advance_backwards_fails.snap is excluded by !**/*.snap
  • tests/snapshots/test_lifecycle__advance_draft_to_impl_fails.snap is excluded by !**/*.snap
  • tests/snapshots/test_lifecycle__advance_skip_phase_fails.snap is excluded by !**/*.snap
  • tests/snapshots/test_lifecycle__deprecate_clause_already_deprecated_fails.snap is excluded by !**/*.snap
  • tests/snapshots/test_lifecycle__deprecate_clause_superseded_fails.snap is excluded by !**/*.snap
  • tests/snapshots/test_lifecycle__finalize_already_normative_fails.snap is excluded by !**/*.snap
  • tests/snapshots/test_lifecycle__finalize_draft_to_deprecated.snap is excluded by !**/*.snap
  • tests/snapshots/test_lifecycle__finalize_normative_to_deprecated.snap is excluded by !**/*.snap
📒 Files selected for processing (97)
  • .claude/agents/adr-reviewer.md
  • .claude/skills/adr-writer/SKILL.md
  • CHANGELOG.md
  • docs/rfc/RFC-0000.md
  • docs/rfc/RFC-0001.md
  • docs/rfc/RFC-0002.md
  • docs/rfc/RFC-0006.md
  • docs/rfc/RFC-0007.md
  • gov/adr/ADR-0021-resource-scoped-render-commands-for-single-item-rendering.toml
  • gov/adr/ADR-0029-path-based-nested-field-addressing-for-artifact-edits.toml
  • gov/adr/ADR-0030-parser-strategy-for-path-based-field-expressions.toml
  • gov/adr/ADR-0031-unified-artifact-edit-engine-with-ssot-and-format-adapters.toml
  • gov/adr/ADR-0034-use-toml-as-the-canonical-storage-format-for-all-governance-artifacts.toml
  • gov/adr/ADR-0037-canonical-edit-surface-for-nested-artifact-mutation.toml
  • gov/adr/ADR-0038-keep-adr-schema-discussion-oriented-and-avoid-broad-migration.toml
  • gov/adr/ADR-0040-controlled-vocabulary-tags-for-governance-artifacts.toml
  • gov/adr/ADR-0049-adopt-read-only-cockpit-model-for-tui-v2.toml
  • gov/adr/ADR-0050-preserve-direct-clause-supersession-chains.toml
  • gov/adr/ADR-0051-scope-terminal-lifecycle-states-to-revision-and-release-boundaries.toml
  • gov/adr/ADR-0052-assign-adr-projection-structure-to-canonical-authoring-surfaces.toml
  • gov/adr/ADR-0053-use-guarded-latest-only-undo-for-local-release-cuts.toml
  • gov/config.toml
  • gov/rfc/RFC-0000/clauses/C-ADR-PROJECTION-OWNERSHIP.toml
  • gov/rfc/RFC-0000/clauses/C-PHASE-LIFECYCLE.toml
  • gov/rfc/RFC-0000/clauses/C-RELEASE-DEF.toml
  • gov/rfc/RFC-0000/clauses/C-SUMMARY.toml
  • gov/rfc/RFC-0000/clauses/C-WORK-DEF.toml
  • gov/rfc/RFC-0000/rfc.toml
  • gov/rfc/RFC-0001/clauses/C-RFC-PHASE.toml
  • gov/rfc/RFC-0001/clauses/C-WORK-STATUS.toml
  • gov/rfc/RFC-0001/rfc.toml
  • gov/rfc/RFC-0002/clauses/C-CRUD-VERBS.toml
  • gov/rfc/RFC-0002/clauses/C-GLOBAL-COMMANDS.toml
  • gov/rfc/RFC-0002/clauses/C-LIFECYCLE-VERBS.toml
  • gov/rfc/RFC-0002/clauses/C-RESOURCE-MODEL.toml
  • gov/rfc/RFC-0002/clauses/C-RESOURCES.toml
  • gov/rfc/RFC-0002/rfc.toml
  • gov/rfc/RFC-0003/rfc.toml
  • gov/rfc/RFC-0004/rfc.toml
  • gov/rfc/RFC-0006/rfc.toml
  • gov/rfc/RFC-0007/rfc.toml
  • gov/schema/release.schema.json
  • gov/schema/work.schema.json
  • gov/work/2026-07-15-enforce-adr-projection-ownership.toml
  • gov/work/2026-07-15-reopen-unreleased-completed-work-items.toml
  • gov/work/2026-07-15-resolve-lifecycle-compliance-audit-gaps.toml
  • gov/work/2026-07-15-restart-rfc-phase-lifecycle-on-content-bumps.toml
  • gov/work/2026-07-15-support-undoing-the-latest-release-cut.toml
  • src/cli/commands.rs
  • src/cli/common/targets.rs
  • src/cli/help.rs
  • src/cli/mod.rs
  • src/cli/resources/rfc.rs
  • src/cmd/describe/catalog.rs
  • src/cmd/lifecycle/adr.rs
  • src/cmd/lifecycle/clause.rs
  • src/cmd/lifecycle/mod.rs
  • src/cmd/lifecycle/release.rs
  • src/cmd/lifecycle/rfc.rs
  • src/cmd/lifecycle/rfc_supersede.rs
  • src/cmd/migrate/mod.rs
  • src/cmd/migrate/rfc_signatures.rs
  • src/cmd/move_.rs
  • src/command_router/execute/builtin.rs
  • src/command_router/parsed.rs
  • src/command_router/plan.rs
  • src/command_router/tests/help.rs
  • src/command_router/tests/lock_disposition.rs
  • src/command_router/tests/mod.rs
  • src/command_router/tests/routing.rs
  • src/diagnostic/code/metadata.rs
  • src/diagnostic/code/mod.rs
  • src/model/release.rs
  • src/parse/toml_io.rs
  • src/signature/mod.rs
  • src/signature/tests.rs
  • src/ui/messages/artifact.rs
  • src/validate/adr_projection.rs
  • src/validate/lifecycle/mod.rs
  • src/validate/lifecycle/tests.rs
  • src/validate/mod.rs
  • src/validate/releases.rs
  • tests/adr_gate_tests/accept.rs
  • tests/changelog_tests/release_workflow.rs
  • tests/error_tests/adr_projection.rs
  • tests/error_tests/mod.rs
  • tests/error_tests/release.rs
  • tests/lifecycle_tests/adr.rs
  • tests/lifecycle_tests/clause.rs
  • tests/lifecycle_tests/rfc_cases/advance.rs
  • tests/lifecycle_tests/rfc_cases/bump.rs
  • tests/lifecycle_tests/rfc_cases/deprecation.rs
  • tests/lifecycle_tests/rfc_cases/finalize.rs
  • tests/lock_tests/concurrency.rs
  • tests/test_lock.rs
  • tests/test_migrate.rs
  • tests/test_move.rs
💤 Files with no reviewable changes (3)
  • src/cli/common/targets.rs
  • src/model/release.rs
  • gov/adr/ADR-0021-resource-scoped-render-commands-for-single-item-rendering.toml

Comment on lines +200 to +205
fn test_work_status_done_to_active() {
assert!(is_valid_work_transition(
WorkItemStatus::Done,
WorkItemStatus::Active
));
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add missing #[test] attribute.

The test_work_status_done_to_active function is missing the #[test] attribute, meaning it will be completely ignored by the test runner.

🐛 Proposed fix
+#[test]
 fn test_work_status_done_to_active() {
     assert!(is_valid_work_transition(
         WorkItemStatus::Done,
         WorkItemStatus::Active
     ));
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
fn test_work_status_done_to_active() {
assert!(is_valid_work_transition(
WorkItemStatus::Done,
WorkItemStatus::Active
));
}
#[test]
fn test_work_status_done_to_active() {
assert!(is_valid_work_transition(
WorkItemStatus::Done,
WorkItemStatus::Active
));
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/validate/lifecycle/tests.rs` around lines 200 - 205, Add the #[test]
attribute directly above test_work_status_done_to_active so the test runner
discovers and executes this transition test.

@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

@lucifer1004
lucifer1004 merged commit 73d2d82 into main Jul 15, 2026
8 checks passed
@lucifer1004
lucifer1004 deleted the dev branch July 15, 2026 16:17
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