Skip to content

fix: preserve Markdown code spans in guidance checks - #477

Merged
devantler merged 4 commits into
mainfrom
codex/markdown-guidance-476
Oct 4, 2026
Merged

devantler merged 4 commits into
mainfrom
codex/markdown-guidance-476

Conversation

@devantler

@devantler devantler commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Generated by the Agentic Engineer

Why

Valid commands inside double-backtick Markdown spans now fail the guidance check. This prevents existing documentation from passing validation and makes the checker report an incomplete observation for a literal command it can safely inspect.

What

Match Markdown opening and closing delimiter runs by length, preserving spans across line breaks. Escaped prose, separate blocks and retained decoded values cannot supply a misleading opener. Track fenced and indented code inside ordinary, quoted and list examples. Observe the source once across successive commands, keep unresolved shell expressions UNKNOWN, and continue rejecting invalid GitHub JSON fields inside valid code spans.

Validation: added regressions reproduced the delimiter and context failures before each repair; the guard now passes all 128 CLI cases. Go tests cover separate-block and decoded-value boundaries, 10,000 literal command spans and a benchmark. ShellCheck, the actual 162-surface repository scan, manifest parity, desired-state digests, all bundled skill specification checks and release gates pass. Scanned commands are never executed. The observer supports bounded guidance syntax and does not claim full Markdown or shell interpretation.

Fixes #476

Follow-up to #473.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

User evaluation at e2eae98: ran the actual guidance guard against literal Markdown fixture trees. Matching double and triple code spans, including a completed earlier span, return 0; an invalid merged field inside a valid double span returns 1; unresolved single-backtick content and mismatched closing delimiters return UNKNOWN (2). The full 111-case CLI suite and Go observer tests pass. The actual shipped repository scan reports 33 field lists across 162 surfaces with no invalid field. No inspected command or package executes.

Manifest parity, desired-state digests, bundled skill specification validation, ShellCheck and release gates pass locally. CI and a successful current-head review must still settle before promotion.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

User evaluation at af13476: the actual repository guard reports 33 field lists across all 162 surfaces with no invalid field. Matching double/triple spans and multiline command spans pass; invalid merged fields still fail; unresolved expressions, mismatched delimiters and unrelated Markdown/decoded-value openers remain UNKNOWN. The expanded CLI suite passes 128 cases, and the current-head Go suite passes the final heading-start regression after RED→GREEN proof. No inspected command or package executes.

Independent review drove repairs for escaped prose, container fences and indentation, paragraph/heading boundaries and HTML comments. The observer retains its position across commands; the 10,000-command literal guidance test passes with roughly linear benchmark scaling. Manifest parity, digests, skill specification validation, ShellCheck and release gates pass locally. Hosted CI and a qualifying review must still settle before promotion.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai

coderabbitai Bot commented Oct 4, 2026

Copy link
Copy Markdown

Review in Change Stack →

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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: ace1fe5f-83cd-4f8e-9655-a7a4c42e7b58
📥 Commits

Reviewing files that changed from the base of the PR and between 59c8266 and af13476.

📒 Files selected for processing (3)
  • scripts/gh-json-go/main.go
  • scripts/gh-json-go/main_test.go
  • scripts/guard-gh-json-fields.test.sh

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
🔇 Additional comments (5)
scripts/gh-json-go/main.go (3)

290-293: Check the fence character family before an open fence can be closed.

Line 294 requires fence == source[start] and run >= fenceLength before it closes a fence, so the close test is correct. The opener test at Lines 290-291 rejects a backtick fence whose info string contains a backtick, which is also correct. I found no defect in this logic.


306-314: An unterminated inline HTML comment ends the scan without a boundary.

When delimiter == 0 and a line contains <!-- with no closing -->, Line 309 sets i = len(source). Later calls then return delimiter == 0. A backtick that follows a field flag then returns UNKNOWN through Line 392. UNKNOWN is the safe outcome, so this path cannot hide an invalid field. The scan also ignores % retained-value boundaries inside the unterminated comment. As a result, one decoded value can suppress span tracking in every later value. The worst result is a false UNKNOWN. No correctness bypass exists.


182-336: LGTM!

Also applies to: 344-344, 388-392

scripts/gh-json-go/main_test.go (1)

88-134: LGTM!

scripts/guard-gh-json-fields.test.sh (1)

175-267: LGTM!


📝 Walkthrough

Walkthrough

The change adds Markdown delimiter tracking to shell-field normalization. The observer recognizes inline backtick runs, fences, block boundaries, comments, escapes, and quote or list containers. The normalizer uses matching inline delimiters instead of checking backtick parity from the current line. New Go and guard tests cover Markdown spans, boundaries, unresolved shell syntax, and repeated-span benchmarks.

Priority: ⬇️ Low

Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to af134

No confirmed issue blocks merging, subject to the outstanding CI checks.


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error)

Check name Status Explanation Resolution
Docstring Coverage ❌ Error Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: preserving Markdown code spans in guidance checks.
Description check ✅ Passed The description explains the problem, the implementation, and the validation related to the changeset.
Linked Issues check ✅ Passed Issue #476 requires valid single-, double-, and triple-backtick spans, including completed earlier spans on the same line, while preserving UNKNOWN for unresolved shell syntax and retaining guard cove…
Out of Scope Changes check ✅ Passed The changes are limited to Markdown-aware guidance normalization and related observer and guard tests. These changes directly support issue #476. No unrelated change is evident in the reviewed files.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

The explicit Docstring Coverage finding in CodeRabbit’s review is addressed at f59ba37. All seven touched named Go functions now have attached documentation comments (three production functions and four tests/benchmarks); the benchmark callback also has an explanation. Independent Go parsing verified the docgroups.

