Skip to content

fix(commit): step 17 enforces AI Reviewer Metadata + required body (#730)#965

Merged
RyderFreeman4Logos merged 1 commit intomainfrom
fix/730-commit-workflow-step17
Apr 20, 2026
Merged

fix(commit): step 17 enforces AI Reviewer Metadata + required body (#730)#965
RyderFreeman4Logos merged 1 commit intomainfrom
fix/730-commit-workflow-step17

Conversation

@RyderFreeman4Logos
Copy link
Copy Markdown
Owner

Summary

  • patterns/commit/workflow.toml step 17 previously fell back to an empty-body generator when ${COMMIT_BODY} was absent, and did not validate the mandatory ### AI Reviewer Metadata block documented in PATTERN.md step 14/15.
  • Step 17 now requires non-empty ${COMMIT_BODY} and validates the metadata marker, aborting with a clear message pointing at PATTERN.md.
  • PATTERN.md synced in the same commit per Rule 027 (pattern-workflow-sync).

Test plan

  • cargo test -p cli-sub-agent plan_cmd_tests_commit exit 0
  • New test covers empty-body + missing-marker + valid-body cases
  • just pre-commit exit 0

Closes #730.

🤖 Generated with Claude Code

)

Require commit workflow step 17 to consume an upstream AI-generated COMMIT_BODY
instead of synthesizing a fallback body, and fail fast when the required AI
Reviewer Metadata heading is missing. Keep PATTERN.md and workflow.toml in sync,
lock the behavior with a commit-pattern test, and bump the workspace patch
version to 0.1.450.

### AI Reviewer Metadata
- **Design Intent**: Preserve the documented audit trail by making step 17 reject missing upstream commit bodies and commit bodies that omit the required metadata block.
- **Key Decisions**: Removed the step-17 fallback call to `scripts/gen_commit_msg.sh --body`, added an explicit `### AI Reviewer Metadata` gate with PATTERN.md guidance in the error path, synchronized PATTERN/workflow wording, and extended the existing commit workflow test to lock the new contract.
- **Reviewer Guidance**:
  - **Timing/Race Scenarios**: none.
  - **Boundary Cases**: missing `COMMIT_BODY`; non-empty body that lacks `### AI Reviewer Metadata`; valid body that still includes the existing reviewer-guidance subfields.
  - **Regression Tests Added**: `plan_cmd::tests_commit::commit_reviewer_guidance_schema_requires_regression_tests_for_timing_scenarios`

Closes #730.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the workspace version to 0.1.450 and modifies the commit pattern and workflow to strictly require an upstream COMMIT_BODY containing an '### AI Reviewer Metadata' block, removing the previous fallback mechanism. Corresponding tests were added to verify these enforcement checks. Feedback suggests refactoring the new test assertions into a dedicated test function and aligning step numbering between the documentation and the workflow configuration to resolve inconsistencies.

Comment on lines +283 to +299
for content in [&commit_pattern, &commit_workflow] {
assert!(
content.contains(
"Step 17 requires upstream COMMIT_BODY from the AI-generated commit body step."
),
"commit pattern/workflow step 17 must fail fast when upstream COMMIT_BODY is missing"
);
assert!(
content
.contains("Step 17: commit body missing required '### AI Reviewer Metadata' block"),
"commit pattern/workflow step 17 must emit the explicit AI Reviewer Metadata error"
);
assert!(
!content.contains("scripts/gen_commit_msg.sh --body"),
"commit pattern/workflow step 17 must not synthesize a fallback commit body"
);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

For better test organization and clarity, consider moving these new assertions into a separate test function. The current function commit_reviewer_guidance_schema_requires_regression_tests_for_timing_scenarios has a very specific name, but it's now testing multiple unrelated aspects of the commit pattern. Splitting this logic will make the tests easier to understand and maintain.

A new test function could be named something like commit_pattern_step17_enforces_commit_body_and_metadata.

Comment on lines +289 to +290
inspection. Require `${COMMIT_BODY}` from the upstream AI commit-body step; do
not synthesize a fallback body here.
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

There seems to be a discrepancy in step numbering between PATTERN.md and workflow.toml. This section is labeled ## Step 14 in the markdown, but the corresponding step in workflow.toml has id = 17, and the error messages in this step correctly refer to "Step 17".

To avoid confusion for developers referring to PATTERN.md, please renumber the steps in this file starting from this one to align with the ids in workflow.toml. For example, ## Step 14: Generate Commit Message Parts should be ## Step 17: Generate Commit Message Parts, and subsequent steps should be renumbered accordingly.

Also, please update the error messages in this step (and in workflow.toml) that refer to step 14/15 to point to the new, correct step numbers (e.g., step 17/18).

@RyderFreeman4Logos
Copy link
Copy Markdown
Owner Author

Audit Trail — Merge Rationale (Severity-Tiered Protocol)

Local pre-PR review (session `01KPNZ59WJ4D2V0VJPC1E56E7N`): verdict=fail/HAS_ISSUES but `findings=[]` and `severity_counts={low:0, medium:0, high:0, critical:0}` — classic parser FP (documented in memory `review_meta_parsing_bug`). Ship-ready.

Cloud bot review (gemini-code-assist): 2 MEDIUM findings.

  1. `plan_cmd_tests_commit.rs:299` — test assertions placed in unrelated test function (organization nit).
  2. `PATTERN.md:290` — step numbering drift: section labelled "Step 14" but workflow.toml id=17 and error message references 17 (doc nit).

Per severity-tiered merge protocol (memory `feedback_review_severity_tiered`): only HIGH/CRITICAL/P1 block merge. MEDIUMs aggregate into followup issue + merge.

Followup filed: #966.

Test (macos-latest) FAILURE: pre-existing baseline noise per memory `feedback_macos_ci_ignore`. Linux green.

Merging.

@RyderFreeman4Logos RyderFreeman4Logos merged commit f53f783 into main Apr 20, 2026
6 of 7 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 395e73fd5a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +362 to +364
echo "ERROR: Step 17 requires upstream COMMIT_BODY from the AI-generated commit body step." >&2
echo "See patterns/commit/PATTERN.md step 14/15." >&2
exit 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep a generation path when COMMIT_BODY is unset

This new hard-fail turns COMMIT_BODY from optional into mandatory, but the same workflow does not populate COMMIT_BODY before Step 17 (it is only declared as a variable, and the first CSA_VAR:COMMIT_BODY assignment happens later in this step). In runs where callers do not pass --var COMMIT_BODY=... (including standalone commit workflow usage and nested INCLUDE commit call sites), Step 17 now aborts immediately, so the commit flow can no longer complete. Please either restore an internal body-generation fallback or add an explicit upstream step that sets COMMIT_BODY before this guard.

Useful? React with 👍 / 👎.

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.

commit workflow step 17 does not enforce AI Reviewer Metadata when COMMIT_BODY is absent

1 participant