fix(logs): keep run provenance when compaction drops the execution state by waleedlatif1 · Pull Request #6528 · simstudioai/sim · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
182 changes: 182 additions & 0 deletions apps/sim/lib/logs/execution/logger.test.ts
13 changes: 13 additions & 0 deletions apps/sim/lib/logs/execution/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ export class ExecutionLogger implements IExecutionLoggerService {

const minimal: ExecutionData = {
secretProjectionVersion: SECRET_PROJECTION_VERSION,
...(executionData.resolvedSecretTraceProvenance !== undefined
? { resolvedSecretTraceProvenance: executionData.resolvedSecretTraceProvenance }
: {}),
...(executionData.environment ? { environment: executionData.environment } : {}),
...(executionData.trigger ? { trigger: executionData.trigger } : {}),
...(executionData.billingAttribution
Expand Down Expand Up @@ -1102,8 +1105,18 @@ export class ExecutionLogger implements IExecutionLoggerService {
builtExecutionData.executionState
)

/**
* Duplicated top-level so the display projection can still rebuild its
* registry after compaction drops `executionState`. Read from the
* pre-redaction state: `preservePrivateExecutionStateMetadata` copies the
* provenance across verbatim, and this one also survives redaction
* producing no state at all.
*/
const runProvenance = builtExecutionData.executionState?.resolvedSecretTraceProvenance

const cleanExecutionData: ExecutionData = {
...builtExecutionData,
...(runProvenance !== undefined ? { resolvedSecretTraceProvenance: runProvenance } : {}),
traceSpans: copyTraceSpansWithoutCosts(preparedTraceSpans),
finalOutput: pii.finalOutput as BlockOutputData,
...(pii.workflowInput !== undefined ? { workflowInput: pii.workflowInput } : {}),
Expand Down
87 changes: 87 additions & 0 deletions apps/sim/lib/logs/execution/trace-store.test.ts
Loading
Loading