The repair adds only five comment lines. The runtime observer blob is unchanged from the CodeRabbit-reviewed head af13476, whose 45 CI checks passed and whose substantive review reported no actionable code findings. Current-head CI and the required review route remain pending before promotion.

@devantler devantler 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.

🤖 Generated by the Agentic Engineer

Self-review (fallback — CodeRabbit, Codex and Cursor Bugbot unavailable)

Reviewed commit: f59ba37

  • CodeRabbit — authenticated coderabbitai[bot] review summary, provider event 2026-10-04T18:51:06Z, freshly observed at 2026-10-04T19:03:25Z: this PR's completed review consumed its included allowance; the plan allows one included review per hour and reports zero remaining. The earlier request was at 18:46:04Z, so the ongoing hourly limit applies to this new head. Recovery is the included allowance refill; no paid retry is authorized. That substantive review covers the unchanged runtime at af13476, but does not satisfy this new head's review gate.
  • Codex — authenticated chatgpt-codex-connector[bot] account usage refusal, provider event 2026-10-04T02:11:02Z, freshly observed at 2026-10-04T19:03:25Z: the account has reached its code review usage limit. No reset time is stated. Recovery requires renewed included allowance or account action; paid credits are not authorized.
  • Cursor Bugbot — authenticated cursor[bot] usage refusal, provider event 2026-10-04T12:21:20Z, freshly observed at 2026-10-04T19:03:25Z: this user or team's usage/spend limit prevented the review. No reset time is stated. Recovery requires allowance renewal or administrative action; raising the spend limit is not authorized.

Direct current-PR reads cover all conversation comments, review objects and review threads with complete pagination, plus the native current-head check list. There is no current-head external review, no Bugbot run, no outstanding thread and no newer provider recovery artifact on this PR. Disabled automatic review is uninformative and is not the evidence for fallback.

I reviewed the complete three-file diff against base 59c8266 for correctness, execution safety, retained-value boundaries and regression coverage. Matching backtick runs preserve literal single-, double- and triple-delimited field lists, including completed earlier spans and spans across a nonblank newline. Escaped prose, code fences, container-relative indentation, headings, paragraph breaks and HTML comments cannot supply a misleading opener. The observer advances monotonically rather than rescanning the full prefix for every command.

The normalizer does not execute inspected commands or source packages. Unknown expansions, mismatched delimiters and unresolved shell expressions remain UNKNOWN; a literal invalid merged field remains a failure. Tests cover positive guidance and adversarial contexts, including heading starts and decoded % boundaries. The supported guidance syntax is bounded, not a general Markdown or shell interpreter. An unterminated HTML comment can conservatively cause a later false UNKNOWN, never a false clean result; that limitation does not widen execution or trust.

Validation includes 128 passing CLI guard regressions, the complete Go parser tests, ShellCheck and the actual repository scan: 33 field lists across 162 surfaces. The repeated-span test checks all 10,000 spans, and 1,000/10,000-span benchmarks showed roughly linear scaling. The independent final diff audit found no actionable defect.

The prior review's explicit Docstring Coverage finding is addressed in the current head: all seven touched named Go functions have attached documentation, independently verified with Go AST parsing, and the benchmark callback has an explanatory comment. The final commit adds only five comment lines; runtime blob a671f0d6c72d4e3d6bf0f9b8c2f4bf3676641c2f is unchanged from CodeRabbit's reviewed head. This is source verification, not a claim that the provider reran its ancillary evaluator. The resolution record records the repair.

No outstanding correctness, security or documentation finding remains at this head.

Verdict: no P0/P1 findings

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

Ready at f59ba37 against base 59c8266. The native current-head CI read reports 45 settled checks, including successful CI - Required Checks, with no failed or pending check and complete pagination. There are no unresolved threads or outstanding code/documentation findings, and the head has a valid verified signature.

The substantive current-head local review satisfies the canonical local-review gate. It records freshly authenticated, applicable limits for all three providers and reviews the full diff; no additional paid request was made. CodeRabbit's disabled-auto-review status is uninformative and is not being treated as a review.

User evaluation exercised the actual guard: 128 CLI cases pass, the Go suite passes including the final heading-start regression, and the current-head repository scan checks 33 field lists across 162 surfaces. Valid literal Markdown guidance passes; invalid fields fail; unresolved syntax and unrelated block openers remain UNKNOWN. The final comments-only repair addresses the explicit documentation finding and leaves the evaluated runtime unchanged. No inspected commands or packages execute.

All three readiness conditions are met. Promoting and merging with an exact head match.

@devantler
devantler marked this pull request as ready for review October 4, 2026 19:05
@devantler
devantler merged commit c440fb3 into main Oct 4, 2026
46 checks passed
@devantler
devantler deleted the codex/markdown-guidance-476 branch October 4, 2026 19:06
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

Delivered: PR #477 merged at 2026-10-04T19:06:28Z as c440fb3. A fresh full-ref fetch confirms that commit is on main.

I ran the actual merged tree in an isolated archive: all 128 CLI guard cases pass, the complete Go parser suite passes, and the shipped repository scan reports 33 field lists across 162 surfaces with no invalid field. This confirms the Markdown compatibility repair and the conservative UNKNOWN behavior on unresolved syntax after merge. The documentation repair is included in the same delivered tree.

Issue #476 is closed and verified ✅ Done on Project 5. The round's 13 delivery issues are all closed/Done, and live open-PR inventories for both libraries are empty.

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

Labels

None yet

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Restore valid Markdown delimiter runs in the guidance observer

1 participant