Keep transcript decoding and encoding on typed data

This commit is contained in:
2026-11-16 03:56:54 +00:00
parent b63c8af467
commit f465496dd8
19 changed files with 286 additions and 386 deletions

View File

@@ -13,7 +13,7 @@ schema/version marker.
| Segment field | Type and validation |
| --- | --- |
| `id` | Optional integer (or null). Supplied IDs must be unique; missing IDs are accepted. |
| `id` | Optional integer (or null) in the Go `int` range for the executable's architecture. Supplied IDs are compared exactly and must be unique. |
| `speaker` | Non-empty string |
| `start`, `end` | Numeric seconds, finite and non-negative; end must be at least start |
| `text` | Non-empty string |
@@ -21,8 +21,8 @@ schema/version marker.
Supply explicit start and end times for meaningful timing. The current decoder
uses zero for missing or null timestamps rather than enforcing their presence.
String validation checks empty values, not whitespace trimming. Normalization can
merge segments and reassign IDs, so source IDs need not match output IDs.
String validation checks for empty values. Normalization can merge segments and
reassign IDs, so source IDs need not match output IDs.
The [tiny transcript](../../examples/tiny-transcript.json) is a complete copyable
input. Invalid JSON, unsupported top-level shapes, empty transcripts, invalid field

View File

@@ -17,7 +17,9 @@ An unsupported key fails validation or resolution rather than selecting an
implicit fallback.
The registry delegates bare segment serialization to the transcript schema
package and uses an envelope encoder for the versioned form. Report construction
package and uses an envelope encoder for the versioned form. Both serialize
the model's typed segment array directly, including native integer IDs and
omitting empty categories. Report construction
receives the selected key separately; see [report assembly](diagnostics-reporting.md).
## Changing an Encoder

View File

@@ -221,6 +221,13 @@ and the distinction between raw and typed debug snapshots. Update the
[input contract](../integrations/transcript-glossary-files.md) and
[encoder internals](../internal/output-schemas.md) where affected.
**Complete.** Source segments decode directly from both accepted JSON shapes.
Exact IDs, clone independence, encoder values, and debug snapshot fidelity were
verified. Processing releases raw bytes after parsing or source capture and
releases the parsed view before normalization. On a 100,000-segment object
fixture (Go 1.27.3, five iterations), parser allocations fell from 240.6 MB to
84.1 MB per operation. The CLI build and full offline suite passed.
## Stage 6 — Correct and simplify normalization
Audit #17, #21, #35, #53, #59, #62 (merge helper).