@@ -139,25 +139,28 @@ class TraceSecretProjectionError extends Error {
139139 */
140140class TraceContentBudgetError extends TraceSecretProjectionError { }
141141
142- /** Identifies the run behind a projection warning; every field is a stored id or a mode flag. */
142+ /**
143+ * Identifies the run behind a projection warning. `phase` says whether the run was being written
144+ * to the log or a stored log was being read for display.
145+ */
143146interface ProjectionLogDetails {
144147 executionId ?: string
145148 workflowId ?: string
146149 workspaceId ?: string
147- readOnly : boolean
150+ phase : 'read' | 'write'
148151}
149152
150153function projectionLogDetails (
151154 store : LargeValueStoreContext ,
152- readOnly : boolean
155+ phase : ProjectionLogDetails [ 'phase' ]
153156) : ProjectionLogDetails {
154157 return {
155158 ...filterUndefined ( {
156159 executionId : store . executionId ,
157160 workflowId : store . workflowId ,
158161 workspaceId : store . workspaceId ,
159162 } ) ,
160- readOnly ,
163+ phase ,
161164 }
162165}
163166
@@ -203,7 +206,7 @@ function createProjectionContext(
203206 sourceLargeValueBytes : 0 ,
204207 storedLargeValueBytes : 0 ,
205208 storedLargeValueCount : 0 ,
206- logDetails : projectionLogDetails ( store , ! allowLargeValueWrites ) ,
209+ logDetails : projectionLogDetails ( store , allowLargeValueWrites ? 'write' : 'read' ) ,
207210 }
208211}
209212
@@ -1647,7 +1650,7 @@ export async function enforceTraceSpanSecretInvariant(
16471650 return traceSpans
16481651 } catch ( error ) {
16491652 logger . warn ( 'Trace secret invariant failed; retaining structural spans only' , {
1650- ...projectionLogDetails ( options . store , false ) ,
1653+ ...projectionLogDetails ( options . store , 'write' ) ,
16511654 failure : describeProjectionFailure ( error ) ,
16521655 } )
16531656 return structuralOnlyTraceSpans ( traceSpans )
@@ -1667,7 +1670,7 @@ export async function projectTraceSpansForSecrets(
16671670 }
16681671
16691672 const allowLargeValueWrites = options . allowLargeValueWrites !== false
1670- const logDetails = projectionLogDetails ( options . store , ! allowLargeValueWrites )
1673+ const logDetails = projectionLogDetails ( options . store , allowLargeValueWrites ? 'write' : 'read' )
16711674 try {
16721675 const matcher = createResolvedSecretMatcher ( options . registry . getActiveMatches ( ) , {
16731676 preserveNamedProvenanceLabels : true ,
0 commit comments