Skip to content

[Safe Outputs Conformance] REQ-002: Count required sections across full type blocks - #75114

Merged
pelikhan merged 3 commits into
mainfrom
fix/conformance-req-002-type-section-window-1b356256a09caaa6
Nov 5, 2026
Merged

pelikhan merged 3 commits into
mainfrom
fix/conformance-req-002-type-section-window-1b356256a09caaa6

Conversation

@github-actions

@github-actions github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Conformance Check Failure

Check ID: REQ-002
Severity: MEDIUM
Category: Specification

Problem Description

On every run, the checker prints [MEDIUM] REQ-002: Type create_pull_request has only 4/5 required sections. The spec type has all five sections, so this is a checker defect. The same run then prints [PASS] REQ-002: All safe output types have complete documentation and reports Medium Failures: 0.

Three bugs in check_type_completeness cause this:

  1. Fixed window. grep -A 200 read 200 lines after each type heading. **Security Requirements** sits 264 lines below the create_pull_request heading, so it was never counted.
  2. No end anchor. The heading pattern had no end anchor, so it also matched create_pull_request_review_comment. The window could count sections from a sibling type.
  3. Subshell. The loop ran at the end of a pipeline, so failed=1 and the MEDIUM counter were set in a subshell. The parent saw failed=0, printed PASS, and dropped the MEDIUM count from the summary.

Also, head -10 limited the check to the first 10 of 47 spec types.

Affected Components

  • Files: scripts/check-safe-outputs-conformance.sh, scripts/check-safe-outputs-conformance_test.sh
  • Spec: docs/src/content/docs/specs/safe-outputs-specification.md (not changed)
🔍 Current vs Expected Behavior

Current Behavior

create_pull_request is reported as 4/5 complete, and the MEDIUM finding is hidden by a PASS line. Only the first 10 types are checked.

Expected Behavior

create_pull_request is reported as 5/5 complete. A real documentation gap is reported as MEDIUM and counted in the summary. All 47 types are checked.

Remediation Steps

  1. Extract each type block with awk. The block starts at the exact #### Type: heading and ends at the next ## or ### heading.
  2. Read type names with while read ... done < <(...) so the loop runs in the current shell.
  3. Remove head -10.
  4. Add a fixture regression to the conformance test. It covers a type whose sections sit past line 200, then an incomplete type.

Validation

  • Dry run of the new extraction over all 47 spec types: every type has at least 5/5 sections, so removing head -10 adds no findings.
  • bash scripts/check-safe-outputs-conformance.sh: REQ-002 reports [PASS], and Medium Failures: 0.
  • Extracted regression block run against both checker versions. The main version prints MEDIUM: REQ-002: Type long_type has only 1/5 required sections, then PASS, and exits 1. The fixed version exits 0.
  • Shellcheck on the checker reports the same 5 warnings as main. The test file gains 2 SC2329 notes for the log_medium and log_pass stubs. The existing SEC-005 block has the same two notes.
  • scripts/check-safe-outputs-conformance_test.sh exits 0 only with this PR, the USE-001 PR, and the USE-003 PR applied together. Verified in a scratch worktree with a full run.

References

  • Conformance Checker: scripts/check-safe-outputs-conformance.sh
  • Safe Outputs Specification: docs/src/content/docs/specs/safe-outputs-specification.md

References: §41975417561

Generated by ✅ Daily Safe Outputs Conformance Checker · claude · routed: haiku55 xhigh · ~47 AIC · ⌖ ~2 AIC · ⊞ 4.9K · ◷

  • expires on Nov 5, 2026, 10:00 PM UTC-08:00

@pelikhan
pelikhan marked this pull request as ready for review November 5, 2026 06:27
Copilot AI adaptive review requested due to automatic review settings November 5, 2026 06:27
@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Design Decision Gate 🏗️ completed the design decision gate check. See the comment below for the result and any generated ADR draft.

