@@ -232,6 +232,7 @@ func (p *CodexProvider) Parse(
232232 Result: ParseResult{Session: *sess, Messages: msgs},
233233 DataVersion: DataVersionCurrent,
234234 }},
235+ ResultSetComplete: true ,
235236 }, nil
236237}
237238```
@@ -455,6 +456,7 @@ type ParseOutcome struct {
455456 Results []ParseResultOutcome
456457 ExcludedSessionIDs []string
457458 SourceErrors []SourceError
459+ ResultSetComplete bool
458460 ForceReplace bool
459461 SkipReason SkipReason
460462}
@@ -521,12 +523,20 @@ Runtime behavior:
521523 retryable ` SourceError ` affects only the failed session unless the provider
522524 reports a whole-source ` error ` .
523525- Data-version writes are per result, but clean skip-cache persistence remains
524- source/fingerprint scoped. The engine may write a clean skip-cache entry for a
525- ` SourceRef ` only when all returned results are ` DataVersionCurrent ` and there
526- are no retryable ` SourceErrors ` . Any ` DataVersionNeedsRetry ` result or
527- retryable per-session error suppresses the clean skip-cache entry for the
528- whole ` FingerprintKey ` , so future sync can retry the stale session even if
529- other sessions from the same source are current.
526+ source/fingerprint scoped. ` ResultSetComplete ` means the provider has
527+ accounted for the complete logical session set represented by the
528+ ` SourceRef ` /` FingerprintKey ` : returned results, explicit exclusions, and clean
529+ replacements cover every retained session for that source. The engine may
530+ write a clean skip-cache entry only when ` ResultSetComplete ` is true, every
531+ returned result is ` DataVersionCurrent ` , there are no ` SourceErrors ` , and any
532+ previously persisted rows for that ` FingerprintKey ` are either returned,
533+ listed in ` ExcludedSessionIDs ` , or covered by a clean ` ForceReplace ` .
534+ - Any ` DataVersionNeedsRetry ` result, retryable per-session error, non-retryable
535+ per-session error, or incomplete result set suppresses the clean skip-cache
536+ entry for the whole ` FingerprintKey ` . Non-retryable errors may be recorded as
537+ diagnostics or failure-cache entries, but they do not prove the source is
538+ clean because a future parser version or source change may still need to
539+ revisit the same logical session set.
530540- During a partial multi-session parse, existing persisted rows that are absent
531541 from ` Results ` are retained unless their IDs are listed in
532542 ` ExcludedSessionIDs ` or the provider completes a clean ` ForceReplace ` parse
@@ -875,6 +885,9 @@ Required tests:
875885- SQLite fan-out source key, virtual path, and per-session error tests.
876886- Data-version tests for current, skipped, retry-needed, and mixed per-session
877887 parse outcomes from one source.
888+ - Skip-cache tests for complete clean multi-session parses, incomplete
889+ multi-session parses, retry-needed results, retryable `SourceErrors`, and
890+ non-retryable `SourceErrors`.
878891- Fingerprint performance tests or benchmarks for large roots and composite
879892 sources, with the pass criteria from the fingerprint section.
880893- Provider harness tests for discovery, fingerprint, parse, source lookup, and
@@ -905,7 +918,8 @@ decisions from those structures:
905918 source are still written;
906919- retryable failure: do not cache skip by unchanged mtime and do not mark the
907920 affected source/session current for the parser data version;
908- - non-retryable failure: eligible for skip-cache persistence;
921+ - non-retryable per-session failure: eligible for failure-cache persistence, but
922+ not for a clean source skip-cache entry;
909923- full parse fallback from incremental: typed outcome flag;
910924- successful lower-resolution fallback: per-result `DataVersionNeedsRetry` plus
911925 `RetryReason`;
0 commit comments