pipework 0.8.1 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/async/jobs/execute.d.ts +2 -0
- package/dist/async/jobs/execute.d.ts.map +1 -1
- package/dist/async/jobs/execute.js +17 -2
- package/dist/async/jobs/execute.js.map +1 -1
- package/dist/audit/query/cursor.d.ts +7 -0
- package/dist/audit/query/cursor.d.ts.map +1 -0
- package/dist/audit/query/cursor.js +25 -0
- package/dist/audit/query/cursor.js.map +1 -0
- package/dist/audit/query/index.d.ts +5 -0
- package/dist/audit/query/index.d.ts.map +1 -0
- package/dist/audit/query/index.js +3 -0
- package/dist/audit/query/index.js.map +1 -0
- package/dist/audit/query/query.d.ts +49 -0
- package/dist/audit/query/query.d.ts.map +1 -0
- package/dist/audit/query/query.js +119 -0
- package/dist/audit/query/query.js.map +1 -0
- package/dist/audit/schema/audit-record-fields.d.ts +15 -0
- package/dist/audit/schema/audit-record-fields.d.ts.map +1 -0
- package/dist/audit/schema/audit-record-fields.js +50 -0
- package/dist/audit/schema/audit-record-fields.js.map +1 -0
- package/dist/audit/schema/audit-record.d.ts +15 -0
- package/dist/audit/schema/audit-record.d.ts.map +1 -0
- package/dist/audit/schema/audit-record.js +12 -0
- package/dist/audit/schema/audit-record.js.map +1 -0
- package/dist/auth/tenant/scope.js +1 -1
- package/dist/auth/tenant/scope.js.map +1 -1
- package/dist/auth/tenant/scoped-db.d.ts.map +1 -1
- package/dist/auth/tenant/scoped-db.js +1 -2
- package/dist/auth/tenant/scoped-db.js.map +1 -1
- package/dist/cli/commands/check.d.ts +4 -0
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +187 -15
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/codemod.d.ts +6 -0
- package/dist/cli/commands/codemod.d.ts.map +1 -0
- package/dist/cli/commands/codemod.js +63 -0
- package/dist/cli/commands/codemod.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +9 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/config/load.d.ts +23 -0
- package/dist/core/config/load.d.ts.map +1 -1
- package/dist/core/config/load.js +8 -0
- package/dist/core/config/load.js.map +1 -1
- package/dist/core/config/namespace.d.ts +19 -0
- package/dist/core/config/namespace.d.ts.map +1 -1
- package/dist/core/config/schema.d.ts +41 -0
- package/dist/core/config/schema.d.ts.map +1 -1
- package/dist/core/config/schema.js +27 -0
- package/dist/core/config/schema.js.map +1 -1
- package/dist/core/logging/logger.d.ts +3 -1
- package/dist/core/logging/logger.d.ts.map +1 -1
- package/dist/core/logging/logger.js +2 -2
- package/dist/core/logging/logger.js.map +1 -1
- package/dist/core/pipework.d.ts +2 -2
- package/dist/core/pipework.d.ts.map +1 -1
- package/dist/data/db/bulk-set.js +1 -1
- package/dist/data/db/bulk-set.js.map +1 -1
- package/dist/data/db/composed.js +1 -1
- package/dist/data/db/composed.js.map +1 -1
- package/dist/data/db/db.d.ts +10 -0
- package/dist/data/db/db.d.ts.map +1 -1
- package/dist/data/db/db.js +12 -0
- package/dist/data/db/db.js.map +1 -1
- package/dist/data/db/filter.d.ts +42 -43
- package/dist/data/db/filter.d.ts.map +1 -1
- package/dist/data/db/filter.js +7 -6
- package/dist/data/db/filter.js.map +1 -1
- package/dist/data/db/namespace.d.ts +90 -82
- package/dist/data/db/namespace.d.ts.map +1 -1
- package/dist/data/db/namespace.js +21 -5
- package/dist/data/db/namespace.js.map +1 -1
- package/dist/data/migrate/post-process.d.ts +2 -1
- package/dist/data/migrate/post-process.d.ts.map +1 -1
- package/dist/data/migrate/post-process.js +2 -1
- package/dist/data/migrate/post-process.js.map +1 -1
- package/dist/data/temporal/definition-queries.js +1 -1
- package/dist/data/temporal/definition-queries.js.map +1 -1
- package/dist/data/temporal/query.js +1 -1
- package/dist/data/temporal/query.js.map +1 -1
- package/dist/data/temporal/resolve.js +1 -1
- package/dist/data/temporal/resolve.js.map +1 -1
- package/dist/data/write/audit/actor.d.ts +3 -0
- package/dist/data/write/audit/actor.d.ts.map +1 -0
- package/dist/data/write/audit/actor.js +15 -0
- package/dist/data/write/audit/actor.js.map +1 -0
- package/dist/data/write/audit/audit-columns.d.ts +6 -0
- package/dist/data/write/audit/audit-columns.d.ts.map +1 -0
- package/dist/data/write/audit/audit-columns.js +15 -0
- package/dist/data/write/audit/audit-columns.js.map +1 -0
- package/dist/data/write/audit/audit-select.d.ts +28 -0
- package/dist/data/write/audit/audit-select.d.ts.map +1 -0
- package/dist/data/write/audit/audit-select.js +49 -0
- package/dist/data/write/audit/audit-select.js.map +1 -0
- package/dist/data/write/audit/cte-compile.d.ts +7 -0
- package/dist/data/write/audit/cte-compile.d.ts.map +1 -0
- package/dist/data/write/audit/cte-compile.js +23 -0
- package/dist/data/write/audit/cte-compile.js.map +1 -0
- package/dist/data/write/audit/final-select.d.ts +4 -0
- package/dist/data/write/audit/final-select.d.ts.map +1 -0
- package/dist/data/write/audit/final-select.js +28 -0
- package/dist/data/write/audit/final-select.js.map +1 -0
- package/dist/data/write/audit/primary-key.d.ts +7 -0
- package/dist/data/write/audit/primary-key.d.ts.map +1 -0
- package/dist/data/write/audit/primary-key.js +32 -0
- package/dist/data/write/audit/primary-key.js.map +1 -0
- package/dist/data/write/audit/projection.d.ts +11 -0
- package/dist/data/write/audit/projection.d.ts.map +1 -0
- package/dist/data/write/audit/projection.js +37 -0
- package/dist/data/write/audit/projection.js.map +1 -0
- package/dist/data/write/audit/read-touches.d.ts +10 -0
- package/dist/data/write/audit/read-touches.d.ts.map +1 -0
- package/dist/data/write/audit/read-touches.js +63 -0
- package/dist/data/write/audit/read-touches.js.map +1 -0
- package/dist/data/write/audit/verb-delete.d.ts +7 -0
- package/dist/data/write/audit/verb-delete.d.ts.map +1 -0
- package/dist/data/write/audit/verb-delete.js +53 -0
- package/dist/data/write/audit/verb-delete.js.map +1 -0
- package/dist/data/write/audit/verb-insert.d.ts +7 -0
- package/dist/data/write/audit/verb-insert.d.ts.map +1 -0
- package/dist/data/write/audit/verb-insert.js +28 -0
- package/dist/data/write/audit/verb-insert.js.map +1 -0
- package/dist/data/write/audit/verb-update.d.ts +7 -0
- package/dist/data/write/audit/verb-update.d.ts.map +1 -0
- package/dist/data/write/audit/verb-update.js +52 -0
- package/dist/data/write/audit/verb-update.js.map +1 -0
- package/dist/data/write/audit/verb-upsert.d.ts +7 -0
- package/dist/data/write/audit/verb-upsert.d.ts.map +1 -0
- package/dist/data/write/audit/verb-upsert.js +81 -0
- package/dist/data/write/audit/verb-upsert.js.map +1 -0
- package/dist/data/write/delete.d.ts +15 -0
- package/dist/data/write/delete.d.ts.map +1 -0
- package/dist/data/write/delete.js +25 -0
- package/dist/data/write/delete.js.map +1 -0
- package/dist/data/write/execute.d.ts +3 -0
- package/dist/data/write/execute.d.ts.map +1 -0
- package/dist/data/write/execute.js +162 -0
- package/dist/data/write/execute.js.map +1 -0
- package/dist/data/write/index.d.ts +6 -0
- package/dist/data/write/index.d.ts.map +1 -0
- package/dist/data/write/index.js +10 -0
- package/dist/data/write/index.js.map +1 -0
- package/dist/data/write/insert.d.ts +18 -0
- package/dist/data/write/insert.d.ts.map +1 -0
- package/dist/data/write/insert.js +29 -0
- package/dist/data/write/insert.js.map +1 -0
- package/dist/data/write/state.d.ts +29 -0
- package/dist/data/write/state.d.ts.map +1 -0
- package/dist/data/write/state.js +9 -0
- package/dist/data/write/state.js.map +1 -0
- package/dist/data/write/update.d.ts +17 -0
- package/dist/data/write/update.d.ts.map +1 -0
- package/dist/data/write/update.js +39 -0
- package/dist/data/write/update.js.map +1 -0
- package/dist/data/write/upsert.d.ts +21 -0
- package/dist/data/write/upsert.d.ts.map +1 -0
- package/dist/data/write/upsert.js +42 -0
- package/dist/data/write/upsert.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/infra/audit/namespace.d.ts +3 -0
- package/dist/infra/audit/namespace.d.ts.map +1 -1
- package/dist/infra/audit/namespace.js +3 -0
- package/dist/infra/audit/namespace.js.map +1 -1
- package/dist/lint/config.d.ts +4 -2
- package/dist/lint/config.d.ts.map +1 -1
- package/dist/lint/config.js +9 -5
- package/dist/lint/config.js.map +1 -1
- package/dist/lint/index.d.ts +2 -1
- package/dist/lint/index.d.ts.map +1 -1
- package/dist/lint/index.js +1 -0
- package/dist/lint/index.js.map +1 -1
- package/dist/lint/resolver.d.ts +16 -0
- package/dist/lint/resolver.d.ts.map +1 -0
- package/dist/lint/resolver.js +61 -0
- package/dist/lint/resolver.js.map +1 -0
- package/dist/request/context/create.d.ts +4 -0
- package/dist/request/context/create.d.ts.map +1 -1
- package/dist/request/context/create.js +3 -0
- package/dist/request/context/create.js.map +1 -1
- package/dist/request/context/types.d.ts +3 -0
- package/dist/request/context/types.d.ts.map +1 -1
- package/dist/request/http/middleware.d.ts.map +1 -1
- package/dist/request/http/middleware.js +30 -0
- package/dist/request/http/middleware.js.map +1 -1
- package/dist/request/http/server.d.ts.map +1 -1
- package/dist/request/http/server.js +6 -1
- package/dist/request/http/server.js.map +1 -1
- package/dist/test/context.d.ts.map +1 -1
- package/dist/test/context.js +43 -2
- package/dist/test/context.js.map +1 -1
- package/dist/test/index.d.ts +1 -1
- package/dist/test/index.d.ts.map +1 -1
- package/dist/test/index.js +1 -1
- package/dist/test/index.js.map +1 -1
- package/dist/test/vitest-workspace.d.ts +15 -2
- package/dist/test/vitest-workspace.d.ts.map +1 -1
- package/dist/test/vitest-workspace.js +60 -7
- package/dist/test/vitest-workspace.js.map +1 -1
- package/dist/trace/cardinality/analyze.d.ts +26 -0
- package/dist/trace/cardinality/analyze.d.ts.map +1 -0
- package/dist/trace/cardinality/analyze.js +129 -0
- package/dist/trace/cardinality/analyze.js.map +1 -0
- package/dist/trace/cardinality/branch-context.d.ts +13 -0
- package/dist/trace/cardinality/branch-context.d.ts.map +1 -0
- package/dist/trace/cardinality/branch-context.js +182 -0
- package/dist/trace/cardinality/branch-context.js.map +1 -0
- package/dist/trace/cardinality/check.d.ts +4 -0
- package/dist/trace/cardinality/check.d.ts.map +1 -0
- package/dist/trace/cardinality/check.js +29 -0
- package/dist/trace/cardinality/check.js.map +1 -0
- package/dist/trace/cardinality/classify-edge.d.ts +31 -0
- package/dist/trace/cardinality/classify-edge.d.ts.map +1 -0
- package/dist/trace/cardinality/classify-edge.js +27 -0
- package/dist/trace/cardinality/classify-edge.js.map +1 -0
- package/dist/trace/cardinality/structural-max.d.ts +14 -0
- package/dist/trace/cardinality/structural-max.d.ts.map +1 -0
- package/dist/trace/cardinality/structural-max.js +83 -0
- package/dist/trace/cardinality/structural-max.js.map +1 -0
- package/dist/trace/check/coverage-check.d.ts +20 -0
- package/dist/trace/check/coverage-check.d.ts.map +1 -0
- package/dist/trace/check/coverage-check.js +146 -0
- package/dist/trace/check/coverage-check.js.map +1 -0
- package/dist/trace/check/flow-check.d.ts +13 -0
- package/dist/trace/check/flow-check.d.ts.map +1 -0
- package/dist/trace/check/flow-check.js +82 -0
- package/dist/trace/check/flow-check.js.map +1 -0
- package/dist/trace/check/flow-step-site.d.ts +62 -0
- package/dist/trace/check/flow-step-site.d.ts.map +1 -0
- package/dist/trace/check/flow-step-site.js +142 -0
- package/dist/trace/check/flow-step-site.js.map +1 -0
- package/dist/trace/check/io-pattern.d.ts +14 -0
- package/dist/trace/check/io-pattern.d.ts.map +1 -0
- package/dist/trace/check/io-pattern.js +113 -0
- package/dist/trace/check/io-pattern.js.map +1 -0
- package/dist/trace/codemod/add-cardinality.d.ts +38 -0
- package/dist/trace/codemod/add-cardinality.d.ts.map +1 -0
- package/dist/trace/codemod/add-cardinality.js +106 -0
- package/dist/trace/codemod/add-cardinality.js.map +1 -0
- package/dist/trace/codemod/run.d.ts +25 -0
- package/dist/trace/codemod/run.d.ts.map +1 -0
- package/dist/trace/codemod/run.js +47 -0
- package/dist/trace/codemod/run.js.map +1 -0
- package/dist/trace/entry/close-trace.d.ts +7 -0
- package/dist/trace/entry/close-trace.d.ts.map +1 -0
- package/dist/trace/entry/close-trace.js +54 -0
- package/dist/trace/entry/close-trace.js.map +1 -0
- package/dist/trace/entry/finalize-trace.d.ts +5 -0
- package/dist/trace/entry/finalize-trace.d.ts.map +1 -0
- package/dist/trace/entry/finalize-trace.js +23 -0
- package/dist/trace/entry/finalize-trace.js.map +1 -0
- package/dist/trace/entry/open-trace.d.ts +26 -0
- package/dist/trace/entry/open-trace.d.ts.map +1 -0
- package/dist/trace/entry/open-trace.js +75 -0
- package/dist/trace/entry/open-trace.js.map +1 -0
- package/dist/trace/entry/parent-trace.d.ts +4 -0
- package/dist/trace/entry/parent-trace.d.ts.map +1 -0
- package/dist/trace/entry/parent-trace.js +10 -0
- package/dist/trace/entry/parent-trace.js.map +1 -0
- package/dist/trace/entry/parse-traceparent.d.ts +8 -0
- package/dist/trace/entry/parse-traceparent.d.ts.map +1 -0
- package/dist/trace/entry/parse-traceparent.js +37 -0
- package/dist/trace/entry/parse-traceparent.js.map +1 -0
- package/dist/trace/entry/trace-context.d.ts +19 -0
- package/dist/trace/entry/trace-context.d.ts.map +1 -0
- package/dist/trace/entry/trace-context.js +5 -0
- package/dist/trace/entry/trace-context.js.map +1 -0
- package/dist/trace/entry/tracing-enabled.d.ts +4 -0
- package/dist/trace/entry/tracing-enabled.d.ts.map +1 -0
- package/dist/trace/entry/tracing-enabled.js +8 -0
- package/dist/trace/entry/tracing-enabled.js.map +1 -0
- package/dist/trace/partition/plan.d.ts +2 -0
- package/dist/trace/partition/plan.d.ts.map +1 -1
- package/dist/trace/partition/plan.js +8 -1
- package/dist/trace/partition/plan.js.map +1 -1
- package/dist/trace/partition/schedule.d.ts.map +1 -1
- package/dist/trace/partition/schedule.js +6 -4
- package/dist/trace/partition/schedule.js.map +1 -1
- package/dist/trace/partition/startup-hook.d.ts.map +1 -1
- package/dist/trace/partition/startup-hook.js +6 -2
- package/dist/trace/partition/startup-hook.js.map +1 -1
- package/dist/trace/partition/tables.d.ts +1 -1
- package/dist/trace/partition/tables.d.ts.map +1 -1
- package/dist/trace/partition/tables.js +13 -5
- package/dist/trace/partition/tables.js.map +1 -1
- package/dist/trace/runtime/expire-stale-traces.d.ts +10 -0
- package/dist/trace/runtime/expire-stale-traces.d.ts.map +1 -0
- package/dist/trace/runtime/expire-stale-traces.js +36 -0
- package/dist/trace/runtime/expire-stale-traces.js.map +1 -0
- package/dist/trace/runtime/flow-step.d.ts +6 -0
- package/dist/trace/runtime/flow-step.d.ts.map +1 -0
- package/dist/trace/runtime/flow-step.js +122 -0
- package/dist/trace/runtime/flow-step.js.map +1 -0
- package/dist/trace/runtime/flush-steps.d.ts +5 -0
- package/dist/trace/runtime/flush-steps.d.ts.map +1 -0
- package/dist/trace/runtime/flush-steps.js +23 -0
- package/dist/trace/runtime/flush-steps.js.map +1 -0
- package/dist/trace/runtime/step-buffer.d.ts +139 -0
- package/dist/trace/runtime/step-buffer.d.ts.map +1 -0
- package/dist/trace/runtime/step-buffer.js +140 -0
- package/dist/trace/runtime/step-buffer.js.map +1 -0
- package/dist/trace/runtime/step-error.d.ts +8 -0
- package/dist/trace/runtime/step-error.d.ts.map +1 -0
- package/dist/trace/runtime/step-error.js +13 -0
- package/dist/trace/runtime/step-error.js.map +1 -0
- package/dist/trace/runtime/step-meta.d.ts +48 -0
- package/dist/trace/runtime/step-meta.d.ts.map +1 -0
- package/dist/trace/runtime/step-meta.js +6 -0
- package/dist/trace/runtime/step-meta.js.map +1 -0
- package/dist/trace/runtime/thenable.d.ts +3 -0
- package/dist/trace/runtime/thenable.d.ts.map +1 -0
- package/dist/trace/runtime/thenable.js +12 -0
- package/dist/trace/runtime/thenable.js.map +1 -0
- package/dist/trace/runtime/truncate-trace.d.ts +5 -0
- package/dist/trace/runtime/truncate-trace.d.ts.map +1 -0
- package/dist/trace/runtime/truncate-trace.js +44 -0
- package/dist/trace/runtime/truncate-trace.js.map +1 -0
- package/dist/trace/schema/trace-fields.d.ts +1 -1
- package/dist/trace/schema/trace-retained.d.ts +1 -1
- package/dist/trace/schema/trace.d.ts +1 -1
- package/dist/trace/transformer/build-meta-literal.d.ts +3 -0
- package/dist/trace/transformer/build-meta-literal.d.ts.map +1 -0
- package/dist/trace/transformer/build-meta-literal.js +8 -0
- package/dist/trace/transformer/build-meta-literal.js.map +1 -0
- package/dist/trace/transformer/find-flow-step-sites.d.ts +24 -0
- package/dist/trace/transformer/find-flow-step-sites.d.ts.map +1 -0
- package/dist/trace/transformer/find-flow-step-sites.js +69 -0
- package/dist/trace/transformer/find-flow-step-sites.js.map +1 -0
- package/dist/trace/transformer/inject-flow-step-import.d.ts +3 -0
- package/dist/trace/transformer/inject-flow-step-import.d.ts.map +1 -0
- package/dist/trace/transformer/inject-flow-step-import.js +28 -0
- package/dist/trace/transformer/inject-flow-step-import.js.map +1 -0
- package/dist/trace/transformer/transform-error.d.ts +8 -0
- package/dist/trace/transformer/transform-error.d.ts.map +1 -0
- package/dist/trace/transformer/transform-error.js +5 -0
- package/dist/trace/transformer/transform-error.js.map +1 -0
- package/dist/trace/transformer/transform-flow-steps.d.ts +12 -0
- package/dist/trace/transformer/transform-flow-steps.d.ts.map +1 -0
- package/dist/trace/transformer/transform-flow-steps.js +85 -0
- package/dist/trace/transformer/transform-flow-steps.js.map +1 -0
- package/dist/trace/transformer/wrap-function-declaration.d.ts +3 -0
- package/dist/trace/transformer/wrap-function-declaration.d.ts.map +1 -0
- package/dist/trace/transformer/wrap-function-declaration.js +28 -0
- package/dist/trace/transformer/wrap-function-declaration.js.map +1 -0
- package/dist/trace/transformer/wrap-variable-declaration.d.ts +3 -0
- package/dist/trace/transformer/wrap-variable-declaration.d.ts.map +1 -0
- package/dist/trace/transformer/wrap-variable-declaration.js +30 -0
- package/dist/trace/transformer/wrap-variable-declaration.js.map +1 -0
- package/dist/workspace/dependency-graph.d.ts.map +1 -1
- package/dist/workspace/dependency-graph.js +2 -3
- package/dist/workspace/dependency-graph.js.map +1 -1
- package/dist/workspace/generate.d.ts.map +1 -1
- package/dist/workspace/generate.js +63 -10
- package/dist/workspace/generate.js.map +1 -1
- package/dist/workspace/module-package-name.d.ts +3 -0
- package/dist/workspace/module-package-name.d.ts.map +1 -0
- package/dist/workspace/module-package-name.js +5 -0
- package/dist/workspace/module-package-name.js.map +1 -0
- package/package.json +21 -6
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { type StepError } from './step-error.js';
|
|
2
|
+
import type { MetaTouch } from './step-meta.js';
|
|
3
|
+
/** A `trace_step` row staged in memory, ready to be flushed. */
|
|
4
|
+
export interface PendingStep {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly traceDay: string;
|
|
7
|
+
readonly traceId: string;
|
|
8
|
+
readonly seq: number;
|
|
9
|
+
readonly parentStepId: string | null;
|
|
10
|
+
readonly flowStepRef: string;
|
|
11
|
+
readonly status: 'ok' | 'error';
|
|
12
|
+
readonly startedAt: Date;
|
|
13
|
+
readonly completedAt: Date;
|
|
14
|
+
readonly durationMicros: bigint;
|
|
15
|
+
/**
|
|
16
|
+
* Tier-2 input capture (Q5): one bounded-serialized payload per parameter,
|
|
17
|
+
* in declaration order. `null` when the transformer emitted no capture
|
|
18
|
+
* metadata for this step or the `captureInputs` kill-switch is off.
|
|
19
|
+
*/
|
|
20
|
+
readonly capturedInputs: readonly unknown[] | null;
|
|
21
|
+
readonly error: StepError | null;
|
|
22
|
+
}
|
|
23
|
+
/** A step that has started but not yet completed — the handle `complete` settles. */
|
|
24
|
+
export interface BegunStep {
|
|
25
|
+
readonly seq: number;
|
|
26
|
+
readonly stepId: string;
|
|
27
|
+
readonly parentStepId: string | null;
|
|
28
|
+
readonly flowStepRef: string;
|
|
29
|
+
readonly startedAt: Date;
|
|
30
|
+
readonly startHrTime: bigint;
|
|
31
|
+
/** Captured at begin time so a mutating impl can't change what the row records. */
|
|
32
|
+
readonly capturedInputs: readonly unknown[] | null;
|
|
33
|
+
/**
|
|
34
|
+
* `@touches Entity:verb` targets baked into this step's meta. Empty means
|
|
35
|
+
* no audit projection — the executor takes the vanilla-DML branch and
|
|
36
|
+
* `__flowStep`'s completion path emits no read-touches audit row.
|
|
37
|
+
*/
|
|
38
|
+
readonly touches: readonly MetaTouch[];
|
|
39
|
+
/**
|
|
40
|
+
* Set to true by the executor when it commits a `pipe.*` write under this
|
|
41
|
+
* step. `__flowStep` reads this at completion to decide whether to emit the
|
|
42
|
+
* read-touches `audit_record` row (only when `touches.length > 0` and no
|
|
43
|
+
* write happened). The CTE branch handled the audit itself.
|
|
44
|
+
*/
|
|
45
|
+
wroteForAudit: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The active-step handle the write executor reads to compile its CTE. Captures
|
|
49
|
+
* everything the `audit_inserts` SELECT needs from the step's runtime context:
|
|
50
|
+
* the step id and trace id that link the audit row back to the source step,
|
|
51
|
+
* the partition day, the bounded-serialized captured inputs, and the active
|
|
52
|
+
* touches. Returned by `StepBuffer.currentStep()` only while a step is open
|
|
53
|
+
* for audit (touches present); otherwise `null` so the executor falls through
|
|
54
|
+
* to vanilla DML.
|
|
55
|
+
*/
|
|
56
|
+
export interface ActiveAuditStep {
|
|
57
|
+
readonly traceId: string;
|
|
58
|
+
readonly traceDay: string;
|
|
59
|
+
readonly stepId: string;
|
|
60
|
+
readonly touches: readonly MetaTouch[];
|
|
61
|
+
readonly capturedInputs: readonly unknown[] | null;
|
|
62
|
+
/** Called by the executor right before it returns — flips `wroteForAudit` on the underlying BegunStep. */
|
|
63
|
+
markWrote(): void;
|
|
64
|
+
}
|
|
65
|
+
export interface StepBufferParams {
|
|
66
|
+
readonly traceId: string;
|
|
67
|
+
/** The parent trace's `openedDay` — the partition every step row lands in. */
|
|
68
|
+
readonly traceDay: string;
|
|
69
|
+
/**
|
|
70
|
+
* The Q7 step cap. The `seq` that first exceeds it trips truncation;
|
|
71
|
+
* `Infinity` disables the cap (no `structuralMax` resolved yet).
|
|
72
|
+
*/
|
|
73
|
+
readonly cap: number;
|
|
74
|
+
/**
|
|
75
|
+
* The Q5 input-capture kill-switch, resolved at trace open from
|
|
76
|
+
* `instance.config.trace.captureInputs`. When `false`, every step in this
|
|
77
|
+
* trace stages `capturedInputs: null` regardless of what the transformer
|
|
78
|
+
* emitted — Tier-1 capture is unaffected.
|
|
79
|
+
*/
|
|
80
|
+
readonly captureInputs: boolean;
|
|
81
|
+
}
|
|
82
|
+
export declare class StepBuffer {
|
|
83
|
+
private readonly traceId;
|
|
84
|
+
private readonly traceDay;
|
|
85
|
+
private readonly cap;
|
|
86
|
+
readonly captureInputs: boolean;
|
|
87
|
+
private seq;
|
|
88
|
+
private currentStepId;
|
|
89
|
+
/**
|
|
90
|
+
* The active begun-step at the deepest open nesting level. `__flowStep`
|
|
91
|
+
* pushes on `begin` and pops on `complete`; the write executor reads the
|
|
92
|
+
* top of the stack through `currentStep()` to compile its audit CTE.
|
|
93
|
+
*
|
|
94
|
+
* The stack pairs with `currentStepId` — both describe step nesting — but
|
|
95
|
+
* keeps the full `BegunStep` reference so the executor and the read-touches
|
|
96
|
+
* emitter can reach `touches` and `capturedInputs` without a second lookup.
|
|
97
|
+
*/
|
|
98
|
+
private readonly active;
|
|
99
|
+
private pending;
|
|
100
|
+
private truncatedAtSeqValue;
|
|
101
|
+
private truncationDoneValue;
|
|
102
|
+
constructor(params: StepBufferParams);
|
|
103
|
+
/** True once the step cap has been blown — the trace records no further steps. */
|
|
104
|
+
get truncated(): boolean;
|
|
105
|
+
/** The `seq` that tripped truncation, for `trace.truncated_at_seq`. */
|
|
106
|
+
get truncatedAtSeq(): number | null;
|
|
107
|
+
/**
|
|
108
|
+
* Settles when `truncateTrace`'s side effects have landed (flush + status
|
|
109
|
+
* `UPDATE`). `closeTrace` awaits this before its copy-on-error so the cold
|
|
110
|
+
* row reflects `truncated_at_seq`. `null` when the trace was never truncated.
|
|
111
|
+
*/
|
|
112
|
+
get truncationDone(): Promise<void> | null;
|
|
113
|
+
/** Records the truncation's settle handle. `truncateTrace` calls this once. */
|
|
114
|
+
markTruncationDone(promise: Promise<void>): void;
|
|
115
|
+
/**
|
|
116
|
+
* Opens a step: assigns its `seq`, mints its id, and nests it under the step
|
|
117
|
+
* currently executing. Returns `null` when this step is the one that blows
|
|
118
|
+
* the cap — the caller runs the implementation untraced from here on.
|
|
119
|
+
*
|
|
120
|
+
* `capturedInputs` is the bounded-serialized projection of the step's args
|
|
121
|
+
* (built by `__flowStep` from `meta.capture`), or `null` for Tier-1-only.
|
|
122
|
+
* `touches` is the `@touches Entity:verb` set baked into the step's meta,
|
|
123
|
+
* or empty when the step has no audit projection.
|
|
124
|
+
*/
|
|
125
|
+
begin(flowStepRef: string, capturedInputs: readonly unknown[] | null, touches?: readonly MetaTouch[]): BegunStep | null;
|
|
126
|
+
/**
|
|
127
|
+
* The active step's audit handle, or `null` when there is no open step or
|
|
128
|
+
* the open step has no `@touches`. The write executor uses this to decide:
|
|
129
|
+
* `null` → vanilla DML; non-null → compile the `audit_inserts` CTE. The
|
|
130
|
+
* returned handle's `markWrote()` flips `wroteForAudit` so `__flowStep`
|
|
131
|
+
* suppresses the read-touches emission at step completion.
|
|
132
|
+
*/
|
|
133
|
+
currentStep(): ActiveAuditStep | null;
|
|
134
|
+
/** Settles a begun step: stamps its outcome and timing, stages the row, unnests. */
|
|
135
|
+
complete(begun: BegunStep, status: 'ok' | 'error', thrown: unknown): void;
|
|
136
|
+
/** Removes and returns every staged row — the buffer is empty afterwards. */
|
|
137
|
+
drain(): PendingStep[];
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=step-buffer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-buffer.d.ts","sourceRoot":"","sources":["../../../src/trace/runtime/step-buffer.ts"],"names":[],"mappings":"AAaA,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE/C,gEAAgE;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GAAG,IAAI;IAIhD;;;;;;;;;OASG;IACH,KAAK,CACH,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,EACzC,OAAO,GAAE,SAAS,SAAS,EAAO,GACjC,SAAS,GAAG,IAAI;IAuBnB;;;;;;OAMG;IACH,WAAW,IAAI,eAAe,GAAG,IAAI;IAarC,oFAAoF;IACpF,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,GAAG,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAoBzE,6EAA6E;IAC7E,KAAK,IAAI,WAAW,EAAE;CAKvB"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// The per-trace step buffer. Every Flow that runs under tracing carries one;
|
|
2
|
+
// `__flowStep` records into it and the trace's close drains it to the database
|
|
3
|
+
// in a single batch. The buffer is in-memory and single-trace: a branch opens a
|
|
4
|
+
// child Flow with its own buffer, so the rows here never interleave with
|
|
5
|
+
// another trace's.
|
|
6
|
+
//
|
|
7
|
+
// Three pieces of mutable state, all owned here so `__flowStep` stays a thin
|
|
8
|
+
// wrapper: the `seq` counter (spawn order within the trace), `currentStepId`
|
|
9
|
+
// (the step a nested step records as its parent), and the truncation latch
|
|
10
|
+
// (Q7 — once the step cap is blown the buffer goes no-op for the rest of the
|
|
11
|
+
// trace, mirroring the off-the-traced-path code path exactly).
|
|
12
|
+
import { randomUUID } from 'node:crypto';
|
|
13
|
+
import { projectStepError } from './step-error.js';
|
|
14
|
+
export class StepBuffer {
|
|
15
|
+
traceId;
|
|
16
|
+
traceDay;
|
|
17
|
+
cap;
|
|
18
|
+
captureInputs;
|
|
19
|
+
seq = 0;
|
|
20
|
+
currentStepId = null;
|
|
21
|
+
/**
|
|
22
|
+
* The active begun-step at the deepest open nesting level. `__flowStep`
|
|
23
|
+
* pushes on `begin` and pops on `complete`; the write executor reads the
|
|
24
|
+
* top of the stack through `currentStep()` to compile its audit CTE.
|
|
25
|
+
*
|
|
26
|
+
* The stack pairs with `currentStepId` — both describe step nesting — but
|
|
27
|
+
* keeps the full `BegunStep` reference so the executor and the read-touches
|
|
28
|
+
* emitter can reach `touches` and `capturedInputs` without a second lookup.
|
|
29
|
+
*/
|
|
30
|
+
active = [];
|
|
31
|
+
pending = [];
|
|
32
|
+
truncatedAtSeqValue = null;
|
|
33
|
+
truncationDoneValue = null;
|
|
34
|
+
constructor(params) {
|
|
35
|
+
this.traceId = params.traceId;
|
|
36
|
+
this.traceDay = params.traceDay;
|
|
37
|
+
this.cap = params.cap;
|
|
38
|
+
this.captureInputs = params.captureInputs;
|
|
39
|
+
}
|
|
40
|
+
/** True once the step cap has been blown — the trace records no further steps. */
|
|
41
|
+
get truncated() {
|
|
42
|
+
return this.truncatedAtSeqValue !== null;
|
|
43
|
+
}
|
|
44
|
+
/** The `seq` that tripped truncation, for `trace.truncated_at_seq`. */
|
|
45
|
+
get truncatedAtSeq() {
|
|
46
|
+
return this.truncatedAtSeqValue;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Settles when `truncateTrace`'s side effects have landed (flush + status
|
|
50
|
+
* `UPDATE`). `closeTrace` awaits this before its copy-on-error so the cold
|
|
51
|
+
* row reflects `truncated_at_seq`. `null` when the trace was never truncated.
|
|
52
|
+
*/
|
|
53
|
+
get truncationDone() {
|
|
54
|
+
return this.truncationDoneValue;
|
|
55
|
+
}
|
|
56
|
+
/** Records the truncation's settle handle. `truncateTrace` calls this once. */
|
|
57
|
+
markTruncationDone(promise) {
|
|
58
|
+
this.truncationDoneValue = promise;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Opens a step: assigns its `seq`, mints its id, and nests it under the step
|
|
62
|
+
* currently executing. Returns `null` when this step is the one that blows
|
|
63
|
+
* the cap — the caller runs the implementation untraced from here on.
|
|
64
|
+
*
|
|
65
|
+
* `capturedInputs` is the bounded-serialized projection of the step's args
|
|
66
|
+
* (built by `__flowStep` from `meta.capture`), or `null` for Tier-1-only.
|
|
67
|
+
* `touches` is the `@touches Entity:verb` set baked into the step's meta,
|
|
68
|
+
* or empty when the step has no audit projection.
|
|
69
|
+
*/
|
|
70
|
+
begin(flowStepRef, capturedInputs, touches = []) {
|
|
71
|
+
const seq = ++this.seq;
|
|
72
|
+
if (seq > this.cap) {
|
|
73
|
+
this.truncatedAtSeqValue = seq;
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
const stepId = randomUUID();
|
|
77
|
+
const begun = {
|
|
78
|
+
seq,
|
|
79
|
+
stepId,
|
|
80
|
+
parentStepId: this.currentStepId,
|
|
81
|
+
flowStepRef,
|
|
82
|
+
startedAt: new Date(),
|
|
83
|
+
startHrTime: process.hrtime.bigint(),
|
|
84
|
+
capturedInputs,
|
|
85
|
+
touches,
|
|
86
|
+
wroteForAudit: false,
|
|
87
|
+
};
|
|
88
|
+
this.currentStepId = stepId;
|
|
89
|
+
this.active.push(begun);
|
|
90
|
+
return begun;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The active step's audit handle, or `null` when there is no open step or
|
|
94
|
+
* the open step has no `@touches`. The write executor uses this to decide:
|
|
95
|
+
* `null` → vanilla DML; non-null → compile the `audit_inserts` CTE. The
|
|
96
|
+
* returned handle's `markWrote()` flips `wroteForAudit` so `__flowStep`
|
|
97
|
+
* suppresses the read-touches emission at step completion.
|
|
98
|
+
*/
|
|
99
|
+
currentStep() {
|
|
100
|
+
const top = this.active[this.active.length - 1];
|
|
101
|
+
if (top === undefined || top.touches.length === 0)
|
|
102
|
+
return null;
|
|
103
|
+
return {
|
|
104
|
+
traceId: this.traceId,
|
|
105
|
+
traceDay: this.traceDay,
|
|
106
|
+
stepId: top.stepId,
|
|
107
|
+
touches: top.touches,
|
|
108
|
+
capturedInputs: top.capturedInputs,
|
|
109
|
+
markWrote: () => { top.wroteForAudit = true; },
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/** Settles a begun step: stamps its outcome and timing, stages the row, unnests. */
|
|
113
|
+
complete(begun, status, thrown) {
|
|
114
|
+
this.currentStepId = begun.parentStepId;
|
|
115
|
+
const idx = this.active.lastIndexOf(begun);
|
|
116
|
+
if (idx !== -1)
|
|
117
|
+
this.active.splice(idx, 1);
|
|
118
|
+
this.pending.push({
|
|
119
|
+
id: begun.stepId,
|
|
120
|
+
traceDay: this.traceDay,
|
|
121
|
+
traceId: this.traceId,
|
|
122
|
+
seq: begun.seq,
|
|
123
|
+
parentStepId: begun.parentStepId,
|
|
124
|
+
flowStepRef: begun.flowStepRef,
|
|
125
|
+
status,
|
|
126
|
+
startedAt: begun.startedAt,
|
|
127
|
+
completedAt: new Date(),
|
|
128
|
+
durationMicros: (process.hrtime.bigint() - begun.startHrTime) / 1000n,
|
|
129
|
+
capturedInputs: begun.capturedInputs,
|
|
130
|
+
error: status === 'error' ? projectStepError(thrown) : null,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
/** Removes and returns every staged row — the buffer is empty afterwards. */
|
|
134
|
+
drain() {
|
|
135
|
+
const drained = this.pending;
|
|
136
|
+
this.pending = [];
|
|
137
|
+
return drained;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=step-buffer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-buffer.js","sourceRoot":"","sources":["../../../src/trace/runtime/step-buffer.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,+EAA+E;AAC/E,gFAAgF;AAChF,yEAAyE;AACzE,mBAAmB;AACnB,EAAE;AACF,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAC3E,6EAA6E;AAC7E,+DAA+D;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,gBAAgB,EAAkB,MAAM,iBAAiB,CAAA;AAsFlE,MAAM,OAAO,UAAU;IACJ,OAAO,CAAQ;IACf,QAAQ,CAAQ;IAChB,GAAG,CAAQ;I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AAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,MAAM;YACN,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,WAAW,EAAE,IAAI,IAAI,EAAE;YACvB,cAAc,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,CAAC,GAAG,KAAK;YACrE,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI;SAC5D,CAAC,CAAA;IACJ,CAAC;IAED,6EAA6E;IAC7E,KAAK;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,EAAE,CAAA;QACjB,OAAO,OAAO,CAAA;IAChB,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface StepError {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly message: string;
|
|
4
|
+
readonly stack: string | null;
|
|
5
|
+
}
|
|
6
|
+
/** The `trace_step.error` projection of a thrown value. */
|
|
7
|
+
export declare function projectStepError(thrown: unknown): StepError;
|
|
8
|
+
//# sourceMappingURL=step-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-error.d.ts","sourceRoot":"","sources":["../../../src/trace/runtime/step-error.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CAC9B;AAED,2DAA2D;AAC3D,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAK3D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Tier-1 error capture: the JSON projection of a thrown value for the
|
|
2
|
+
// `trace_step.error` column. Errors are always captured (Tier 1) — unlike
|
|
3
|
+
// inputs, an error carries no tenant data of its own, only the failure shape a
|
|
4
|
+
// reader needs. A non-`Error` throw still gets a record so the step is never
|
|
5
|
+
// silently marked failed with nothing to show.
|
|
6
|
+
/** The `trace_step.error` projection of a thrown value. */
|
|
7
|
+
export function projectStepError(thrown) {
|
|
8
|
+
if (thrown instanceof Error) {
|
|
9
|
+
return { name: thrown.name, message: thrown.message, stack: thrown.stack ?? null };
|
|
10
|
+
}
|
|
11
|
+
return { name: 'NonError', message: String(thrown), stack: null };
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=step-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-error.js","sourceRoot":"","sources":["../../../src/trace/runtime/step-error.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,0EAA0E;AAC1E,+EAA+E;AAC/E,6EAA6E;AAC7E,+CAA+C;AAQ/C,2DAA2D;AAC3D,MAAM,UAAU,gBAAgB,CAAC,MAAe;IAC9C,IAAI,MAAM,YAAY,KAAK,EAAE,CAAC;QAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,IAAI,IAAI,EAAE,CAAA;IACpF,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;AACnE,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-arg projection emitted by the build transformer for Tier-2 input capture.
|
|
3
|
+
*
|
|
4
|
+
* The projection turns a raw argument into a trace-safe payload, derived at
|
|
5
|
+
* compile time from the parameter's type and the `.traceSafe()` markings in
|
|
6
|
+
* the `pipe.define()` registry. The runtime then runs the projected value
|
|
7
|
+
* through the bounded serializer before staging it on
|
|
8
|
+
* `trace_step.captured_inputs`.
|
|
9
|
+
*
|
|
10
|
+
* The projection may return any JSON-shaped value, including `undefined` for
|
|
11
|
+
* "this arg has no safe fields to capture" (fail-closed default).
|
|
12
|
+
*/
|
|
13
|
+
export type CaptureProjection = (arg: unknown) => unknown;
|
|
14
|
+
/**
|
|
15
|
+
* One `@touches Entity:verb` target baked into a step's meta. Mirrors the
|
|
16
|
+
* `EntityTouch` shape the annotation parser produces — duplicated here so the
|
|
17
|
+
* runtime has no compile-time dependency on `src/trace/annotation/*` (the
|
|
18
|
+
* transformer is the only thing that bridges the two).
|
|
19
|
+
*/
|
|
20
|
+
export interface MetaTouch {
|
|
21
|
+
readonly entity: string;
|
|
22
|
+
readonly verb: string;
|
|
23
|
+
}
|
|
24
|
+
export interface FlowStepMeta {
|
|
25
|
+
/** The `path:symbol` flow-graph node id of the documented function. */
|
|
26
|
+
readonly ref: string;
|
|
27
|
+
/**
|
|
28
|
+
* Per-arg capture projections, in parameter order. `null` at a slot means
|
|
29
|
+
* "no projection — pass the raw arg through to the bounded serializer"
|
|
30
|
+
* (primitives, or `any`-typed parameters with no registry entry).
|
|
31
|
+
*
|
|
32
|
+
* Absent entirely means the transformer chose to skip Tier-2 capture for
|
|
33
|
+
* this step. The runtime stages `capturedInputs: null` and incurs no
|
|
34
|
+
* per-arg cost.
|
|
35
|
+
*/
|
|
36
|
+
readonly capture?: ReadonlyArray<CaptureProjection | null>;
|
|
37
|
+
/**
|
|
38
|
+
* `@touches Entity:verb` targets declared on this step. Empty / absent means
|
|
39
|
+
* the step has no audit projection — the write surface emits vanilla DML
|
|
40
|
+
* (no CTE) and the runtime emits no read-touches `audit_record` row.
|
|
41
|
+
*
|
|
42
|
+
* When present, the active step's touches surface through the trace's
|
|
43
|
+
* `StepBuffer` for the executor's CTE generator (write-touches) and for
|
|
44
|
+
* `__flowStep`'s step-completion path (read-touches).
|
|
45
|
+
*/
|
|
46
|
+
readonly touches?: ReadonlyArray<MetaTouch>;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=step-meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-meta.d.ts","sourceRoot":"","sources":["../../../src/trace/runtime/step-meta.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAA;AAEzD;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,YAAY;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IAC1D;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,SAAS,CAAC,CAAA;CAC5C"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// The compile-time identity of a flow step. The build transformer (component 5)
|
|
2
|
+
// bakes one of these in as a literal at every wrapped call site — `__flowStep`
|
|
3
|
+
// never computes it. `ref` is the `path:symbol` node id, matching the
|
|
4
|
+
// `@upstream` / `@downstream` targets the annotation grammar produces.
|
|
5
|
+
export {};
|
|
6
|
+
//# sourceMappingURL=step-meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-meta.js","sourceRoot":"","sources":["../../../src/trace/runtime/step-meta.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,+EAA+E;AAC/E,sEAAsE;AACtE,uEAAuE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thenable.d.ts","sourceRoot":"","sources":["../../../src/trace/runtime/thenable.ts"],"names":[],"mappings":"AAMA,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,WAAW,CAAC,OAAO,CAAC,CAIxE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// A flow step's implementation may be synchronous or return a promise, and so
|
|
2
|
+
// may an entry's work. Both `__flowStep` and `finalizeTrace` have to settle the
|
|
3
|
+
// trace exactly when the work does — which means recognising a thenable
|
|
4
|
+
// (anything with a callable `then`, not just a native `Promise`) without
|
|
5
|
+
// awaiting code that never needed to be async.
|
|
6
|
+
/** True for any thenable — a native `Promise` or a custom PromiseLike. */
|
|
7
|
+
export function isThenable(value) {
|
|
8
|
+
return value !== null
|
|
9
|
+
&& (typeof value === 'object' || typeof value === 'function')
|
|
10
|
+
&& typeof value.then === 'function';
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=thenable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"thenable.js","sourceRoot":"","sources":["../../../src/trace/runtime/thenable.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,gFAAgF;AAChF,wEAAwE;AACxE,yEAAyE;AACzE,+CAA+C;AAE/C,0EAA0E;AAC1E,MAAM,UAAU,UAAU,CAAC,KAAc;IACvC,OAAO,KAAK,KAAK,IAAI;WAChB,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC;WAC1D,OAAQ,KAA4B,CAAC,IAAI,KAAK,UAAU,CAAA;AAC/D,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Manifold } from '../../core/pipework.js';
|
|
2
|
+
import type { TraceContext } from '../entry/trace-context.js';
|
|
3
|
+
/** Fires Q7 truncation: flushes the buffer and stamps `truncated` on the trace row. */
|
|
4
|
+
export declare function truncateTrace(instance: Manifold, ctx: TraceContext): Promise<void>;
|
|
5
|
+
//# sourceMappingURL=truncate-trace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truncate-trace.d.ts","sourceRoot":"","sources":["../../../src/trace/runtime/truncate-trace.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAMtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,uFAAuF;AACvF,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BlF"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Q7 truncation. The step cap fired — the trace's longest non-branch path was
|
|
2
|
+
// supposed to be bounded by `structuralMax`, and we just crossed
|
|
3
|
+
// `structuralMax × safetyFactor`. That means the static DAG analysis was wrong
|
|
4
|
+
// (a branch the cardinality check missed) or unannotated recursion slipped
|
|
5
|
+
// validation. Either way it's a bug signal, not a load condition: the cap
|
|
6
|
+
// firing is loud on purpose.
|
|
7
|
+
//
|
|
8
|
+
// The work itself keeps running: `__flowStep` already flips to its
|
|
9
|
+
// off-the-traced-path pass-through, so the rest of the trace costs nothing.
|
|
10
|
+
// Here we finalize the trace as a casualty — flush whatever's buffered so far,
|
|
11
|
+
// stamp `status = 'truncated'` and `truncated_at_seq` on the row, and log loud.
|
|
12
|
+
//
|
|
13
|
+
// `closedAt` is *not* set: the entry hasn't finished yet. When it does,
|
|
14
|
+
// `closeTrace` fills it in and triggers the copy-on-error so the cold row
|
|
15
|
+
// reflects the final state (Q4). The truncation's settle handle is stored on
|
|
16
|
+
// the buffer so `closeTrace` can wait for `truncated_at_seq` to land before it
|
|
17
|
+
// copies.
|
|
18
|
+
import { getBaseLogger } from '../../core/logging/index.js';
|
|
19
|
+
import { eq, and, getTableColumns } from '../../data/query/index.js';
|
|
20
|
+
import { trace } from '../schema/trace.js';
|
|
21
|
+
import { flushSteps } from './flush-steps.js';
|
|
22
|
+
/** Fires Q7 truncation: flushes the buffer and stamps `truncated` on the trace row. */
|
|
23
|
+
export function truncateTrace(instance, ctx) {
|
|
24
|
+
const truncatedAtSeq = ctx.buffer.truncatedAtSeq;
|
|
25
|
+
getBaseLogger().error({ traceId: ctx.id, truncatedAtSeq }, 'Trace truncated — step cap exceeded; the flow DAG analysis missed a branch or unannotated recursion');
|
|
26
|
+
const done = ctx.persisted
|
|
27
|
+
.then(async () => {
|
|
28
|
+
const stepFlush = flushSteps(instance, ctx.buffer.drain());
|
|
29
|
+
const db = instance.pool.getOrCreate(instance.config.database()).drizzle;
|
|
30
|
+
const table = trace.table();
|
|
31
|
+
const cols = getTableColumns(table);
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Drizzle's update needs the concrete runtime table type
|
|
33
|
+
const traceUpdate = db.update(table)
|
|
34
|
+
.set({ status: 'truncated', truncatedAtSeq })
|
|
35
|
+
.where(and(eq(cols.id, ctx.id), eq(cols.openedDay, ctx.openedDay)));
|
|
36
|
+
await Promise.all([stepFlush, traceUpdate]);
|
|
37
|
+
})
|
|
38
|
+
.catch((err) => {
|
|
39
|
+
getBaseLogger().error({ err, traceId: ctx.id }, 'Failed to persist trace truncation — the trace row is missing its `truncated` stamp');
|
|
40
|
+
});
|
|
41
|
+
ctx.buffer.markTruncationDone(done);
|
|
42
|
+
return done;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=truncate-trace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truncate-trace.js","sourceRoot":"","sources":["../../../src/trace/runtime/truncate-trace.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,iEAAiE;AACjE,+EAA+E;AAC/E,2EAA2E;AAC3E,0EAA0E;AAC1E,6BAA6B;AAC7B,EAAE;AACF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AAG,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QACrE,MAAM,OAAO,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAA;IAC7C,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QACtB,aAAa,EAAE,CAAC,KAAK,CACnB,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,EAAE,EACxB,qFAAqF,CACtF,CAAA;IACH,CAAC,CAAC,CAAA;IACJ,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAA;IACnC,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -5,7 +5,7 @@ export declare const traceFields: {
|
|
|
5
5
|
parentId: import("../../data/domain/types.js").FieldDescriptor<import("../../data/domain/brand.js").Branded<string, "TraceId"> | null> & import("../../data/domain/field.js").FieldModifiers<import("../../data/domain/brand.js").Branded<string, "TraceId"> | null>;
|
|
6
6
|
parentStepId: import("../../data/domain/types.js").FieldDescriptor<import("../../data/domain/brand.js").Branded<string, "TraceStepId"> | null> & import("../../data/domain/field.js").FieldModifiers<import("../../data/domain/brand.js").Branded<string, "TraceStepId"> | null>;
|
|
7
7
|
entryKind: import("../../data/domain/types.js").FieldDescriptor<"test" | "http" | "job" | "cron"> & import("../../data/domain/field.js").FieldModifiers<"test" | "http" | "job" | "cron">;
|
|
8
|
-
status: import("../../data/domain/types.js").FieldDescriptor<"error" | "
|
|
8
|
+
status: import("../../data/domain/types.js").FieldDescriptor<"error" | "open" | "closed" | "truncated" | "expired"> & import("../../data/domain/field.js").FieldModifiers<"error" | "open" | "closed" | "truncated" | "expired">;
|
|
9
9
|
tenantId: import("../../data/domain/types.js").FieldDescriptor<string | null> & import("../../data/domain/field.js").FieldModifiers<string | null>;
|
|
10
10
|
requestId: import("../../data/domain/types.js").FieldDescriptor<string | null> & import("../../data/domain/field.js").FieldModifiers<string | null>;
|
|
11
11
|
sessionId: import("../../data/domain/types.js").FieldDescriptor<string | null> & import("../../data/domain/field.js").FieldModifiers<string | null>;
|
|
@@ -5,7 +5,7 @@ export declare const traceRetained: import("../../data/domain/types.js").Defined
|
|
|
5
5
|
parentId: import("../../data/domain/types.js").FieldDescriptor<import("../../data/domain/brand.js").Branded<string, "TraceId"> | null> & import("../../data/domain/field.js").FieldModifiers<import("../../data/domain/brand.js").Branded<string, "TraceId"> | null>;
|
|
6
6
|
parentStepId: import("../../data/domain/types.js").FieldDescriptor<import("../../data/domain/brand.js").Branded<string, "TraceStepId"> | null> & import("../../data/domain/field.js").FieldModifiers<import("../../data/domain/brand.js").Branded<string, "TraceStepId"> | null>;
|
|
7
7
|
entryKind: import("../../data/domain/types.js").FieldDescriptor<"test" | "http" | "job" | "cron"> & import("../../data/domain/field.js").FieldModifiers<"test" | "http" | "job" | "cron">;
|
|
8
|
-
status: import("../../data/domain/types.js").FieldDescriptor<"error" | "
|
|
8
|
+
status: import("../../data/domain/types.js").FieldDescriptor<"error" | "open" | "closed" | "truncated" | "expired"> & import("../../data/domain/field.js").FieldModifiers<"error" | "open" | "closed" | "truncated" | "expired">;
|
|
9
9
|
tenantId: import("../../data/domain/types.js").FieldDescriptor<string | null> & import("../../data/domain/field.js").FieldModifiers<string | null>;
|
|
10
10
|
requestId: import("../../data/domain/types.js").FieldDescriptor<string | null> & import("../../data/domain/field.js").FieldModifiers<string | null>;
|
|
11
11
|
sessionId: import("../../data/domain/types.js").FieldDescriptor<string | null> & import("../../data/domain/field.js").FieldModifiers<string | null>;
|
|
@@ -5,7 +5,7 @@ export declare const trace: import("../../data/domain/types.js").DefinedTable<{
|
|
|
5
5
|
parentId: import("../../data/domain/types.js").FieldDescriptor<import("../../data/domain/brand.js").Branded<string, "TraceId"> | null> & import("../../data/domain/field.js").FieldModifiers<import("../../data/domain/brand.js").Branded<string, "TraceId"> | null>;
|
|
6
6
|
parentStepId: import("../../data/domain/types.js").FieldDescriptor<import("../../data/domain/brand.js").Branded<string, "TraceStepId"> | null> & import("../../data/domain/field.js").FieldModifiers<import("../../data/domain/brand.js").Branded<string, "TraceStepId"> | null>;
|
|
7
7
|
entryKind: import("../../data/domain/types.js").FieldDescriptor<"test" | "http" | "job" | "cron"> & import("../../data/domain/field.js").FieldModifiers<"test" | "http" | "job" | "cron">;
|
|
8
|
-
status: import("../../data/domain/types.js").FieldDescriptor<"error" | "
|
|
8
|
+
status: import("../../data/domain/types.js").FieldDescriptor<"error" | "open" | "closed" | "truncated" | "expired"> & import("../../data/domain/field.js").FieldModifiers<"error" | "open" | "closed" | "truncated" | "expired">;
|
|
9
9
|
tenantId: import("../../data/domain/types.js").FieldDescriptor<string | null> & import("../../data/domain/field.js").FieldModifiers<string | null>;
|
|
10
10
|
requestId: import("../../data/domain/types.js").FieldDescriptor<string | null> & import("../../data/domain/field.js").FieldModifiers<string | null>;
|
|
11
11
|
sessionId: import("../../data/domain/types.js").FieldDescriptor<string | null> & import("../../data/domain/field.js").FieldModifiers<string | null>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-meta-literal.d.ts","sourceRoot":"","sources":["../../../src/trace/transformer/build-meta-literal.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,EAAE,CAAC,uBAAuB,CAKjG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Builds the `FlowStepMeta` object literal the transformer bakes in at every
|
|
2
|
+
// wrap site. The `ref` is the `path:symbol` node id — the same shape the
|
|
3
|
+
// annotation grammar uses for `@upstream` / `@downstream` targets.
|
|
4
|
+
import ts from 'typescript';
|
|
5
|
+
export function buildMetaLiteral(factory, ref) {
|
|
6
|
+
return factory.createObjectLiteralExpression([factory.createPropertyAssignment('ref', factory.createStringLiteral(ref))], false);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=build-meta-literal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-meta-literal.js","sourceRoot":"","sources":["../../../src/trace/transformer/build-meta-literal.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,yEAAyE;AACzE,mEAAmE;AAEnE,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,MAAM,UAAU,gBAAgB,CAAC,OAAuB,EAAE,GAAW;IACnE,OAAO,OAAO,CAAC,6BAA6B,CAC1C,CAAC,OAAO,CAAC,wBAAwB,CAAC,KAAK,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,EAC3E,KAAK,CACN,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import ts from 'typescript';
|
|
2
|
+
import { type FlowStepParseResult } from '@pipework/flow-step-parser';
|
|
3
|
+
export type FlowStepSiteShape = {
|
|
4
|
+
readonly kind: 'function-declaration';
|
|
5
|
+
readonly name: string;
|
|
6
|
+
} | {
|
|
7
|
+
readonly kind: 'variable-declaration';
|
|
8
|
+
readonly name: string;
|
|
9
|
+
} | {
|
|
10
|
+
readonly kind: 'rejected';
|
|
11
|
+
readonly reason: string;
|
|
12
|
+
};
|
|
13
|
+
export interface FlowStepSite {
|
|
14
|
+
readonly statement: ts.Statement;
|
|
15
|
+
readonly shape: FlowStepSiteShape;
|
|
16
|
+
readonly annotation: Exclude<FlowStepParseResult, {
|
|
17
|
+
kind: 'not-a-flow-step';
|
|
18
|
+
}>;
|
|
19
|
+
/** 1-based line where the statement begins. */
|
|
20
|
+
readonly line: number;
|
|
21
|
+
}
|
|
22
|
+
/** Returns every `@flow_step` site in `sourceFile`, in source order. */
|
|
23
|
+
export declare function findFlowStepSites(sourceFile: ts.SourceFile): readonly FlowStepSite[];
|
|
24
|
+
//# sourceMappingURL=find-flow-step-sites.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-flow-step-sites.d.ts","sourceRoot":"","sources":["../../../src/trace/transformer/find-flow-step-sites.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAE9F,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,sBAAsB,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAA;AAE1D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAA;IAChC,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,mBAAmB,EAAE;QAAE,IAAI,EAAE,iBAAiB,CAAA;KAAE,CAAC,CAAA;IAC9E,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CACtB;AAED,wEAAwE;AACxE,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,GAAG,SAAS,YAAY,EAAE,CAUpF"}
|