Design Decision Gate 🏗️

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Design Decision Gate 🏗️ · routed: gpt56 max · ~1 AIC · ⌖ ~2 AIC · ⊞ 7.7K · ◷

🏗️ ADR gate enforced by Design Decision Gate 🏗️

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ PR Code Quality Reviewer completed the code quality review.

🔎 Code quality review by PR Code Quality Reviewer

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Ponytail Reviewer completed successfully!

Ponytail Reviewer

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Ponytail Reviewer · routed: gpt56 max · ~2 AIC · ⌖ ~1 AIC · ⊞ 118 · ◷

Generated by Ponytail Reviewer for #75114

@github-actions

github-actions Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor Author

✅ Test Quality Sentinel completed test quality analysis.

Test Quality Sentinel

Outcome: reported_no_action

The agent completed and reported no action. A no-op output alone does not verify that all required work was completed or that publication was possible.

Agent messages are omitted from this comment. The category uses structured run status, not interpretation of agent prose.

Generated from Test Quality Sentinel · routed: gpt56 max · ~1 AIC · ⌖ ~1 AIC · ⊞ 6.3K · ◷

🧪 Test quality analysis by Test Quality Sentinel

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The extraction does not stop at #### Type: headings, allowing an incomplete type to borrow a sibling’s sections, incorrectly report 5/5, and suppress the expected MEDIUM finding.

1 open issue
What changed in this PR

This PR updates the safe-output documentation conformance checker to address truncated section counts and lost REQ-002 failure reporting.

Changes:

  • Replaces fixed 200-line windows with heading-based extraction and exact type-name matching.
  • Checks all documented types and preserves failure state in the current shell.
  • Adds regression fixtures for long type documentation and incomplete types.
File Description
scripts/​check-safe-outputs-conformance.sh Updates REQ-002 extraction, type coverage, and failure propagation.
scripts/​check-safe-outputs-conformance_test.sh Adds fixtures checking section counts and failure reporting.

Review effort: Balanced (auto)

@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

Comment Memory

Peek at saved memory (pr-code-quality-reviewer)
reviewed_at: 2026-11-05T06:30:51Z
review_event: REQUEST_CHANGES
top_themes: [incorrect awk heading boundary, silent pass on empty extraction]
files_reviewed: [scripts/check-safe-outputs-conformance.sh, scripts/check-safe-outputs-conformance_test.sh]
comment_count: 2

Note

This comment is managed by comment memory.

Expand the saved memory block to view or edit the persistent context for this thread.
Edit only the text inside the backtick fences; workflow metadata and the footer are regenerated automatically.

Learn more about comment memory

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K · ◷
Comment /review to run again

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The REQ-002 fix is not merge-ready: its awk boundary does not stop at the next #### Type: heading, so sibling sections can still contaminate completeness results. It also silently passes when no types are extracted.

Highlights
  • Correct the heading boundary to isolate each type block and add a sibling-bleed regression.
  • Fail or report a finding when the spec is missing or no types are found.

🔎 Code quality review by PR Code Quality Reviewer · copilot · gpt50 · ~2 AIC · ⌖ ~1 AIC · ⊞ 1.6K
Comment /review to run again


# Bound each type at the next heading. A fixed line window truncates long types and also matches
# sibling types that share the name prefix, such as create_pull_request_review_comment.
type_section=$(awk -v name="$type_name" '$0 == "#### Type: " name {found=1; next} found && /^###? / {exit} found' "$spec_file")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The block terminator /^###? / does not match the #### Type: heading that starts the next type, so a type's section extraction still runs through sibling types and can count their required sections, preserving the false-pass bug this change is intended to fix.

💡 Why this matters and how to fix it

###? matches only ## or ###; all safe-output type headings are level four (####). Therefore an incomplete type followed by a complete type will still appear complete. Terminate on the next heading at the relevant levels, for example /^#{2,4} /, while retaining the current type's content. Add a regression with an incomplete #### type followed by a complete sibling.

done < <(grep "^#### Type:" "$spec_file" 2>/dev/null | sed 's/^#### Type: //')

