Skip to content

Commit 02bd1f7

Browse files
committed
fix(provenance): name every incompleteness guard inside the registry
- recordResolved reported 'unspecified' for the same catalog mismatch recordResolvedAtInputPath already names 'unverified-resolved-entry' - wire restored-checkpoint-unavailable at the requireRestoredProvenance guard - drop filter-capacity-exceeded (that site returns a result, never marks incomplete; its warn already names itself) and add reasons for the real unnamed sites: provenance capacity, fork inheritance, tool-call scope mismatch, constructed-incomplete
1 parent e6fd28d commit 02bd1f7

1 file changed

Lines changed: 15 additions & 11 deletions

File tree

apps/sim/executor/utils/resolved-secret-trace-registry.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,12 @@ type ResolvedSecretIncompletenessReason =
2929
| 'unverified-resolved-entry'
3030
| 'projection-mismatch'
3131
| 'unresolved-placeholder'
32-
| 'filter-capacity-exceeded'
32+
| 'provenance-capacity-exceeded'
3333
| 'restored-checkpoint-unavailable'
34+
| 'constructed-incomplete'
35+
| 'inherited-incomplete-source'
36+
| 'inherited-incomplete-input-path'
37+
| 'tool-call-scope-mismatch'
3438
| 'value-provenance-untrusted'
3539
| 'value-provenance-import-failed'
3640
| 'value-provenance-filter-incomplete'
@@ -578,7 +582,7 @@ export class ResolvedSecretTraceRegistry {
578582
this.scope = scope ? cloneProvenanceScope(scope) : undefined
579583
this.completeProvenanceEnvelopeBytes = serializedProvenanceEnvelopeByteSize(true, this.scope)
580584
if (this.completeProvenanceEnvelopeBytes > MAX_SERIALIZED_PROVENANCE_BYTES) {
581-
this.markIncomplete()
585+
this.markIncomplete('provenance-capacity-exceeded')
582586
}
583587
let catalogEntriesSeen = 0
584588
for (const entry of catalogEntries) {
@@ -606,7 +610,7 @@ export class ResolvedSecretTraceRegistry {
606610
}
607611
this.copyResolvedInputPathsTo(fork)
608612
this.copyIncompleteInputPathsTo(fork)
609-
if (!this.complete) fork.markIncomplete()
613+
if (!this.complete) fork.markIncomplete('inherited-incomplete-source')
610614
return fork
611615
}
612616

@@ -617,12 +621,12 @@ export class ResolvedSecretTraceRegistry {
617621
): ResolvedSecretTraceRegistry {
618622
const fork = new ResolvedSecretTraceRegistry(this.catalog.values(), this.scope)
619623
if (!this.complete) {
620-
fork.markIncomplete()
624+
fork.markIncomplete('inherited-incomplete-source')
621625
return fork
622626
}
623627

624628
if (this.hasIncompleteInputPathOverlapping(paths)) {
625-
fork.markIncomplete()
629+
fork.markIncomplete('inherited-incomplete-input-path')
626630
return fork
627631
}
628632

@@ -646,14 +650,14 @@ export class ResolvedSecretTraceRegistry {
646650
fork.addActiveEntry({ ...entry }, { propagated: true })
647651
}
648652
}
649-
if (this.isPermanentlyIncomplete()) fork.markIncomplete()
653+
if (this.isPermanentlyIncomplete()) fork.markIncomplete('inherited-incomplete-source')
650654
return fork
651655
}
652656

653657
/** Merges one settled tool-call registry into the turn-scoped registry. */
654658
mergeToolCallRegistry(child: ResolvedSecretTraceRegistry): void {
655659
if (!scopesMatch(this.scope, child.scope) || !child.isComplete()) {
656-
this.markIncomplete()
660+
this.markIncomplete('tool-call-scope-mismatch')
657661
return
658662
}
659663

@@ -675,7 +679,7 @@ export class ResolvedSecretTraceRegistry {
675679
if (resolvedValue.length === 0) return false
676680
const entry = this.getVerifiedResolvedEntry(name, resolvedValue)
677681
if (!entry) {
678-
this.markIncomplete()
682+
this.markIncomplete('unverified-resolved-entry')
679683
return false
680684
}
681685

@@ -1722,7 +1726,7 @@ export class ResolvedSecretTraceRegistry {
17221726
entryBytes >
17231727
MAX_SERIALIZED_PROVENANCE_BYTES
17241728
) {
1725-
this.markIncomplete()
1729+
this.markIncomplete('provenance-capacity-exceeded')
17261730
return
17271731
}
17281732
this.activeEntries.set(key, entry)
@@ -1783,7 +1787,7 @@ export async function createResolvedSecretTraceRegistry(
17831787
options.restoreTrusted === true &&
17841788
options.restoredCheckpointVersion !== undefined
17851789
) {
1786-
registry.markIncomplete()
1790+
registry.markIncomplete('restored-checkpoint-unavailable')
17871791
}
17881792

17891793
return registry
@@ -1794,6 +1798,6 @@ export function createIncompleteResolvedSecretTraceRegistry(
17941798
scope?: ResolvedSecretTraceScopeV1
17951799
): ResolvedSecretTraceRegistry {
17961800
const registry = new ResolvedSecretTraceRegistry([], scope)
1797-
registry.markIncomplete()
1801+
registry.markIncomplete('constructed-incomplete')
17981802
return registry
17991803
}

0 commit comments

Comments
 (0)