Repository navigation
fix(sleep): reject unknown transcript source names in harvest_for_config - #354
Conversation
|
Merged — thank you. A misspelled or unknown Verified: your rejection test fails on the previous One more non-blocking follow-up: the lower-casing happens only inside Verified integration main: |
… harvested source (#363) #354 normalized transcript_source only inside harvest_for_config, while the per-(project, source) harvest checkpoint and the tasks document still used the raw config value. "Codex" therefore harvested Codex but read and advanced a "<project>::Codex" cursor, which may hold a time written while that spelling silently harvested Claude, so older Codex sessions could be skipped (#312). A non-string value raised AttributeError. Add normalize_transcript_source() and use it for the harvest, for the cursor in run_sleep_cycle and the handoff pin, and for the tasks document. The cycle now validates the source before it creates the night's staging dir. Canonical names keep byte-identical cursor keys, and the legacy bare-project cursor is still read as the fallback. Also note the #350/#354 fail-loudly change in CHANGELOG. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Summary
Currently,
harvest_for_config()falls through toharvest(cfg.transcripts_dir)(the Claude harvester) when an unrecognized transcript source name or typo is configured. This causes misconfigurations in config files or programmatic runs to silently harvest Claude transcripts rather than notifying the user of the invalid source.This change explicitly validates r
transcript_sourceagainstSUPPORTED_SOURCESinharvest_for_config(), raising a descriptiveValueErroron unknown sources, while preserving the default fallback for empty/None inputs and case-insensitivity.Changes
In
skillopt_sleep/harvest_sources.py: defineSUPPORTED_SOURCES, validatesource, and raiseValueErrorlisting valid sources when unrecognized.In
tests/test_sleep_engine.py: addtest_harvest_for_config_rejects_unknown_sourceandtest_harvest_for_config_accepts_empty_and_case_insensitive_source.