Skip to content

fix(ci): make PR policy section parsing robust to markdown heading variants#892

Merged
BigSimmo merged 13 commits into
mainfrom
copilot/fix-failing-ci-testing
Jul 18, 2026
Merged

fix(ci): make PR policy section parsing robust to markdown heading variants#892
BigSimmo merged 13 commits into
mainfrom
copilot/fix-failing-ci-testing

Conversation

Copilot AI commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • CI failed in PR Policy with a false negative claiming ## Clinical Governance Preflight was missing.

  • This change hardens section parsing so required sections are recognized when authors use valid markdown heading variants (e.g. ### ... or trailing ###).

  • Parser hardening

    • Accept heading levels ######## for policy section lookup.
    • Normalize trailing closing hashes in heading text before comparison.
  • Regression coverage

    • Add a focused self-test proving section() resolves content from variant heading syntax.
const headings = [...source.matchAll(/^#{2,6}\s+(.+?)\s*$/gim)];
const targetHeading = normalizeSectionHeading(heading);
const matchIndex = headings.findIndex((m) => normalizeSectionHeading(m[1]) === targetHeading);

Verification

  • npm run verify:pr-local
  • npm run verify:cheap

During development, use npm run verify:cheap as the faster iteration gate before the final PR-local preflight.

  • npm run verify:ui when UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changed
  • npm run verify:release before release or handoff confidence claims

For retrieval, ranking, selection, chunking, source/citation rendering, or answer-contract changes, verify:pr-local runs eval:rag:offline automatically. Run the offline command directly during iteration before spending a live eval.

  • npm run eval:retrieval:quality (must stay 36/36) when retrieval, ranking, selection, chunking, or scoring behavior changed — CI cannot run it (needs live keys), so run it locally and paste the summary. A metadata/governance-weighting change once buried correct docs (recall 1.0→0.76) and only this eval caught it.
  • npm run eval:rag -- --limit 15 + npm run eval:quality -- --rag-only when answer generation, the synthesis prompt, or answer post-processing changed (grounded-supported must not drop; citation-failure 0)
  • npm run check:production-readiness when clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changed
  • npm run check:deployment-readiness when deployment startup, hosting, or rollout behavior changed

Verification not run: npm run verify:pr-local was not rerun after this scoped CI-policy parser fix.
UI verification not run: change is non-UI and does not affect routing/styling/browser behavior.
Release verification not run: scoped CI-policy parser fix.

Risk and rollout

Complete this section for clinical, data, API, auth/privacy, workflow, dependency, build, or deployment changes.

  • Risk: low; parser-only change to PR metadata policy evaluation.
  • Rollback: revert this commit to restore prior strict heading parsing.
  • Provider or production effects: None.

Clinical Governance Preflight

Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output.

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

Notes

  • Scope is intentionally narrow: scripts/pr-policy.mjs only, including a focused self-test update.

Summary by CodeRabbit

  • Bug Fixes
    • Improved recognition of pull request section headings across heading levels 2–6.
    • Section matching now tolerates differences in capitalization and formatting, such as trailing hash symbols.

BigSimmo and others added 7 commits July 19, 2026 00:34
Home already renders ModeHomeVerificationFooter via ModeHomeTemplate;
skip the workspace footer on /therapy-compass so the notice appears once.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Home already renders ModeHomeMain; keep the workspace shell as a div on
/therapy-compass so screen readers see a single main landmark.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
@supabase

supabase Bot commented Jul 18, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR policy section parser now recognizes headings at levels 2 through 6 with normalized formatting, and its self-test covers headings with alternate levels and trailing hash characters.

Changes

PR section parsing

Layer / File(s) Summary
Heading normalization and validation
scripts/pr-policy.mjs
Section matching now normalizes heading text, accepts heading levels 2–6, trims trailing hash characters, and adds a self-test for formatted Summary headings.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: bigsimmo

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the parser hardening change and matches the main scope of the PR.
Description check ✅ Passed The description follows the template with Summary, Verification, Risk and rollout, Clinical Governance Preflight, and Notes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 copilot/fix-failing-ci-testing

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

@BigSimmo
BigSimmo marked this pull request as ready for review July 18, 2026 16:48
Copilot AI requested a review from BigSimmo as a code owner July 18, 2026 16:52
Copilot AI changed the title [WIP] Fix failing CI testing fix(ci): make PR policy section parsing robust to markdown heading variants Jul 18, 2026
Base automatically changed from cursor/therapy-mode-home-align-1ae0 to main July 18, 2026 16:53
@BigSimmo
BigSimmo enabled auto-merge (squash) July 18, 2026 16:55

@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: 357a7888c7

ℹ️ 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/pr-policy.mjs Outdated

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 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 `@scripts/pr-policy.mjs`:
- Line 55: Update the heading-matching regular expression used by the headings
extraction in pr-policy so the separator after the hash marks and trailing
whitespace match only spaces or tabs, never newlines. Preserve matching valid
headings on a single physical line while rejecting inputs such as “##” followed
by a newline and text.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 78e42603-466e-485b-ac39-c158ab4d0fbd

📥 Commits

Reviewing files that changed from the base of the PR and between 400c620 and bcfae4c.

📒 Files selected for processing (1)
  • scripts/pr-policy.mjs

Comment thread scripts/pr-policy.mjs Outdated
@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • scripts/pr-policy.mjs

Commit: 7fac542ca6e085c99f4fd4e1f091b5b0eee3fdee

The changes have been pushed to the copilot/fix-failing-ci-testing branch.

Time taken: 3m 21s

@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: cda0362534

ℹ️ 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/pr-policy.mjs Outdated
Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@BigSimmo
BigSimmo disabled auto-merge July 18, 2026 17:19
@BigSimmo
BigSimmo enabled auto-merge (squash) July 18, 2026 17:20
@BigSimmo
BigSimmo disabled auto-merge July 18, 2026 17:24
@BigSimmo
BigSimmo enabled auto-merge (squash) July 18, 2026 17:32
@BigSimmo
BigSimmo merged commit f4557ca into main Jul 18, 2026
25 checks passed
@BigSimmo
BigSimmo deleted the copilot/fix-failing-ci-testing branch July 18, 2026 17:33
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.

3 participants