Skip to content

fix(review): render fix-handoff locations with a length-based code-span delimiter - #9347

Closed
bitfathers94 wants to merge 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-9289
Closed

fix(review): render fix-handoff locations with a length-based code-span delimiter#9347
bitfathers94 wants to merge 1 commit into
JSONbored:mainfrom
bitfathers94:fix/issue-9289

Conversation

@bitfathers94

Copy link
Copy Markdown
Contributor

fix(review): render fix-handoff locations with a length-based code-span delimiter

markdownPathCodeText backslash-escaped backticks, but Markdown code spans
are delimited by a run of backticks and do not honor a preceding backslash,
so a finding path containing a literal backtick corrupted the rendered
fix-handoff block. Compute a delimiter longer than any backtick run in the
value and wrap the whole location in it — mirroring markdownPathCode in
unified-comment-bridge.ts — and let both call sites consume that span
directly instead of re-wrapping in a fixed single backtick.

Closes #9289

Validation

Verified locally on this branch before opening:

  • npm run typecheck
  • npx turbo run build:tsc build:verify
  • npm run test:coverage — patch coverage 100.0% of changed lines

…an delimiter

markdownPathCodeText backslash-escaped backticks, but Markdown code spans
are delimited by a run of backticks and do not honor a preceding backslash,
so a finding path containing a literal backtick corrupted the rendered
fix-handoff block. Compute a delimiter longer than any backtick run in the
value and wrap the whole location in it — mirroring markdownPathCode in
unified-comment-bridge.ts — and let both call sites consume that span
directly instead of re-wrapping in a fixed single backtick.
@bitfathers94
bitfathers94 requested a review from JSONbored as a code owner July 27, 2026 13:36
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
3966 2 3964 11
View the top 2 failed test(s) by shortest run time
test/unit/selfhost-pg-retention.test.ts > runRetentionPrune + processJob on the Postgres backend (#977) > processJob prune-retention deletes eligible rows and records a success audit event on Postgres
Stack Traces | 0.0048s run time
AssertionError: expected 3 to be +0 // Object.is equality

- Expected
+ Received

- 0
+ 3

 ❯ test/unit/selfhost-pg-retention.test.ts:119:44
test/unit/selfhost-pg-retention.test.ts > pruneExpiredRecords on the Postgres backend (#977) > deletes across multiple bounded batches and stops at the per-table cap, same as the SQLite path
Stack Traces | 0.0286s run time
AssertionError: expected +0 to be 4 // Object.is equality

- Expected
+ Received

- 4
+ 0

 ❯ test/unit/selfhost-pg-retention.test.ts:76:33

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 27, 2026
@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-27 13:46:09 UTC

3 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This PR correctly diagnoses that Markdown code spans don't honor backslash-escaped backticks, and switches to a length-based delimiter (longest backtick run + 1) mirroring markdownPathCode in unified-comment-bridge.ts, with both call sites now consuming the fully-wrapped span from markdownPathCodeText instead of re-wrapping in a fixed single backtick. The delimiter math (Math.max(0, ...run lengths) + 1) is correct and the three new/updated tests exercise 0-backtick, 1-backtick, and 2-backtick-run cases with the expected exact delimiter widths, matching the rendered output shown. The fix is at the right layer (the escaping/rendering function itself, not a symptom patch), and the change closes #9289.

Nits — 4 non-blocking
  • fix-handoff-render.ts:44-48 — per CommonMark, a code span that starts or ends with a backtick character should have a padding space inserted at that end, or some renderers may parse the leading/trailing backtick ambiguously; the current delimiter computation doesn't add that guard, so a path that itself starts or ends with a backtick (rather than containing one mid-string) is an untested edge case worth a follow-up test.
  • The doc comment on markdownPathCodeText is now fairly long (5+ lines); consider trimming to the essential why (backslash doesn't work in code spans) now that the mirrored markdownPathCode function is the canonical explanation.
  • Add a test case where the path starts with a backtick (e.g. "`foo.ts") to confirm the delimiter still renders as one unbroken span without a leading-backtick ambiguity.
  • Since this now duplicates the delimiter-computation logic from markdownPathCode in unified-comment-bridge.ts, consider extracting a shared helper to avoid future drift between the two call sites.

CI checks failing

  • validate
  • validate-tests

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9289
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 65 registered-repo PR(s), 45 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor bitfathers94; Gittensor profile; 65 PR(s), 0 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The diff rewrites markdownPathCodeText to compute a delimiter longer than any backtick run instead of backslash-escaping, updates both call sites (buildFixHandoffBlock and fixHandoffAggregateItem) to consume the returned delimiter-wrapped span directly, and adds backtick-containing-path test cases asserting an unbroken code span, matching all three stated deliverables.

Review context
  • Author: bitfathers94
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: TypeScript
  • Official Gittensor activity: 65 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

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

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

review: fix-handoff-render's markdownPathCodeText backslash-escapes backticks, which markdown code spans don't honor

1 participant