if [ $failed -eq 0 ]; then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If the specification file is missing or yields no type headings, this function now performs zero iterations and still prints a successful REQ-002 PASS, so the checker can silently validate nothing.

💡 Why this matters and how to fix it

The grep failure is suppressed and there is no processed-type count. Track whether at least one type was checked and emit a failure/medium finding when the file is absent or extraction is empty; otherwise this preserves the silent-pass failure mode that the loop fix is meant to eliminate.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Skills-Based Review 🧠

Applied /diagnosing-bugs and /tdd: requesting changes. The fix removes the fixed-window and subshell bugs, but the new awk still runs into sibling types, so the original symptom (a false PASS) remains for most types.

📋 Key Findings and Evidence

Blocking

  • Sibling bleed is not fully fixed. The awk stops only at ##/###. The spec places many #### Type: headings under one ### group, so each block continues into the next type. linear_add_comment has none of the five sections but reports 5/5. A fixture with incomplete_type directly above complete_type also prints PASS. In the real spec, 44 of 47 blocks span a sibling type.
  • Suggested fix: stop at #### Type: too, for example found && (/^###? / || /^#### Type: /) {exit}. I checked this on the fixture (reports 0/5) and on the spec (35 of 47 types below 5/5).

Non-blocking

  • Literal match: grep -q "**$section**" is a regex. Use grep -qF.
  • Test gap: the new regression block passes on this branch but does not cover adjacent types, so it would not catch the bleed.
  • Validation claim: the PR says all 47 types are at least 5/5, which holds only because of the sibling bleed. Once the bound is fixed, the summary will report about 35 MEDIUM findings. The script still exits 0 on MEDIUM, so the daily job does not fail. Several gaps are label-format mismatches (for example **Configuration**: and **MCP Tool**:), so decide whether to fix the labels or the spec before merging.

Positive Highlights

  • ✅ Pulling the loop out of the pipeline fixes the subshell bug, so failed and the MEDIUM count reach the summary.
  • ✅ Removing head -10 checks all 47 types.
  • ✅ Replacing the fixed 200-line window fixes the truncation case in the new fixture.

@copilot please address the review comments above.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · copilot · routed: haiku55 xhigh · ~5 AIC · ⌖ ~1 AIC · ⊞ 5.4K
Comment /matt to run again


# Bound each type at the next heading. A fixed line window truncates long types and also matches
# sibling types that share the name prefix, such as create_pull_request_review_comment.
type_section=$(awk -v name="$type_name" '$0 == "#### Type: " name {found=1; next} found && /^###? / {exit} found' "$spec_file")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/diagnosing-bugs] The sibling-window bug is still present. The awk exit pattern /^###? / does not stop at the next #### Type: heading, so linear_add_comment (0 of 5 sections) reports 5/5 and the check prints PASS.

💡 Evidence and suggested fix

A fixture with incomplete_type directly above complete_type still prints PASS on this branch. On the real spec, 44 of 47 type blocks run into a sibling type.

Add the sibling heading to the exit pattern, for example found && (/^###? / || /^#### Type: /) {exit}. With that change, the fixture reports incomplete_type as 0/5 and the real spec reports linear_add_comment as 0/5.

@copilot please address this.

# Check for required sections
for section in "MCP Tool Schema" "Operational Semantics" "Configuration Parameters" "Security Requirements" "Required Permissions"; do
type_section=$(grep -A 200 "^#### Type: $type_name" "$spec_file" 2>/dev/null || true)
if grep -q "**$section**" <<< "$type_section"; then

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/tdd] grep -q "**$section**" is a regex, so it also matches bare prose. For example, the text Security Requirements appears in prose counts as a section. Use grep -qF for a literal match.

💡 Suggested change

Change line 317 to if grep -qF "**$section**" <<< "$type_section"; then. The -F flag keeps the asterisks literal, so only the bold label counts.

@copilot please address this.

exit 1
fi

