fix(logs): stop loading execution data and snapshots that reads do not use

Merged
WA
6d ago
+404-67

Summary

  • Status polls no longer select execution_data on every poll: a CASE returns it only for the statuses the poll reads it for (failed for the error; completed when output is requested; always for selected outputs). The rule is one shared function, so the SQL and the in-memory check cannot drift
  • The execution snapshot view no longer loads execution_data while resolving its context. It is read after authorization, so a refused caller never fetches the payload; parent and child snapshots share one chunked reader
  • The paused execution list projects execution_snapshot->'triggerIds' instead of loading whole rows with the serialized executor snapshot (only triggerIds was used)
  • One shared terminal-status predicate replaces the copies in the HITL manager and run-file reads
  • These read paths stay on the primary: a finished run's row can still change (a forced failure, a later cost write), so a replica read would not be self-checking

Type of Change

  • Bug fix

Testing

  • New execution-read-payloads.integration.ts (real Postgres, records every value the client receives): status polls for a running run with output and a completed run without output, the paused list, and a refused snapshot caller all fetch no execution payload (4 cases fail on the pre-fix code); completed-with-output and failed polls still fetch it
  • Unit: lib/logs, lib/workflows/executor, app/api/v1/logs (51 files, 672 tests)
  • check:test-patterns, check:utils, check:comment-hygiene, check:unused-exports, check:file-names, check:explicit-any, check:source-conventions; generators in sync. Type-check and full audits run in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)