minutes icon indicating copy to clipboard operation
minutes copied to clipboard

`resummarize` hard-fails on an unknown `speaker_map[].source`, a field its own contract preserves untouched (and the schema doc invites the invalid value)

Open jmh1313 opened this issue 4 months ago • 1 comments

Summary

An out-of-vocabulary speaker_map[].source value aborts the whole frontmatter parse, which hard-blocks minutes resummarize on that file, even though resummarize's documented field contract lists speaker_map as preserved untouched. The command refuses to run because of a value it would never have read or written.

Two things make this worth fixing beyond the single bad value:

  1. The schema doc actively generates this mistake. docs/architecture/frontmatter-schema.md:187 gives the valid enum, then eleven lines later labels the confidence ladder - **L3** (user-confirmed): the user explicitly confirmed this attribution. (frontmatter-schema.md:198). Someone hand-editing a meeting file reads "L3 (user-confirmed)" and writes source: user-confirmed. That is exactly what happened here. To be clear about provenance: user-confirmed is not, and as far as I can tell never has been, a value Minutes itself emits. git log -S'UserConfirmed' --all returns nothing, and minutes confirm writes AttributionSource::Manual to the sidecar overlay store (crates/core/src/overlays.rs:163,199,227,233) rather than a provenance string back into markdown. So this is a docs-vs-schema trap, not a backward-compatibility break.

  2. Hand-edited and imported files are a supported input class. The desktop app's "Open in Editor" button invites direct edits, and that premise is baked into resummarize itself ("the feature's own premise is that this file is open in an editor right now", crates/core/src/resummarize.rs:735). minutes import text (#516) ingests third-party archives that never went through the pipeline. Both paths can introduce values the strict enum has never seen. A provenance label should not be able to make a meeting unreadable.

Environment

  • Minutes 0.24.0 (installed via silverstein/tap)
  • macOS 26

Repro

Minimal synthetic file, 17 lines, no real meeting data:

---
title: "Minimal repro"
type: meeting
date: 2026-01-01T09:00:00-05:00
duration: 1m
speaker_map:
- speaker_label: SPEAKER_1
  name: Alice
  confidence: high
  source: user-confirmed
---

## Summary

Placeholder.

## Transcript

SPEAKER_1: Hello.
$ minutes resummarize --engine claude ~/meetings/2026-01-01-minimal-repro.md
Running the summarization model (engine: claude) — preview: no changes written without --apply...
Error: frontmatter does not parse: speaker_map[0].source: unknown variant `user-confirmed`, expected one of `deterministic`, `llm`, `enrollment`, `manual`, `ml-bleed-degraded`, `stem-recovery` at line 10 column 11

Same failure with --apply. I hit it originally on a real meeting file whose speaker_map I had corrected by hand.

Where it happens

resummarize whole-struct-deserializes the frontmatter:

// crates/core/src/resummarize.rs:745
let fm: Frontmatter =
    serde_yaml::from_str(fm_str).map_err(|e| ResummarizeError::Frontmatter(e.to_string()))?;

AttributionSource is a strict externally-tagged enum defined in two crates, and the two definitions have to be kept in sync by hand:

  • crates/core/src/diarize.rs:133
  • crates/reader/src/types.rs:197
  • plus a third hand-maintained copy in TypeScript at crates/sdk/src/reader.ts:49-55

The sharpest part: resummarize's own documented field contract (crates/core/src/resummarize.rs:664) lists speaker_map among the fields preserved untouched. So the command hard-fails on a field it has promised not to modify, and it fails before the model call, which makes the operation impossible rather than merely degraded.

Worth noting the inconsistency in strictness: ProcessingWarning.reason is a plain String (crates/reader/src/types.rs:65), so an arbitrary value there parses fine, while an arbitrary value in speaker_map[].source is fatal to the entire document.

Asks

  1. Make an unknown speaker_map[].source degrade rather than abort. Deserialize it to an Unknown(String) variant (or #[serde(other)]), warn, and keep the raw string on write-back so provenance is preserved rather than silently rewritten. A label describing how an attribution was derived should never be able to brick a meeting file, especially for commands that do not consume it.

  2. Fix the docs trap. frontmatter-schema.md:190-198 presents L0 through L3 as parallel to the source enum, but only L0, L1, and L2 have matching variants (deterministic, llm, enrollment). L3's label, user-confirmed, has no matching variant; the actual one is manual. Either rename the L3 label to manual, or state explicitly that the L-levels are a conceptual ladder and not the on-disk vocabulary.

  3. Consider a repair path for out-of-vocabulary enum values. minutes consistency already walks the corpus, so it could flag (and optionally --fix) frontmatter values that fall outside the current schema, keeping a corpus that has drifted loadable. Happy to file this separately if you would rather keep this issue narrow.

If (1) sounds right, I am glad to take a swing at the PR.

Workaround

Rewrote the single value to manual, which round-trips correctly. resummarize then ran clean.

jmh1313 avatar Jul 29 '26 05:07 jmh1313

Fixed in #597. Thank you for this, and welcome.

This is an unusually good first report. You did not just find a bad value, you found the thing that produces bad values: the schema doc listed the valid enum and then eleven lines later labelled the ladder L3 (user-confirmed), so a careful person hand-editing a file lands on exactly the invalid string you did. Checking git log -S'UserConfirmed' to establish that Minutes has never emitted it, and therefore that this is a docs trap rather than a compatibility break, is the part that made the fix obvious.

The observation I found sharpest: resummarize's own field contract lists speaker_map as preserved untouched, and it fails before the model call. So it refused to run because of a value it had promised not to read or write. That framing is what decided the shape of the fix.

Landed:

  • AttributionSource gains an untagged Unknown(String) in both definitions. Your ask that the raw string round-trip rather than be silently rewritten is honored: the label survives an --apply verbatim, so provenance is preserved rather than normalized away by a command that never consumed it.
  • The docs trap is closed. The L-levels are now explicitly a conceptual ladder rather than the on-disk vocabulary, with the source: value spelled out per level and L3 called out as manual.
  • The TypeScript copy in the SDK is widened to match, since you correctly flagged it as a third hand-maintained definition.

Verified against your exact repro: unfixed reproduces your error message, fixed completes both preview and --apply, and the file still reads source: user-confirmed afterwards.

Not doing ask 3 here. A minutes consistency --fix repair path for out-of-vocabulary values is worth having, but it is a feature rather than part of unbreaking the read path, and I would rather ship the fix now. If you want to open a separate issue for it I will track it.

silverstein avatar Jul 29 '26 14:07 silverstein