printf '\n#### Type: short_type\n\n**MCP Tool Schema**:\n**Operational Semantics**:\n\n### Next Section\n' >>"$spec"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

[/tdd] This test does not cover the sibling-bleed case. short_type is the last heading before ### Next Section, so its block never reaches another type. The test passes even with the bug.

💡 Suggested regression fixture

Add a fixture where incomplete_type sits directly above complete_type, then assert the output contains MEDIUM: REQ-002: Type 'incomplete_type' has only 0/5 required sections. Run it on this branch first. It should fail before the end-anchor fix.

@copilot please address this.

type_section=$(awk -v name="$type_name" '$0 == "#### Type: " name {found=1; next} found && /^###? / {exit} found' "$spec_file")

# Check for required sections
for section in "MCP Tool Schema" "Operational Semantics" "Configuration Parameters" "Security Requirements" "Required Permissions"; do

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

With the end-anchor fix, 35 of 47 types fall below 5/5. The summary would go from Medium Failures: 0 to 35. Several types use other labels. For example, linear_add_comment uses **Configuration**: and an **MCP Tool**: line instead of **MCP Tool Schema**. Decide whether to adjust the labels in this list or the spec before merging, so the new findings are real gaps and not format mismatches.

@copilot please address this.

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot

Copilot assignment requested for the following outstanding work:

  1. Update this branch with the latest main using make merge-main, resolving any conflicts and preserving the intended changes.
  2. Review (scripts/check-safe-outputs-conformance.sh:313): The extraction still includes sibling types: /^###? / matches only ## and ###, but adjacent types in the spec use #### Type: headings. An incomplete type followed by a complete type under the same subsection therefore borrows the sibling's sections, reports 5/5, and produces no MEDIUM finding. Stop at the next type heading as well, and cover this ordering in the regression fixture. - [Safe Outputs Conformance] REQ-002: Count required sections across full type blocks #75114 (comment)

Once you start work, post this work summary as a PR comment without the leading Copilot mention, including the Sous-chef head, work, and state lines below, to record that the assignment is running. Apply the necessary fixes on this PR's existing branch, reply to each listed review thread and resolve it when addressed. Ignore feedback already answered or resolved; stop when only human review or CI remains. Do not merge or trigger CI.

Sous-chef requested-head: e325dee
Sous-chef requested-work: a553828588cfe50d0edd2d044adeaabbec7b6ef9d3377b51eecaefb8da4e20e1
Sous-chef requested-state: e027eebb3c4a1d46ec6389f8feed5bedb5648cfc70bef5683656af09af163d0b

Generated by 👨🍳 PR Sous Chef · pi · haiku45 · ~8 AIC · ⌖ ~9 AIC · ⊞ 1.2K · ◷
Comment /souschef to run again

Copilot AI commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

@copilot

Copilot assignment requested for the following outstanding work:...

Assignment running:

  1. Update this branch with the latest main using make merge-main, resolving conflicts while preserving the intended changes.
  2. Address [Safe Outputs Conformance] REQ-002: Count required sections across full type blocks #75114 (comment): stop extraction at sibling type headings and add an incomplete-before-complete regression fixture.

Sous-chef requested-head: e325dee
Sous-chef requested-work: a553828588cfe50d0edd2d044adeaabbec7b6ef9d3377b51eecaefb8da4e20e1
Sous-chef requested-state: e027eebb3c4a1d46ec6389f8feed5bedb5648cfc70bef5683656af09af163d0b

Copilot AI and others added 2 commits November 5, 2026 07:14
…02-type-section-window-1b356256a09caaa6

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI requested a review from gh-aw-bot November 5, 2026 07:19
@pelikhan
pelikhan merged commit f5e435a into main Nov 5, 2026
39 checks passed
@pelikhan
pelikhan deleted the fix/conformance-req-002-type-section-window-1b356256a09caaa6 branch November 5, 2026 15:14
@github-actions

github-actions Bot commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

🎉 This pull request is included in a new release.

Release: v1.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants