feat(workflow-executor): make collection schema cache TTL configurable [PRD-430]#1621
Conversation
…e [PRD-430] The collection-schema cache duration was fixed (~10 min) with no way to tune it, so schema changes on the orchestrator were only picked up after that fixed window. Wire a `schemaCacheTtlMs` executor option through the CLI (env var `SCHEMA_CACHE_TTL_MS`), the same way as the other tunables (polling interval, step timeout, max chain depth). SchemaCache already accepted a ttl in its constructor; default behaviour is unchanged (10 min when unset). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Coverage Impact Unable to calculate total coverage change because base branch coverage was not found. Modified Files with Diff Coverage (2)
🛟 Help
|
|
As discussed on Slack - mitigating a cache issue by reducing a refresh delay only reduces the probability of data staleness, it doesn't avoid it completely. How about instead removing TTL entirely and have the orchestrator include a schemaVersion/hash in poll responses ? That way the executor can clear its schema cache when it detects a change which will automatically trigger a new fetch. |
|
good idea, the TTL only lowers the probability of staleness, it doesn’t remove it. |
…cover wiring [PRD-430] Address review feedback on #1621: - schema-cache.ts now imports DEFAULT_SCHEMA_CACHE_TTL_MS from defaults instead of redefining DEFAULT_TTL_MS, so the help text and constructor fallback can't diverge. - build-workflow-executor.test.ts: mock SchemaCache and assert the TTL reaches it (default applied / caller value respected), mirroring the stepTimeoutMs pair. - cli.test.ts: assert the SCHEMA_CACHE_TTL_MS default in the printHelp test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

What
The collection-schema cache duration in the workflow-executor was fixed (~10 min) with no way to configure it. Schema changes on the orchestrator side (added/renamed field or relation, display-field change) were therefore only reflected after that fixed window, with no operator control.
This wires a
schemaCacheTtlMsexecutor option through the CLI via theSCHEMA_CACHE_TTL_MSenv var — exactly like the other executor tunables (POLLING_INTERVAL_MS,STEP_TIMEOUT_MS,MAX_CHAIN_DEPTH).Changes
defaults.ts:DEFAULT_SCHEMA_CACHE_TTL_MS = 10 * 60_000build-workflow-executor.ts: newExecutorOptions.schemaCacheTtlMs, passed tonew SchemaCache(...)(the cache already accepted a TTL in its constructor)cli-core.ts: parseSCHEMA_CACHE_TTL_MS+ document it in--helpcli.test.ts: parse / unset-default / non-numeric-throws coverageNotes
SCHEMA_CACHE_TTL_MSis unset.feat/prd-214-server-step-mapper(workflow-executor is not onmain).fixes PRD-430
🤖 Generated with Claude Code
Note
Make collection schema cache TTL configurable via
schemaCacheTtlMsin workflow executorschemaCacheTtlMsto theExecutorOptionsinterface in build-workflow-executor.ts, passing it to theSchemaCacheconstructor with a fallback toDEFAULT_SCHEMA_CACHE_TTL_MS(10 minutes).SCHEMA_CACHE_TTL_MSas an environment variable in the CLI, parsed viaparsePositiveIntEnv, with help text showing the default value.DEFAULT_SCHEMA_CACHE_TTL_MSconstant to defaults.ts.Changes since #1621 opened
schema-cache.tsto a centralizeddefaultsmodule and updatedSchemaCacheconstructor to useDEFAULT_SCHEMA_CACHE_TTL_MSfrom thedefaultsmodule [801303e]buildInMemoryExecutortest suite to verifySchemaCacheis constructed with correct TTL values [801303e]Macroscope summarized b6caaac.