Skip to content

Canonical Filament extraction engine + malformed-document parse failure (#127)#11

Closed
kreneskyp wants to merge 3 commits into
mainfrom
task-9-10-canonical-filament-extraction
Closed

Canonical Filament extraction engine + malformed-document parse failure (#127)#11
kreneskyp wants to merge 3 commits into
mainfrom
task-9-10-canonical-filament-extraction

Conversation

@kreneskyp

Copy link
Copy Markdown
Contributor

Summary

This branch adds the canonical one-document Filament extraction engine (FR-040/FR-041, US-015, NFR-020) and the shared graph fixture corpus, and fixes issue #127: the engine treated a malformed document as a clean extraction, so per-document parse failures never reached Filament's index_errors.

#127 fix — malformed frontmatter now surfaces a parse failure

The engine previously returned only a no_frontmatter informational diagnostic (empty errors) whenever parse_document yielded no frontmatter — including when a complete but unparsable ------ fence block was present. The MarkStale → apply_stale path only records documents with a non-empty errors list, so those failures vanished.

Fix — parser reports the fact, boundary owns the policy:

  • extract_frontmatter (FR-006) now returns a typed FrontmatterStatus { Absent, Present, Malformed } — the single authority for the classification. Parity-preserving: frontmatter/body outputs are byte-identical, so the TS/Py sweep is unaffected. Empty / whitespace / comment-only blocks (YAML null) classify as Absent (a clean skip — e.g. a ---\n\n--- thematic-break pair), not Malformed.
  • extract_filament_core reads that status on the no-frontmatter branch (cold path only) and, for Malformed, emits a parse_failed error plus a frontmatter_unparsable error-severity diagnostic so the failure reaches index_errors.

Spec & tests

  • Split the FR-040 behavior bullet; added FR-040-AC-6 and FR-006-AC-7 with a CR-010 note.
  • Matrix rows TC-657 (filament boundary) and TC-658 (parser status), coverage 339 → 341.
  • Gap-analysis SpecReview under reviews/ (Verdict CONDITIONAL; FND-002 resolved, FND-001 accepted).

Verification

  • make ci locally: 344 lib + all integration tests pass, clippy -D warnings clean, fmt-check / audit-unsafe / deny green, spec dogfood green, SpecReview quire-validated.
  • Incidental: fixed two pre-existing clippy errors (extract_tier2 complex return type → Tier2Extraction alias; stable_id needless borrow) that a newer stable clippy flags and that block the gate.

Closes #127

🤖 Generated with Claude Code

kreneskyp and others added 3 commits June 29, 2026 14:14
The canonical Filament extraction engine treated a document with a complete
but unparsable frontmatter fence block as a clean extraction: it returned
only a `no_frontmatter` informational diagnostic with an empty `errors` list,
so per-document parse failures never reached Filament's `index_errors` (the
MarkStale -> apply_stale path only records documents with a non-empty
`errors` list).

Make the parser the single authority for the classification and the Filament
boundary own the policy:

- `extract_frontmatter` (FR-006) now returns a typed `FrontmatterStatus`
  { Absent, Present, Malformed }. Parity-preserving: `frontmatter`/`body`
  outputs are byte-identical, so the TS/Py sweep is unaffected. Empty /
  whitespace / comment-only blocks (YAML null) classify as `Absent` (a clean
  skip, e.g. a `---`\n\n`---` thematic-break pair), not `Malformed`.
- `extract_filament_core` reads that status on the no-frontmatter branch
  (cold path only) and, for `Malformed`, emits a `parse_failed` error plus a
  `frontmatter_unparsable` error-severity diagnostic so the failure reaches
  index_errors.

Spec: split the FR-040 behavior bullet, add FR-040-AC-6 and FR-006-AC-7 with
a CR-010 note; matrix TC-657/TC-658 (coverage 339 -> 341). Gap-analysis
SpecReview added under reviews/.

Incidental: fix two pre-existing clippy -D warnings (extract_tier2 complex
return type -> Tier2Extraction alias; stable_id needless borrow) that a newer
stable clippy flags and that block the CI gate.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kreneskyp
kreneskyp requested a review from a team as a code owner July 11, 2026 18:54
@kreneskyp

Copy link
Copy Markdown
Contributor Author

Superseded by the rebased-onto-main PR (canonical Filament extraction under FR-045/FR-046). This branch was built on a stale base (12 commits behind main, colliding FR-040/FR-041/CR-010/TC numbering) and can't merge as-is.

@kreneskyp kreneskyp closed this Jul 11, 2026
@kreneskyp
kreneskyp deleted the task-9-10-canonical-filament-extraction branch July 12, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant