Skip to content

fix(docs-truth): strict R-15 status block grammar and fuller prose parsing (#935) - #936

Merged
qnbs merged 4 commits into
mainfrom
ci/935-r15-guard-strict-grammar
Oct 1, 2026
Merged

qnbs merged 4 commits into
mainfrom
ci/935-r15-guard-strict-grammar

Conversation

@qnbs

@qnbs qnbs commented Oct 1, 2026 •

Copy link
Copy Markdown
Owner

User description

Closes #935. This is the correction wave for the four finding clusters that Codex and cubic raised on #934's merge head 59ee5411. The maintainer's QNB-177 plan required these to land before the merge; #934 was merged with them deferred instead, so they land here.

Changes (scripts/check-r15-gate-status.mjs)

  1. Strict block grammar: every non-blank line in the canonical R15_GATE_STATUS block must be exactly one R15_GATE<id>=<STATUS> entry. Trailing text such as … BROKEN and standalone garbage lines are reported as malformed.
  2. Fence- and comment-aware single pass: fences are recognised only outside comments, and comments only outside fences. A literal <!-- in a code example no longer hides the prose after it.
  3. Coordinated gate lists: Gates 4 and 3 and Gates 5, 2 or 3A check every listed gate.
  4. Independent diagnostics: a duplicate entry is also checked for an unsupported status.

Each item has a regression test in tests/unit/checkR15GateStatus.test.ts (23 tests in total). pnpm docs:check stays green on the live documents. The protected merge-admission evaluator files are not touched.

Summary by Sourcery

Strengthen R-15 documentation truth checks to catch malformed status data and accurately validate gate references in prose.

Bug Fixes:

  • Harden R-15 documentation validation so malformed status-block lines, unterminated blocks, coordinated gate references, and comment or fence edge cases are detected reliably.
  • Report duplicate entries and unsupported statuses independently for clearer diagnostics.

Enhancements:

  • Improve parsing of coordinated gate and slice references across prose while preserving text around multiline comments.

Documentation:

  • Document the stricter R-15 validation behavior in the changelog and update README test-count metrics.

Tests:

  • Add regression coverage for strict block grammar, coordinated gate lists, independent diagnostics, and fence/comment-aware prose parsing.

CodeAnt-AI Description

Strengthen R-15 documentation status validation

What Changed

  • Rejects status-block lines that contain trailing text or are not a single gate entry
  • Checks every gate named in coordinated lists such as “Gates 4 and 3”
  • Reports duplicate entries and invalid statuses independently
  • Correctly scans prose when comment markers appear inside code examples, preventing valid checks from being hidden
  • Adds regression coverage and updates the documented test count

Impact

✅ Fewer undocumented R-15 status errors
✅ Accurate validation of multi-gate references
✅ Clearer diagnostics for malformed status blocks

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.


Summary by cubic

Hardens the R-15 gate status guard in scripts/check-r15-gate-status.mjs so malformed canonical blocks, prose parsing edge cases, and coordinated gate lists are caught instead of silently passing.

  • Every non-blank line in the canonical R15_GATE_STATUS block must now be exactly one R15_GATE<id>=<STATUS> entry; trailing text like … BROKEN or garbage lines are reported as malformed. Both the block and code fences close only on a marker that stands alone on its line.
  • Fences and HTML comments are scanned in a single pass, so a literal <!-- inside a code example no longer hides the prose after it, and text around a multi-line comment stays adjacent.
  • Coordinated lists such as Gates 4 and 3 now check every listed gate, including per-item slice references.
  • A duplicate entry is also checked for an unsupported status.

Adds one regression test per fix to tests/unit/checkR15GateStatus.test.ts (23 tests total) and updates the README test count and changelog.

Written for commit 46e8fd7. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Documentation

    • Updated the listed test totals to 8,527+ across 633 files.
    • Added an Unreleased changelog entry describing stricter R-15 gate-status checks.
  • Quality

    • Improved checks for malformed or duplicate gate entries, unsupported statuses, and coordinated or ranged gate references.
    • Added regression coverage for status-block formatting and comment and fence handling.

…rsing (#935)

Canonical block lines must be exactly one entry; fences and HTML comments are scanned in one
pass so a literal comment opener in a code example cannot hide later prose; coordinated gate
lists ("Gates 4 and 3") check every gate; a duplicate entry is also checked for an unsupported
status.
@vercel

vercel Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
worldscript-studio Ready Ready Preview Oct 1, 2026 1:18pm UTC

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

Next included review available in 7 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 80 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: qnbs/WorldScript-Studio/.coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: b48162bc-67bf-4dd3-9331-a5bb2d169748

📥 Commits

Reviewing files that changed from the base of the PR and between 76cd074 and 46e8fd7.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • README.md
  • scripts/check-r15-gate-status.mjs
  • tests/unit/checkR15GateStatus.test.ts

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: qnbs/WorldScript-Studio/.coderabbit.yaml

Review profile: CHILL

Plan: Essentials

Run ID: cd6733d2-08d9-4151-b0a5-0fa9a2c31c20

📥 Commits

Reviewing files that changed from the base of the PR and between c424012 and 76cd074.

📒 Files selected for processing (4)
  • CHANGELOG.md
  • README.md
  • scripts/check-r15-gate-status.mjs
  • tests/unit/checkR15GateStatus.test.ts

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.


📝 Walkthrough

Walkthrough

The R-15 checker now validates canonical status-block lines, reports applicable duplicate and unsupported-status findings, and expands coordinated gate references in prose. It processes comments and fenced blocks line by line. The changelog and README test totals were updated.

Changes

R-15 gate status guard

Layer / File(s) Summary
Canonical status validation
scripts/check-r15-gate-status.mjs, tests/unit/checkR15GateStatus.test.ts, CHANGELOG.md, README.md
The checker reports nonblank status-block lines that do not contain exactly one entry. It can report both duplicate and unsupported-status findings for a known gate. Tests cover these findings. The changelog describes the checker changes, and README test totals change from 8,523+ to 8,527+.
Prose comment and fence handling
scripts/check-r15-gate-status.mjs, tests/unit/checkR15GateStatus.test.ts
The checker processes comments and fences line by line. Fences are recognized outside comments, and comments are processed outside fences. Tests cover markers inside fences and fences inside comments.
Gate reference expansion
scripts/check-r15-gate-status.mjs, tests/unit/checkR15GateStatus.test.ts
The checker expands coordinated gate lists and ranges into individual gate references. Tests cover lists containing implemented and unadmitted gates.

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 76cd0

The changes strengthen R-15 documentation validation without an identified merge-blocking issue. Merge after normal test and documentation checks pass.

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

@codeant-ai

codeant-ai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🏁 CodeAnt Quality Gate Results

Commit: 46e8fd73
Scan Time: 2026-10-01 13:19:09 UTC

✅ Overall Status: PASSED

Quality Gate Details

Quality Gate Status Details
Secrets ✅ PASSED 0 secrets found
Duplicate Code ✅ PASSED 0.0% duplicated
SAST ✅ PASSED No security issues
Bugs ✅ PASSED Rating S: No bugs
IAC ✅ PASSED No IAC issues

View Full Results

@sourcery-ai

sourcery-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR tightens canonical R15 status-block grammar, makes prose extraction correctly stateful across comments and code fences, validates every gate in coordinated prose references, and adds regression coverage plus synchronized README test totals.

Sequence diagram for stateful Markdown prose parsing

sequenceDiagram
    participant Document
    participant currentProse
    participant proseOf
    participant State
    Document->>currentProse: currentProse(markdown)
    loop each line
        currentProse->>proseOf: proseOf(line, state)
        proseOf->>State: nextFence(line, fence)
        proseOf->>State: stripComments(line, comment)
        proseOf->>State: nextHistorical(text, historical)
        proseOf-->>currentProse: current prose or null
    end
    currentProse-->>Document: normalized prose
Loading

Flow diagram for R15 status validation

flowchart TD
    A[Markdown documents] --> B[currentProse]
    B --> C[proseOf]
    C --> D{Fence or comment state}
    D -->|current prose| E[proseFindings]
    A --> F[canonical R15_GATE_STATUS block]
    F --> G[malformedBlockLines]
    F --> H[parseR15GateEntries]
    H --> I[entryFindings]
    I --> J[entryProblems]
    G --> K[Combined diagnostics]
    J --> K
    E --> K
Loading

Flow diagram for coordinated gate reference validation

flowchart TD
    A[Prose gate reference] --> B[GATE_REF]
    B --> C[referencedGates]
    C --> D{Range or coordinated list}
    D -->|range| E[rangeGates]
    D -->|list items| F[LIST_ITEM]
    F --> G[itemGates]
    E --> H[Referenced gate set]
    G --> H
    H --> I[Gate status comparison]
    I --> J[Prose findings]
Loading

File-Level Changes

Change Details Files
Enforce exact syntax for entries in the canonical R15 status block and improve validation diagnostics.
  • Added whole-line validation for nonblank block content, rejecting trailing text and standalone garbage.
  • Preserved entry-level checks for unknown gates, duplicates, and unsupported statuses while reporting independent duplicate/status failures.
  • Added regression coverage for malformed lines and duplicate entries with invalid statuses.
scripts/check-r15-gate-status.mjs
tests/unit/checkR15GateStatus.test.ts
Reworked prose scanning into a stateful, comment- and fence-aware pass.
  • Tracked fence, HTML comment, and historical-section state per line.
  • Ensured comment delimiters inside fences and fence markers inside comments do not alter parsing state.
  • Added regression coverage for both fenced Markdown styles and comment/fence interaction.
scripts/check-r15-gate-status.mjs
tests/unit/checkR15GateStatus.test.ts
Expanded gate-reference parsing to validate all gates in coordinated lists.
  • Added parsing for references joined by commas, and, or, including combinations with ranges and slices.
  • Separated range expansion from individual gate and slice resolution.
  • Added regression coverage for coordinated references.
scripts/check-r15-gate-status.mjs
tests/unit/checkR15GateStatus.test.ts
Updated README test-count metrics to reflect the added regression tests.
  • Changed documented totals from 8523+ to 8527+ in badges, testing descriptions, repository layout, and metrics.
README.md

Assessment against linked issues

Issue Objective Addressed Explanation
#935 Enforce strict line-by-line grammar for the canonical R15_GATE_STATUS block, rejecting trailing content and standalone non-entry lines. ✅
#935 Make prose parsing correctly handle fences before comments, expand coordinated gate lists, and report duplicate and invalid-status diagnostics independently. ✅
#935 Add regression coverage for all four hardening cases while preserving live-document validation and avoiding protected evaluator files. ✅

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codescene-access[bot]

This comment was marked as outdated.

@qnbs
qnbs marked this pull request as ready for review October 1, 2026 12:25
@codeant-ai

codeant-ai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR 76cd074 Oct 01, 2026 · 12:25 12:28

@sourcery-ai sourcery-ai 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.

Sorry @qnbs, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 3 hours and 39 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@codeant-ai

codeant-ai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Oct 1, 2026
@qnbs

qnbs commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

codescene-access[bot]

This comment was marked as outdated.

@deepsource-io

deepsource-io Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in c424012...46e8fd7 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

Overall Grade   Security  

Reliability  

Complexity  

Hygiene  

Code Review Summary

Analyzer Status Updated (UTC) Details
Docker Oct 1, 2026 1:20p.m. Review ↗
Python Oct 1, 2026 1:20p.m. Review ↗
Rust Oct 1, 2026 1:20p.m. Review ↗
Shell Oct 1, 2026 1:20p.m. Review ↗

Important

AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 76cd074f7d

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check-r15-gate-status.mjs
Comment thread scripts/check-r15-gate-status.mjs Outdated
Comment thread scripts/check-r15-gate-status.mjs Outdated

@cubic-dev-ai cubic-dev-ai 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.

cubic analysis

Review completed against the latest diff

Linked issue analysis

Linked issue: qnbs/WorldScript-Studio#935: R-15 gate status guard: strict canonical-block grammar and fuller prose parsing (follow-up to #933)

Status Acceptance criteria Notes
✅ Reject malformed lines in the canonical status block canonicalStatus checks each nonblank line, and regression tests cover trailing text and standalone garbage.
✅ Parse fences before stripping comments currentProse tracks fence and comment state together, with regression coverage for comment openers inside fences.
✅ Resolve every gate in coordinated lists referencedGates expands coordinated list items, and tests cover conjunctions, alternatives, and ranges.
✅ Report duplicate entries and invalid statuses together entryProblems independently checks duplicates and status validity, and a regression test asserts both findings.
✅ Keep docs:check green on live documents The PR description reports that pnpm docs:check stays green on the live documents.
✅ Leave protected merge-admission evaluator files unchanged The supplied changes are limited to the R-15 checker, its tests, and README metrics.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/check-r15-gate-status.mjs Outdated
Comment thread scripts/check-r15-gate-status.mjs Outdated
Comment thread scripts/check-r15-gate-status.mjs Outdated
Comment thread scripts/check-r15-gate-status.mjs
Comment thread scripts/check-r15-gate-status.mjs Outdated

@cubic-dev-ai cubic-dev-ai 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.

cubic analysis

All reported issues were addressed across 4 files

Linked issue analysis

Linked issue: qnbs/WorldScript-Studio#935: R-15 gate status guard: strict canonical-block grammar and fuller prose parsing (follow-up to #933)

Status Acceptance criteria Notes
✅ Require exactly one valid entry per nonblank status-block line malformedBlockLines rejects trailing text and standalone garbage, while entryFindings still reports invalid entries.
✅ Recognize fences before stripping comments proseOf tracks fences outside comments and strips comments only from non-fenced lines.
✅ Check every gate in coordinated lists referencedGates expands coordinated list items, and the regression test checks each named gate.
✅ Report duplicate entries and unsupported statuses independently entryProblems checks duplicate and status errors separately, so both findings are retained for one entry.
✅ Add one regression test for each finding The test changes cover malformed lines, duplicate diagnostics, coordinated lists, and comment markers inside fences.
⚠️ Keep docs:check green on live documents The PR description says docs:check stays green, but the supplied diff contains no check output.
✅ Leave protected merge-admission evaluator files unchanged The changed-file list contains no protected merge-admission evaluator files.

Requires human review: Auto-approval blocked because this review re-detected 5 unresolved issues already reported by Cubic.

Re-trigger cubic

@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

sourcery-ai[bot]
sourcery-ai Bot previously approved these changes Oct 1, 2026

@sourcery-ai sourcery-ai 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.

Sourcery assessment

Approved.

codescene-access[bot]

This comment was marked as outdated.

@qnbs

qnbs commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11e5bf0057

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check-r15-gate-status.mjs
@qnbs

qnbs commented Oct 1, 2026

Copy link
Copy Markdown
Owner Author

@codex review

@codescene-access codescene-access 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.

Gates Passed
3 Quality Gates Passed

See analysis details in CodeScene

Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.

@sourcery-ai sourcery-ai 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.

Sourcery assessment

Approved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 46e8fd7346

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

R-15 gate status guard: strict canonical-block grammar and fuller prose parsing (follow-up to #933)

1 participant