GeezerVison is showing github.com — fix(workflow): check draft links past inner code fences (#393) by dezren39 · Pull Request #400 · developing-today/code
Conversation
dezren39
commented
Oct 20, 2026
•
edited by blacksmith-sh
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes #393
Problem
PR #391 extended scripts/research_workflow.py so links inside fenced trigger-issue drafts are checked, but its fence parser used a naive open/close toggle:
- A draft embedding its own fenced code example was split at the inner fence — the Context Pointer fragment carried no
workflow:issue marker and the marker fragment carried no links, so neither was checked. A broken pointer in such a draft passed check silently.
- A draft in an unclosed fence was dropped entirely and also escaped the check.
- The same toggle in
unfenced() leaked the embedded example's contents into prose, where link-shaped lines in code were checked as if they were draft prose.
Verified pre-fix through links(): control draft (no inner fence) raises missing link target: missing/nope.md; the nested-fence and unclosed shapes raise nothing.
Solution
- One nesting-aware scanner,
fence_events(), now backs both unfenced() and fenced_blocks(): a fence line carrying an info string can never close a block (a CommonMark closing fence has no info string), so it opens a nested level; only a bare fence at least as long as the innermost one closes a level. Fences of the other character and too-short bare fences are literal content.
fenced_blocks() also returns a trailing unclosed block, so an unclosed draft is checked rather than dropped.
issue_drafts() strips nested blocks whole via unfenced(), so embedded code examples inside a draft stay exempt from link checks. Non-draft fenced blocks stay exempt and {{...}} template placeholders remain skipped.
Verification
- 3 new regression tests in
scripts/tests/test_research_workflow.py: nested draft with a valid pointer passes (including a link-shaped line inside the code example, which stays exempt); the same draft carrying the docs(workflow): C001 trigger-issue draft (PR #381) mixes link bases — one pointer is dead, and the checker strips the fenced draft so it cannot catch it #382 broken pointer fails; an unclosed draft with the broken pointer fails. The broken-pointer tests keep link-shaped text out of the code example so they cannot pass for the wrong reason (the pre-fix prose leak).
- Ablation: all 3 new tests fail against the pre-fix checker; the 45 pre-existing tests pass both ways. Full suite post-fix: 48/48 pass (
python3 -m unittest discover -s scripts/tests -p 'test_*workflow*.py'), sync suite 4/4.
- Real tree:
python3 scripts/research_workflow.py check --repo-root . returns ok: true.
ruff format clean on both files.
Single-repo: scripts/research_workflow.py exists only in developing-today/code (verified absent in opencode/openchamber/nix clones).
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2Fef26d88456de9cc93cf03b8611c53675c8af4fc8361b0049e62a133b46e853b6%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2e737667)
Need help on this PR? Tag @codesmith-bot with what you need.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
fenced_blocks() used a naive open/close toggle, so a trigger-issue
draft embedding a fenced code example was split at the inner fence:
the pointer fragment carried no workflow:issue marker and the marker
fragment carried no links, so neither was link-checked. An unclosed
draft fence was dropped entirely. The same toggle in unfenced() also
leaked the embedded example's contents into prose.
Replace both toggles with one nesting-aware scanner, fence_events():
a fence line with an info string can never close a block (a
CommonMark closing fence has none), so it opens a nested level; only
a bare fence at least as long as the innermost one closes a level.
fenced_blocks() now also returns a trailing unclosed block, and
issue_drafts() strips nested blocks whole so embedded code stays
exempt from link checks.
Regression tests: nested draft with a valid pointer passes (with a
link-shaped line inside the code example, which stays exempt), the
same draft with the #382 broken pointer fails, and an unclosed draft
with the broken pointer fails. All three fail against the pre-fix
checker; the broken-pointer tests keep link-shaped text out of the
code example so they cannot pass for the wrong reason (the pre-fix
prose leak).
Warning
Review limit reached
You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.
Next included review available in 35 minutes.
Check out review usage here.
View limit details
-
Limit details: You’ve used the included review currently available.
Learn how review limits work.
Review configuration:
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
1c2df4b2-f2e7-4078-8997-e48e196b8060
📥 Commits
-
Reviewing files that changed from the base of the PR and between 4dbcae5 and b29a56e.
📒 Files selected for processing: 2
-
scripts/research_workflow.py
scripts/tests/test_research_workflow.py
- Autofix · 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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-10-20T08:11:50.496645Z |
b29a56e |
PR opened |
ℹ️ 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" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this 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: b29a56e445
ℹ️ 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".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+430
to
+432
|
|
elif token[0] != stack[-1][0]:
|
|
|
# A fence of the other character is literal block content.
|
|
|
yield "content", line
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Track alternate-delimiter nested fences
When an issue draft contains an inner tilde fence whose content has a bare backtick fence matching the outer delimiter, treating the tilde fence as literal lets that content line close the outer draft. For example, a backtick-fenced draft containing ~~~text, then a line of three backticks, then ~~~ is split before its trailing workflow:issue marker; issue_drafts() consequently sees neither the draft's earlier links nor the marker together, so broken context pointers again pass validation. Track alternate-delimiter inner fences as nested regions so outer delimiters appearing inside them cannot terminate the draft.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
485
to
+491
|
|
for block in fenced_blocks(text):
|
|
|
if "workflow:issue" in block:
|
|
|
clean = re.sub(r"<!--.*?-->", "", block, flags=re.S)
|
|
|
# Nested fenced blocks inside a draft are embedded code
|
|
|
# examples, not draft prose: strip them whole (as
|
|
|
# unfenced() does at document level) so their contents are
|
|
|
# not link-checked either (#393).
|
|
|
clean = re.sub(r"<!--.*?-->", "", unfenced(block), flags=re.S)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Classify drafts after stripping nested code
When a non-draft fenced example contains workflow:issue only inside a nested code block, this raw substring check misclassifies the entire outer block as an issue draft before unfenced(block) removes that nested content. Any link-shaped syntax elsewhere in the raw example is then validated as a real pointer and can make check fail—for example, an outer text block containing [raw syntax](missing.md) plus an inner block demonstrating the marker. Determine whether the marker remains in the cleaned draft prose instead.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Comment on lines
+438
to
+443
|
|
else:
|
|
|
# An info-string fence opens a nested block; a bare fence
|
|
|
# shorter than the innermost one is its literal content.
|
|
|
if info:
|
|
|
stack.append(token)
|
|
|
yield "content", line
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid nesting on fence-like code content
When an embedded code example itself contains a line such as ```python as literal content, this branch pushes another nesting level even though that line is already inside the example. The example's actual closing fence then pops only the synthetic level, so subsequent draft prose—including a broken context link and the trailing marker—remains classified as fenced content and is removed by unfenced(block). This makes links placed after such an example evade validation; distinguish literal fence-looking content from actual nested openers rather than nesting every info-string fence.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 20, 2026
This was referenced Nov 21, 2026
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|