Skip to content

fix(content-lane): split a scalar source field's multi-item block sequence per URL - #9898

Closed
RealDiligent wants to merge 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-content-lane-source-url-seq-9668
Closed

fix(content-lane): split a scalar source field's multi-item block sequence per URL#9898
RealDiligent wants to merge 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-content-lane-source-url-seq-9668

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Summary

parseSimpleFrontmatter (src/review/content-lane/source-evidence.ts) collapses a block sequence to a comma-joined string, and for a scalar source field that value flows to scalarSourceUrlValues, which only knows how to split the flow ([a, b]) form. So a documentationUrl authored as a two-item block sequence yielded the single string "https://a.example/1, https://b.example/2". new URL() throws on that, so validateFetchableSourceUrl returns outcome: "invalid_url"status: "hard_failure", blocking: true, the whole report "failed", and sourceEvidenceCloseDecision emits a "dead or invalid source URL" close/manual on a submission whose sources are both live.

The sibling list path (listSourceUrlValues) already splits each - item into its own SubmittedSourceUrl; only the scalar path collapsed. #8016's tests covered only the single-item sequence (a one-item join produces a valid URL), which is why this went undetected.

Fix

Add scalarSequenceItems(source, field), which reads the raw frontmatter block and returns one raw value per - item when the field is authored as a bare block sequence (field: with an empty inline value) — mirroring listSourceUrlValues' - item grammar. The scalar-field loop uses it to emit one SubmittedSourceUrl per item. For every non-sequence form (an inline scalar, a flow [a, b] list, or a block scalar |/>) it returns null, so the existing parseSimpleFrontmatter + scalarSourceUrlValues reader is unchanged. A single-item sequence still yields exactly one URL with today's value, and a genuinely malformed value still hard-fails — the change removes a false positive without weakening the real check.

Tests

Added to test/unit/content-lane-source-evidence.test.ts:

  • A scalar field carrying a two-item block sequence produces two SubmittedSourceUrl entries with the two distinct URLs.
  • checkSubmittedSourceEvidence over that two-item field with a stub fetchImpl returning 200 for both reports status: "passed" (today: "failed" / invalid_url).
  • The single-item sequence case is byte-identical to today.
  • A genuinely malformed value (notaurl) still yields outcome: "invalid_url" / status: "hard_failure".

The two multi-item cases fail against the current joined-string behaviour. Full file passes (92/92).

Closes #9668

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 29, 2026 19:42
@loopover-orb

loopover-orb Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-29 19:50:46 UTC

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

🛑 Suggested Action - Fix Blockers

Review summary
The change correctly addresses the issue where scalar source fields with block sequences were collapsed into a single string, causing validation failures. The new `scalarSequenceItems` function splits these sequences into individual URLs, and the tests verify both regression fixes and existing validation logic. The code aligns with existing parsing conventions and maintains backward compatibility.

Nits — 4 non-blocking
  • The `scalarSequenceItems` function could benefit from more explicit error handling for malformed block sequences (e.g., non-`-` lines without proper indentation).
  • The regex pattern `/^\s*-*\s*(.*?)\s*$/` in `scalarSequenceItems` might not fully account for edge cases with varying whitespace or formatting.
  • Consider adding a unit test for a block sequence with leading/trailing whitespace to ensure robustness.
  • Document the expected formatting for block sequences in the relevant YAML parsing guidelines to avoid future confusion.

CI checks failing

  • codecov/patch — 71.42% of diff hit (target 99.00%)

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 #9668
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: 251 registered-repo PR(s), 99 merged, 38 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 251 PR(s), 38 issue(s).
Improvement ✅ Minor risk: clean · value: minor
Linked issue satisfaction

Addressed
The diff adds scalarSequenceItems mirroring listSourceUrlValues to split a scalar field's block sequence into one URL per item while leaving inline/flow/single-item forms unchanged, and includes all four required test cases (two-item split, end-to-end checkSubmittedSourceEvidence pass, single-item identical behavior, and malformed value still hard-failing).

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 251 PR(s), 38 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

@superagent-security

Copy link
Copy Markdown
Contributor

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

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

parseSimpleFrontmatter collapses a block sequence to a comma-joined string, and for a
scalar source field that value goes to scalarSourceUrlValues, which only splits the
flow (`[a, b]`) form. So a documentationUrl authored as a two-item block sequence
yielded the single string "https://a.example/1, https://b.example/2"; new URL() throws
on it, producing outcome invalid_url / hard_failure and failing the whole
source-evidence report on a submission whose sources are both live. JSONbored#8016's tests
covered only the single-item case (a one-item join is a valid URL), so it went
undetected.

Add scalarSequenceItems, which reads the raw frontmatter block and returns one value
per `- item` for a bare block sequence (mirroring listSourceUrlValues), used by the
scalar-field loop; a non-sequence form (inline, flow, or block scalar) returns null and
keeps the existing scalar reader. A single-item sequence still yields exactly one URL,
and a genuinely malformed value still hard-fails.

Closes JSONbored#9668
@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 71.42857% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.36%. Comparing base (af98111) to head (5b1a54c).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/review/content-lane/source-evidence.ts 71.42% 0 Missing and 6 partials ⚠️

❌ Your patch check has failed because the patch coverage (71.42%) is below the target coverage (99.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #9898       +/-   ##
===========================================
- Coverage   91.76%   79.36%   -12.41%     
===========================================
  Files         921      282      -639     
  Lines      113173    58785    -54388     
  Branches    27244     8688    -18556     
===========================================
- Hits       103854    46653    -57201     
- Misses       8034    11843     +3809     
+ Partials     1285      289      -996     
Flag Coverage Δ
backend 97.26% <71.42%> (+1.57%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/review/content-lane/source-evidence.ts 97.26% <71.42%> (-2.74%) ⬇️

... and 772 files with indirect coverage changes

@loopover-orb

loopover-orb Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (codecov/patch)). 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 29, 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.

orb(content-lane): a multi-item source-URL sequence is joined into one unparseable URL and

1 participant