Skip to content

source-evidence.ts's parseSimpleFrontmatter silently drops a scalar source field written as a YAML block/flow sequence, unlike duplicates.ts's parser #8016

Description

@JSONbored

Context

src/review/content-lane/source-evidence.ts and src/review/content-lane/duplicates.ts each hand-roll their own parseSimpleFrontmatter/unquoteYamlScalar — a known cross-file divergence class in this codebase (see the #7250 fix at content-repo-spec.ts:132 for an earlier snake_case parity gap between these exact two files).

duplicates.ts's parser (lines 59-101) has three branches: block-scalar, block/flow-sequence (else if (inline === ""), collects - item lines), and plain scalar. source-evidence.ts's parser (lines 131-170) has only two: block-scalar and plain scalar (else if (inline !== "")) — the sequence branch was never ported. When inline === "" and the line isn't a block-scalar header, the key is never written into fields at all.

Concretely: a submission that writes a scalar-only field like source_url: as a block sequence (source_url:\n - https://example.com) is captured by duplicates.ts (used for duplicate-detection) but is invisible to extractSubmittedSourceUrls/checkSubmittedSourceEvidence (used for the fetch-reachability hard-close gate) — that URL never gets fetch-verified, silently weakening the source-evidence gate for a YAML shape a contributor might reasonably use, since the genuinely-list fields (sourceUrls, retrievalSources) look identical in YAML.

⚠️ Required pattern — read duplicates.ts's three-branch parseSimpleFrontmatter/unquoteYamlScalar (lines 59-101) before starting. Port the missing block/flow-sequence branch into source-evidence.ts's parser exactly — do not write a new parsing strategy.

Requirements

  • source-evidence.ts's parseSimpleFrontmatter must handle the block/flow-sequence case the same way duplicates.ts's does, so a scalar-only field written as a YAML sequence is still captured into fields.
  • No behavior change for the existing block-scalar and plain-scalar cases.

Deliverables

  • source-evidence.ts's frontmatter parser gains the missing sequence branch, ported from duplicates.ts.
  • extractSubmittedSourceUrls/checkSubmittedSourceEvidence correctly capture a source_url (or equivalent scalar field) written as a YAML block/flow sequence.

Test Coverage Requirements

src/** — 99%+ Codecov patch target, both branches. Add a test with a scalar field written as a YAML sequence, asserting it's captured and fetch-verified; existing block-scalar/plain-scalar tests continue to pass unmodified.

Expected Outcome

source-evidence.ts and duplicates.ts parse the same YAML frontmatter shapes identically, closing the same class of parity gap #7250 already fixed once between these two files.

Links & Resources

Metadata

Metadata

Assignees

No one assigned

    Labels

    gittensor:bugGittensor-scored bug fix — scores a 0.05x multiplier.help wantedExtra attention is needed

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions