Skip to content

fix(content-lane): harden duplicates block-scalar header detection#9358

Closed
joaovictor91123 wants to merge 1 commit into
JSONbored:mainfrom
joaovictor91123:fix/duplicates-block-scalar-9290
Closed

fix(content-lane): harden duplicates block-scalar header detection#9358
joaovictor91123 wants to merge 1 commit into
JSONbored:mainfrom
joaovictor91123:fix/duplicates-block-scalar-9290

Conversation

@joaovictor91123

Copy link
Copy Markdown
Contributor

Summary

  • Harden block-scalar header detection in src/review/content-lane/duplicates.ts to match the grammar already used in source-evidence.ts (stripYamlComment, BLOCK_SCALAR_INDICATOR, isBlockScalarHeader).
  • Replace the old /^[|>][+-]?\d*$/ checks in parseSimpleFrontmatter and findDuplicateFrontmatterKeys so chomping/indent permutations (|2-, >2+, etc.) and trailing inline comments (| # note) are recognized.
  • Add regression tests mirroring content-lane-source-evidence.test.ts.

Closes #9290

Scope

Validation

Mirror source-evidence.ts block-scalar grammar so chomping/indent permutations and trailing inline comments are recognized in parseSimpleFrontmatter and findDuplicateFrontmatterKeys.

Closes JSONbored#9290
@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

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
88 1 87 0
View the top 1 failed test(s) by shortest run time
test/unit/content-lane-duplicates.test.ts > parseSimpleFrontmatter > recognizes block-scalar headers with chomping/indent in either order and trailing comments (#9290)
Stack Traces | 0.0115s run time
AssertionError: expected 'line one line two' to be 'line one\nline two' // Object.is equality

- Expected
+ Received

- line one
- line two
+ line one line two

 ❯ test/unit/content-lane-duplicates.test.ts:67:29

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 14:19:19 UTC

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

🛑 Suggested Action - Fix Blockers

Review summary
This PR extracts a shared `isBlockScalarHeader`/`stripYamlComment`/`BLOCK_SCALAR_INDICATOR` helper in duplicates.ts and swaps the old `/^[|>][+-]?\d*$/` check for it in both `parseSimpleFrontmatter` and `findDuplicateFrontmatterKeys`, mirroring the existing pattern in source-evidence.ts. The new regex `^[|>](?:[+-]?\d?|\d[+-]?)$` correctly accepts both chomping-then-indent and indent-then-chomping orders (`|2-`, `|-2`), and comment-stripping is applied before the test so `| # note` style headers are recognized — I traced both call sites and the logic is sound. Tests exercise all 12 indicator permutations plus three comment-trailing cases for both functions, which is solid regression coverage for a narrow, well-scoped fix tied to #9290.

Nits — 4 non-blocking
  • src/review/content-lane/duplicates.ts:56-59 — `unquoteYamlScalar` still inlines its own `.replace(/\s+#.*$/, "").trim()` instead of calling the new `stripYamlComment` helper, so the comment-stripping regex is now duplicated in two places; consider having `unquoteYamlScalar` call `stripYamlComment` directly.
  • The two FAILED checks (`validate`, `validate-tests`) have no detail provided, and given the branch is 1 commit behind the current default branch, that's a plausible cause worth ruling out by rebasing before assuming a defect in this diff.
  • src/review/content-lane/duplicates.ts:56-59 — replace the inline comment-stripping in `unquoteYamlScalar` with a call to `stripYamlComment(trimmed)` to keep the two comment-stripping code paths from drifting apart.
  • Rebase onto the latest default branch to see whether `validate`/`validate-tests` still fail, since the branch is reported 1 commit behind.

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 #9290
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: 130 registered-repo PR(s), 57 merged, 4 issue(s).
Contributor context ✅ Confirmed Gittensor contributor joaovictor91123; Gittensor profile; 130 PR(s), 4 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: moderate
Linked issue satisfaction

Addressed
The PR ports the exact BLOCK_SCALAR_INDICATOR/isBlockScalarHeader/stripYamlComment logic from source-evidence.ts into duplicates.ts and applies it at both call sites (parseSimpleFrontmatter and findDuplicateFrontmatterKeys), matching the requested behavior for digit-before/after-chomp and trailing-comment cases. It also adds tests in the existing duplicates.ts test file covering |2-, |- with comme

Review context
  • Author: joaovictor91123
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, JavaScript, MDX, TypeScript, C++, CSS, Rust
  • Official Gittensor activity: 130 PR(s), 4 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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.

@loopover-orb loopover-orb Bot closed this Jul 27, 2026
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/content-lane: duplicates.ts's block-scalar detection lags source-evidence.ts's hardened version (comment-tolerance, digit order)

1 participant