I1: warning_agent maps ExtractFailed → "kb-parse-md" (the panic-recovery
emitter in kb-parse-md/src/blocks.rs). Lift-stage warnings from
build_canonical_document are tracked separately and attributed to
"kb-normalize", so the I1 mapping change does not lie about
kb-normalize-originated drops.
I2: ParsedPayload::AudioRef no longer synthesizes Block::AudioRef with
an invalid empty AssetId (would violate AssetId::from_str's 32-hex
invariant). Block is dropped, Warning surfaces in Provenance with src
mention, attributed to kb-normalize (lift-stage decision). TODO(P8)
comment marks this as a placeholder until the audio extractor lands.
I3: NFC-normalize each heading_path string in lift_block before feeding
into id_for_block AND into CommonBlock.heading_path. pulldown-cmark does
not NFC heading text and serde_json_canonicalizer v0.3 does not either,
so canonically-equivalent NFD/NFC inputs would produce different
block_ids without this normalization. Mirrors the existing doc_id NFC
handling via to_posix.
Minors:
- M4: trim Cargo.toml — drop kb-config, serde_json_canonicalizer,
blake3 (unused); keep tracing (now wired) + unicode-normalization
(now used by I3).
- M5: determinism_1000_iterations_under_1s now uses the same 5-block
fixture as block_ordinals_scoped_per_heading_and_kind (extracted into
fixture_blocks_five helper) so the determinism property is exercised
on a real lift_block path, not just an empty Vec. Still < 1s.
- M6: snapshot integration test now passes BodyHints { first_h1:
Some("Code And Table"), .. } and asserts doc.title == "Code And Table"
end-to-end. Baseline JSON updated.
- M7: title/lang edge-case unit tests pin policy: empty string lifts to
empty string; non-stringy values silently drop. Rustdoc updated.
- M10: provenance_contains_stage_events_in_order asserts events[1].at
== events[2].at to pin the shared-now_utc invariant.
New tests (unit, kb-normalize):
- provenance_with_extract_failed_warning_attributes_to_kb_parse_md (I1)
- audio_ref_block_skipped_with_warning (I2)
- nfc_nfd_korean_heading_path_same_block_id (I3)
- title_empty_string_in_user_map_falls_back_to_default (M7)
- title_non_string_in_user_map_silently_drops (M7)
- lang_invalid_shape_silently_drops (M7)
kb-normalize unit tests: 9 → 14. Integration snapshot: 1 (unchanged).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
103 lines
2.1 KiB
JSON
103 lines
2.1 KiB
JSON
{
|
|
"blocks": [
|
|
{
|
|
"common": {
|
|
"block_id": "dd1528c6e84d8a66087cbf6faafd67c6",
|
|
"heading_path": [],
|
|
"source_span": {
|
|
"end": 1,
|
|
"kind": "line",
|
|
"start": 1
|
|
}
|
|
},
|
|
"kind": "heading",
|
|
"level": 1,
|
|
"text": "Code And Table"
|
|
},
|
|
{
|
|
"code": "fn main() {\n println!(\"hi\");\n}",
|
|
"common": {
|
|
"block_id": "68ea34aca04b83413dd8556126ae4584",
|
|
"heading_path": [
|
|
"Code And Table"
|
|
],
|
|
"source_span": {
|
|
"end": 7,
|
|
"kind": "line",
|
|
"start": 3
|
|
}
|
|
},
|
|
"kind": "code",
|
|
"lang": "rust"
|
|
},
|
|
{
|
|
"common": {
|
|
"block_id": "b50a8e941b11f1834ae17adba9e08118",
|
|
"heading_path": [
|
|
"Code And Table"
|
|
],
|
|
"source_span": {
|
|
"end": 12,
|
|
"kind": "line",
|
|
"start": 9
|
|
}
|
|
},
|
|
"headers": [
|
|
"col a",
|
|
"col b"
|
|
],
|
|
"kind": "table",
|
|
"rows": [
|
|
[
|
|
"1",
|
|
"2"
|
|
],
|
|
[
|
|
"3",
|
|
"4"
|
|
]
|
|
]
|
|
}
|
|
],
|
|
"doc_id": "6a9ef317c9c097ff3f6aeb317559bd83",
|
|
"doc_version": 1,
|
|
"lang": "en",
|
|
"metadata": {
|
|
"aliases": [],
|
|
"created_at": "2023-11-14T22:13:20Z",
|
|
"source_type": "markdown",
|
|
"tags": [],
|
|
"trust_level": "primary",
|
|
"updated_at": "2023-11-14T22:13:20Z",
|
|
"user": {},
|
|
"user_id_alias": null
|
|
},
|
|
"parser_version": "kb-normalize-snapshot-test-0",
|
|
"provenance": {
|
|
"events": [
|
|
{
|
|
"agent": "kb-source-fs",
|
|
"at": "2023-11-14T22:13:20Z",
|
|
"kind": "discovered",
|
|
"note": null
|
|
},
|
|
{
|
|
"agent": "kb-parse-md",
|
|
"at": "<stripped>",
|
|
"kind": "parsed",
|
|
"note": "parser_version=kb-normalize-snapshot-test-0"
|
|
},
|
|
{
|
|
"agent": "kb-normalize",
|
|
"at": "<stripped>",
|
|
"kind": "normalized",
|
|
"note": null
|
|
}
|
|
]
|
|
},
|
|
"schema_version": 1,
|
|
"source_asset_id": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
"title": "Code And Table",
|
|
"workspace_path": "notes/code-and-table.md"
|
|
}
|