niceeval 0.13.2 → 0.13.3
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/dist/agents/bub.cjs +4 -4
- package/dist/agents/bub.cjs.map +1 -1
- package/dist/agents/bub.d.cts +2 -2
- package/dist/agents/bub.d.mts +2 -2
- package/dist/agents/bub.d.ts +2 -2
- package/dist/agents/claude-code-native.cjs +213 -0
- package/dist/agents/claude-code-native.cjs.map +1 -0
- package/dist/agents/claude-code-native.d.cts +5 -0
- package/dist/agents/claude-code-native.d.mts +5 -0
- package/dist/agents/claude-code-native.d.ts +5 -0
- package/dist/agents/claude-code-native.js +6 -0
- package/dist/agents/claude-code-native.js.map +1 -0
- package/dist/agents/claude-code.cjs +26 -80
- package/dist/agents/claude-code.cjs.map +1 -1
- package/dist/agents/codex-app-server.cjs +314 -0
- package/dist/agents/codex-app-server.cjs.map +1 -0
- package/dist/agents/codex-app-server.d.cts +9 -0
- package/dist/agents/codex-app-server.d.mts +9 -0
- package/dist/agents/codex-app-server.d.ts +9 -0
- package/dist/agents/codex-app-server.js +6 -0
- package/dist/agents/codex-app-server.js.map +1 -0
- package/dist/agents/codex.cjs +19 -68
- package/dist/agents/codex.cjs.map +1 -1
- package/dist/agents/codex.d.cts +3 -3
- package/dist/agents/codex.d.mts +3 -3
- package/dist/agents/codex.d.ts +3 -3
- package/dist/agents/index.cjs +3 -1
- package/dist/agents/index.cjs.map +1 -1
- package/dist/agents/index.d.cts +1 -0
- package/dist/agents/index.d.mts +1 -0
- package/dist/agents/index.d.ts +1 -0
- package/dist/agents/index.js +84 -82
- package/dist/agents/index.mjs +84 -82
- package/dist/agents/managed-jsonl.cjs +207 -0
- package/dist/agents/managed-jsonl.cjs.map +1 -0
- package/dist/agents/managed-jsonl.d.cts +39 -0
- package/dist/agents/managed-jsonl.d.mts +39 -0
- package/dist/agents/managed-jsonl.d.ts +39 -0
- package/dist/agents/managed-jsonl.js +6 -0
- package/dist/agents/managed-jsonl.js.map +1 -0
- package/dist/agents/managed-process.cjs +31 -0
- package/dist/agents/managed-process.cjs.map +1 -0
- package/dist/agents/managed-process.d.cts +3 -0
- package/dist/agents/managed-process.d.mts +3 -0
- package/dist/agents/managed-process.d.ts +3 -0
- package/dist/agents/managed-process.js +6 -0
- package/dist/agents/managed-process.js.map +1 -0
- package/dist/agents/omp.cjs +18 -1
- package/dist/agents/omp.cjs.map +1 -1
- package/dist/agents/sdk-streams.cjs +11 -4
- package/dist/agents/sdk-streams.cjs.map +1 -1
- package/dist/agents/types.cjs.map +1 -1
- package/dist/agents/types.d.cts +8 -0
- package/dist/agents/types.d.mts +8 -0
- package/dist/agents/types.d.ts +8 -0
- package/dist/analysis/bindings.cjs +74 -19
- package/dist/analysis/bindings.cjs.map +1 -1
- package/dist/analysis/bindings.d.cts +534 -156
- package/dist/analysis/bindings.d.mts +534 -156
- package/dist/analysis/bindings.d.ts +534 -156
- package/dist/analysis/domain-view.cjs.map +1 -1
- package/dist/analysis/domain-view.d.cts +137 -8
- package/dist/analysis/domain-view.d.mts +137 -8
- package/dist/analysis/domain-view.d.ts +137 -8
- package/dist/analysis/index.cjs.map +1 -1
- package/dist/analysis/index.d.cts +1 -1
- package/dist/analysis/index.d.mts +1 -1
- package/dist/analysis/index.d.ts +1 -1
- package/dist/assertions/api.cjs.map +1 -1
- package/dist/assertions/api.d.cts +62 -0
- package/dist/assertions/api.d.mts +62 -0
- package/dist/assertions/api.d.ts +62 -0
- package/dist/assertions/judge.cjs +56 -5
- package/dist/assertions/judge.cjs.map +1 -1
- package/dist/assertions/match.cjs +66 -42
- package/dist/assertions/match.cjs.map +1 -1
- package/dist/assertions/match.d.cts +13 -0
- package/dist/assertions/match.d.mts +13 -0
- package/dist/assertions/match.d.ts +13 -0
- package/dist/assertions/record/attachment.cjs +104 -33
- package/dist/assertions/record/attachment.cjs.map +1 -1
- package/dist/assertions/record/attachment.d.cts +294 -57
- package/dist/assertions/record/attachment.d.mts +294 -57
- package/dist/assertions/record/attachment.d.ts +294 -57
- package/dist/assertions/record/codec.cjs +91 -17
- package/dist/assertions/record/codec.cjs.map +1 -1
- package/dist/assertions/record/codec.d.cts +280 -52
- package/dist/assertions/record/codec.d.mts +280 -52
- package/dist/assertions/record/codec.d.ts +280 -52
- package/dist/assertions/record/index.js +2 -0
- package/dist/assertions/record/model.cjs +16 -0
- package/dist/assertions/record/model.cjs.map +1 -1
- package/dist/assertions/record/model.d.cts +120 -13
- package/dist/assertions/record/model.d.mts +120 -13
- package/dist/assertions/record/model.d.ts +120 -13
- package/dist/assertions/record/model.js +2 -0
- package/dist/assertions/record/producer.cjs +70 -50
- package/dist/assertions/record/producer.cjs.map +1 -1
- package/dist/assertions/record/producer.d.cts +8 -7
- package/dist/assertions/record/producer.d.mts +8 -7
- package/dist/assertions/record/producer.d.ts +8 -7
- package/dist/assertions/runtime.cjs +49 -7
- package/dist/assertions/runtime.cjs.map +1 -1
- package/dist/cli/application.cjs +40 -0
- package/dist/cli/application.cjs.map +1 -0
- package/dist/cli/application.d.cts +129 -0
- package/dist/cli/application.d.mts +129 -0
- package/dist/cli/application.d.ts +129 -0
- package/dist/cli/application.js +24 -0
- package/dist/cli/application.js.map +1 -0
- package/dist/cli/bootstrap.cjs +10 -4
- package/dist/cli/bootstrap.cjs.map +1 -1
- package/dist/cli/node-application.cjs +123 -0
- package/dist/cli/node-application.cjs.map +1 -0
- package/dist/cli/node-application.d.cts +14 -0
- package/dist/cli/node-application.d.mts +14 -0
- package/dist/cli/node-application.d.ts +14 -0
- package/dist/cli/node-application.js +26 -0
- package/dist/cli/node-application.js.map +1 -0
- package/dist/cli/program.cjs +2807 -0
- package/dist/cli/program.cjs.map +1 -0
- package/dist/cli/program.d.cts +352 -0
- package/dist/cli/program.d.mts +352 -0
- package/dist/cli/program.d.ts +352 -0
- package/dist/cli/program.js +36 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/project-configuration.cjs +134 -0
- package/dist/cli/project-configuration.cjs.map +1 -0
- package/dist/cli/project-configuration.d.cts +64 -0
- package/dist/cli/project-configuration.d.mts +64 -0
- package/dist/cli/project-configuration.d.ts +64 -0
- package/dist/cli/project-configuration.js +22 -0
- package/dist/cli/project-configuration.js.map +1 -0
- package/dist/cli/record.cjs +20 -4
- package/dist/cli/record.cjs.map +1 -1
- package/dist/cli/record.d.cts +3 -3
- package/dist/cli/record.d.mts +3 -3
- package/dist/cli/record.d.ts +3 -3
- package/dist/cli.cjs +19 -3130
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +2 -148
- package/dist/cli.d.mts +2 -148
- package/dist/cli.d.ts +2 -148
- package/dist/cli.js +22 -30
- package/dist/context/assert-first.cjs +21 -15
- package/dist/context/assert-first.cjs.map +1 -1
- package/dist/context/assert-first.d.cts +1 -0
- package/dist/context/assert-first.d.mts +1 -0
- package/dist/context/assert-first.d.ts +1 -0
- package/dist/context/attempt-resources.cjs +13 -0
- package/dist/context/attempt-resources.cjs.map +1 -0
- package/dist/context/attempt-resources.d.cts +3 -0
- package/dist/context/attempt-resources.d.mts +3 -0
- package/dist/context/attempt-resources.d.ts +3 -0
- package/dist/context/attempt-resources.js +8 -0
- package/dist/context/attempt-resources.js.map +1 -0
- package/dist/context/session.cjs +4 -3
- package/dist/context/session.cjs.map +1 -1
- package/dist/context/session.d.cts +1 -0
- package/dist/context/session.d.mts +1 -0
- package/dist/context/session.d.ts +1 -0
- package/dist/eval/record/verdict.cjs +3 -2
- package/dist/eval/record/verdict.cjs.map +1 -1
- package/dist/experiment/host/index.cjs +1 -6
- package/dist/experiment/host/index.cjs.map +1 -1
- package/dist/experiment/host/index.d.cts +1 -0
- package/dist/experiment/host/index.d.mts +1 -0
- package/dist/experiment/host/index.d.ts +1 -0
- package/dist/load-config.cjs +13 -4
- package/dist/load-config.cjs.map +1 -1
- package/dist/load-config.d.cts +4 -3
- package/dist/load-config.d.mts +4 -3
- package/dist/load-config.d.ts +4 -3
- package/dist/load-config.js +4 -2
- package/dist/o11y/parsers/codex.cjs +29 -7
- package/dist/o11y/parsers/codex.cjs.map +1 -1
- package/dist/record/codec/core.d.cts +0 -2
- package/dist/record/codec/core.d.mts +0 -2
- package/dist/record/codec/core.d.ts +0 -2
- package/dist/record/codec/identifiers.cjs +2 -3
- package/dist/record/codec/identifiers.cjs.map +1 -1
- package/dist/record/codec/identifiers.d.cts +1 -2
- package/dist/record/codec/identifiers.d.mts +1 -2
- package/dist/record/codec/identifiers.d.ts +1 -2
- package/dist/record/codec/identifiers.js +10 -12
- package/dist/record/codec/index.js +42 -44
- package/dist/record/definition/attachment.cjs +1 -0
- package/dist/record/definition/attachment.cjs.map +1 -1
- package/dist/record/definition/attachment.d.cts +14 -0
- package/dist/record/definition/attachment.d.mts +14 -0
- package/dist/record/definition/attachment.d.ts +14 -0
- package/dist/record/family/assertions-v1.cjs +104 -0
- package/dist/record/family/assertions-v1.cjs.map +1 -0
- package/dist/record/family/assertions-v1.d.cts +2 -0
- package/dist/record/family/assertions-v1.d.mts +2 -0
- package/dist/record/family/assertions-v1.d.ts +2 -0
- package/dist/record/family/assertions-v1.js +6 -0
- package/dist/record/family/assertions-v1.js.map +1 -0
- package/dist/record/family/assertions.cjs +16 -5
- package/dist/record/family/assertions.cjs.map +1 -1
- package/dist/record/family/assertions.d.cts +510 -56
- package/dist/record/family/assertions.d.mts +510 -56
- package/dist/record/family/assertions.d.ts +510 -56
- package/dist/record/family/assertions.js +14 -10
- package/dist/record/family/catalog.cjs +17 -1
- package/dist/record/family/catalog.cjs.map +1 -1
- package/dist/record/family/catalog.d.cts +1292 -104
- package/dist/record/family/catalog.d.mts +1292 -104
- package/dist/record/family/catalog.d.ts +1292 -104
- package/dist/record/family/catalog.js +22 -20
- package/dist/record/family/index.js +144 -138
- package/dist/record/family/observability-v1.cjs +5 -0
- package/dist/record/family/observability-v1.cjs.map +1 -1
- package/dist/record/family/observability.cjs +1 -1
- package/dist/record/family/observability.cjs.map +1 -1
- package/dist/record/host/runtime.cjs +323 -173
- package/dist/record/host/runtime.cjs.map +1 -1
- package/dist/record/host/types.cjs.map +1 -1
- package/dist/record/host/types.d.cts +9 -7
- package/dist/record/host/types.d.mts +9 -7
- package/dist/record/host/types.d.ts +9 -7
- package/dist/record/model/core.cjs.map +1 -1
- package/dist/record/model/core.d.cts +1 -2
- package/dist/record/model/core.d.mts +1 -2
- package/dist/record/model/core.d.ts +1 -2
- package/dist/record/model/definition.cjs +1 -2
- package/dist/record/model/definition.cjs.map +1 -1
- package/dist/record/model/definition.d.cts +1 -7
- package/dist/record/model/definition.d.mts +1 -7
- package/dist/record/model/definition.d.ts +1 -7
- package/dist/record/model/identifiers.cjs +2 -3
- package/dist/record/model/identifiers.cjs.map +1 -1
- package/dist/record/model/identifiers.d.cts +1 -3
- package/dist/record/model/identifiers.d.mts +1 -3
- package/dist/record/model/identifiers.d.ts +1 -3
- package/dist/record/model/identifiers.js +36 -38
- package/dist/record/model/index.js +60 -62
- package/dist/record/platform/node.cjs +17 -7
- package/dist/record/platform/node.cjs.map +1 -1
- package/dist/record/platform/services.cjs.map +1 -1
- package/dist/record/platform/services.d.cts +8 -3
- package/dist/record/platform/services.d.mts +8 -3
- package/dist/record/platform/services.d.ts +8 -3
- package/dist/record/reader/format.cjs +16 -65
- package/dist/record/reader/format.cjs.map +1 -1
- package/dist/record/reader/format.d.cts +5 -9
- package/dist/record/reader/format.d.mts +5 -9
- package/dist/record/reader/format.d.ts +5 -9
- package/dist/record/reader/index.js +10 -8
- package/dist/record/reader/runtime.cjs +63 -32
- package/dist/record/reader/runtime.cjs.map +1 -1
- package/dist/record/reader/runtime.d.cts +40 -4
- package/dist/record/reader/runtime.d.mts +40 -4
- package/dist/record/reader/runtime.d.ts +40 -4
- package/dist/record/reader/runtime.js +6 -4
- package/dist/report/assets/enhance.js +5 -5
- package/dist/report/assets/styles.css +190 -24
- package/dist/report/built-in/result-components.cjs +8 -5
- package/dist/report/built-in/result-components.cjs.map +1 -1
- package/dist/report/built-in/standard.cjs +3 -0
- package/dist/report/built-in/standard.cjs.map +1 -1
- package/dist/report/built-in/standard.d.cts +2 -0
- package/dist/report/built-in/standard.d.mts +2 -0
- package/dist/report/built-in/standard.d.ts +2 -0
- package/dist/report/client-dist/app.js +53 -0
- package/dist/report/components/attempt-detail/compute.cjs +108 -231
- package/dist/report/components/attempt-detail/compute.cjs.map +1 -1
- package/dist/report/components/attempt-detail/compute.d.cts +11 -45
- package/dist/report/components/attempt-detail/compute.d.mts +11 -45
- package/dist/report/components/attempt-detail/compute.d.ts +11 -45
- package/dist/report/components/attempt-detail/compute.js +2 -4
- package/dist/report/components/attempt-detail/content.cjs +4 -4
- package/dist/report/components/attempt-detail/content.cjs.map +1 -1
- package/dist/report/components/attempt-detail/validate.cjs +47 -4
- package/dist/report/components/attempt-detail/validate.cjs.map +1 -1
- package/dist/report/components/entity-lists/compute.cjs +9 -15
- package/dist/report/components/entity-lists/compute.cjs.map +1 -1
- package/dist/report/components/entity-lists/content.cjs +53 -40
- package/dist/report/components/entity-lists/content.cjs.map +1 -1
- package/dist/report/components/entity-lists/index.cjs +1 -3
- package/dist/report/components/entity-lists/index.cjs.map +1 -1
- package/dist/report/components/experiment-detail/compute.cjs +4 -6
- package/dist/report/components/experiment-detail/compute.cjs.map +1 -1
- package/dist/report/components/summaries/index.cjs +5 -1
- package/dist/report/components/summaries/index.cjs.map +1 -1
- package/dist/report/definition/cell.cjs +14 -7
- package/dist/report/definition/cell.cjs.map +1 -1
- package/dist/report/definition/cell.d.cts +4 -0
- package/dist/report/definition/cell.d.mts +4 -0
- package/dist/report/definition/cell.d.ts +4 -0
- package/dist/report/definition/primitives/assertion-evidence.cjs +96 -0
- package/dist/report/definition/primitives/assertion-evidence.cjs.map +1 -0
- package/dist/report/definition/primitives/assertion-evidence.d.cts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.d.mts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.d.ts +11 -0
- package/dist/report/definition/primitives/assertion-evidence.js +6 -0
- package/dist/report/definition/primitives/assertion-evidence.js.map +1 -0
- package/dist/report/definition/primitives/conversation.cjs +7 -0
- package/dist/report/definition/primitives/conversation.cjs.map +1 -1
- package/dist/report/definition/primitives/conversation.d.cts +2 -0
- package/dist/report/definition/primitives/conversation.d.mts +2 -0
- package/dist/report/definition/primitives/conversation.d.ts +2 -0
- package/dist/report/definition/primitives/turn-trace.cjs +53 -3
- package/dist/report/definition/primitives/turn-trace.cjs.map +1 -1
- package/dist/report/definition/primitives.cjs +14 -1
- package/dist/report/definition/primitives.cjs.map +1 -1
- package/dist/report/definition/report.cjs +16 -8
- package/dist/report/definition/report.cjs.map +1 -1
- package/dist/report/definition/report.d.cts +6 -0
- package/dist/report/definition/report.d.mts +6 -0
- package/dist/report/definition/report.d.ts +6 -0
- package/dist/report/definition/table-text.cjs +12 -3
- package/dist/report/definition/table-text.cjs.map +1 -1
- package/dist/report/definition/table-text.d.cts +6 -1
- package/dist/report/definition/table-text.d.mts +6 -1
- package/dist/report/definition/table-text.d.ts +6 -1
- package/dist/report/execution/model.cjs +6 -14
- package/dist/report/execution/model.cjs.map +1 -1
- package/dist/report/execution/model.d.cts +5 -10
- package/dist/report/execution/model.d.mts +5 -10
- package/dist/report/execution/model.d.ts +5 -10
- package/dist/report/execution/model.js +6 -6
- package/dist/report/execution/paths.cjs +0 -11
- package/dist/report/execution/paths.cjs.map +1 -1
- package/dist/report/execution/paths.d.cts +0 -1
- package/dist/report/execution/paths.d.mts +0 -1
- package/dist/report/execution/paths.d.ts +0 -1
- package/dist/report/execution/paths.js +6 -8
- package/dist/report/host/execute.cjs +13 -22
- package/dist/report/host/execute.cjs.map +1 -1
- package/dist/report/host/execute.d.cts +1 -4
- package/dist/report/host/execute.d.mts +1 -4
- package/dist/report/host/execute.d.ts +1 -4
- package/dist/report/host/from-record.cjs +3 -0
- package/dist/report/host/from-record.cjs.map +1 -1
- package/dist/report/host/from-record.d.cts +4 -1
- package/dist/report/host/from-record.d.mts +4 -1
- package/dist/report/host/from-record.d.ts +4 -1
- package/dist/report/host/site-assets.cjs +1 -2
- package/dist/report/host/site-assets.cjs.map +1 -1
- package/dist/report/host/site-assets.d.cts +0 -1
- package/dist/report/host/site-assets.d.mts +0 -1
- package/dist/report/host/site-assets.d.ts +0 -1
- package/dist/report/host/site-assets.js +2 -4
- package/dist/report/host/static.cjs +71 -346
- package/dist/report/host/static.cjs.map +1 -1
- package/dist/report/host/static.d.cts +1 -3
- package/dist/report/host/static.d.mts +1 -3
- package/dist/report/host/static.d.ts +1 -3
- package/dist/report/host/static.js +2 -2
- package/dist/report/host/view-session.cjs.map +1 -1
- package/dist/report/host/view-session.d.cts +1 -1
- package/dist/report/host/view-session.d.mts +1 -1
- package/dist/report/host/view-session.d.ts +1 -1
- package/dist/report/model/locale.cjs +1 -1
- package/dist/report/model/locale.cjs.map +1 -1
- package/dist/report/model/locale.d.cts +1 -1
- package/dist/report/model/locale.d.mts +1 -1
- package/dist/report/model/locale.d.ts +1 -1
- package/dist/report/model/pricing.cjs +2 -2
- package/dist/report/model/pricing.cjs.map +1 -1
- package/dist/report/react/enhance.js +5 -5
- package/dist/report/react/styles.css +190 -24
- package/dist/runner/adoption.cjs +4 -7
- package/dist/runner/adoption.cjs.map +1 -1
- package/dist/runner/attempt-resources.cjs +60 -0
- package/dist/runner/attempt-resources.cjs.map +1 -0
- package/dist/runner/attempt-resources.d.cts +13 -0
- package/dist/runner/attempt-resources.d.mts +13 -0
- package/dist/runner/attempt-resources.d.ts +13 -0
- package/dist/runner/attempt-resources.js +6 -0
- package/dist/runner/attempt-resources.js.map +1 -0
- package/dist/runner/attempt.cjs +37 -3
- package/dist/runner/attempt.cjs.map +1 -1
- package/dist/runner/feedback/failure.cjs +77 -2
- package/dist/runner/feedback/failure.cjs.map +1 -1
- package/dist/runner/feedback/failure.d.cts +2 -1
- package/dist/runner/feedback/failure.d.mts +2 -1
- package/dist/runner/feedback/failure.d.ts +2 -1
- package/dist/runner/project-current.cjs +2 -13
- package/dist/runner/project-current.cjs.map +1 -1
- package/dist/runner/project-current.d.cts +4 -2
- package/dist/runner/project-current.d.mts +4 -2
- package/dist/runner/project-current.d.ts +4 -2
- package/dist/runner/reporters/braintrust.cjs +7 -7
- package/dist/runner/reporters/braintrust.cjs.map +1 -1
- package/dist/runner/reuse-readback.cjs +3 -4
- package/dist/runner/reuse-readback.cjs.map +1 -1
- package/dist/runner/run.cjs +5 -2
- package/dist/runner/run.cjs.map +1 -1
- package/dist/sandbox/backend.cjs +32 -2
- package/dist/sandbox/backend.cjs.map +1 -1
- package/dist/sandbox/backend.d.cts +12 -1
- package/dist/sandbox/backend.d.mts +12 -1
- package/dist/sandbox/backend.d.ts +12 -1
- package/dist/sandbox/backend.js +28 -22
- package/dist/sandbox/docker.cjs +140 -0
- package/dist/sandbox/docker.cjs.map +1 -1
- package/dist/sandbox/docker.d.cts +3 -1
- package/dist/sandbox/docker.d.mts +3 -1
- package/dist/sandbox/docker.d.ts +3 -1
- package/dist/sandbox/e2b.cjs +42 -0
- package/dist/sandbox/e2b.cjs.map +1 -1
- package/dist/sandbox/e2b.d.cts +2 -0
- package/dist/sandbox/e2b.d.mts +2 -0
- package/dist/sandbox/e2b.d.ts +2 -0
- package/dist/sandbox/local.cjs +64 -0
- package/dist/sandbox/local.cjs.map +1 -1
- package/dist/sandbox/local.d.cts +3 -1
- package/dist/sandbox/local.d.mts +3 -1
- package/dist/sandbox/local.d.ts +3 -1
- package/dist/sandbox/managed-process.cjs +49 -0
- package/dist/sandbox/managed-process.cjs.map +1 -0
- package/dist/sandbox/managed-process.d.cts +11 -0
- package/dist/sandbox/managed-process.d.mts +11 -0
- package/dist/sandbox/managed-process.d.ts +11 -0
- package/dist/sandbox/managed-process.js +6 -0
- package/dist/sandbox/managed-process.js.map +1 -0
- package/dist/sandbox/types.cjs.map +1 -1
- package/dist/sandbox/types.d.cts +24 -0
- package/dist/sandbox/types.d.mts +24 -0
- package/dist/sandbox/types.d.ts +24 -0
- package/dist/sandbox/vercel.cjs +1 -0
- package/dist/sandbox/vercel.cjs.map +1 -1
- package/dist/sandbox/vercel.d.cts +1 -0
- package/dist/sandbox/vercel.d.mts +1 -0
- package/dist/sandbox/vercel.d.ts +1 -0
- package/dist/view/server.cjs +2 -37
- package/dist/view/server.cjs.map +1 -1
- package/dist/view/server.d.cts +0 -3
- package/dist/view/server.d.mts +0 -3
- package/dist/view/server.d.ts +0 -3
- package/docs-site/zh/reference/builtin-agents.mdx +7 -7
- package/docs-site/zh/reference/official-adapters.mdx +4 -4
- package/docs-site/zh/reference/report-components.mdx +2 -2
- package/docs-site/zh/tutorials/configuration.mdx +2 -2
- package/docs-site/zh/tutorials/deploy-report-site.mdx +24 -2
- package/docs-site/zh/tutorials/publish-report.mdx +4 -4
- package/docs-site/zh/tutorials/sandbox-agent.mdx +5 -5
- package/docs-site/zh/tutorials/theming.mdx +2 -2
- package/package.json +4 -6
- package/dist/record/migration/index.cjs +0 -5
- package/dist/record/migration/index.cjs.map +0 -1
- package/dist/record/migration/index.d.cts +0 -11
- package/dist/record/migration/index.d.mts +0 -11
- package/dist/record/migration/index.d.ts +0 -11
- package/dist/record/migration/index.js +0 -6
- package/dist/record/migration/index.js.map +0 -1
- package/dist/report/host/site-runtime.cjs +0 -92
- package/dist/report/host/site-runtime.cjs.map +0 -1
- package/dist/report/host/site-runtime.d.cts +0 -9
- package/dist/report/host/site-runtime.d.mts +0 -9
- package/dist/report/host/site-runtime.d.ts +0 -9
- package/dist/report/host/site-runtime.js +0 -10
- package/dist/report/host/site-runtime.js.map +0 -1
- package/dist/view/client-dist/app.css +0 -2
- package/dist/view/client-dist/app.js +0 -49
- package/dist/view/data.cjs +0 -3
- package/dist/view/data.cjs.map +0 -1
- package/dist/view/data.d.cts +0 -9
- package/dist/view/data.d.mts +0 -9
- package/dist/view/data.d.ts +0 -9
- package/dist/view/data.js +0 -4
- package/dist/view/data.js.map +0 -1
- package/dist/view/index.cjs +0 -24
- package/dist/view/index.cjs.map +0 -1
- package/dist/view/index.d.cts +0 -9
- package/dist/view/index.d.mts +0 -9
- package/dist/view/index.d.ts +0 -9
- package/dist/view/index.js +0 -28
- package/dist/view/index.js.map +0 -1
- package/dist/view/report-view-cache.cjs +0 -200
- package/dist/view/report-view-cache.cjs.map +0 -1
- package/dist/view/report-view-cache.d.cts +0 -67
- package/dist/view/report-view-cache.d.mts +0 -67
- package/dist/view/report-view-cache.d.ts +0 -67
- package/dist/view/report-view-cache.js +0 -8
- package/dist/view/report-view-cache.js.map +0 -1
- package/dist/view/shared/types.cjs +0 -3
- package/dist/view/shared/types.cjs.map +0 -1
- package/dist/view/shared/types.d.cts +0 -51
- package/dist/view/shared/types.d.mts +0 -51
- package/dist/view/shared/types.d.ts +0 -51
- package/dist/view/shared/types.js +0 -4
- package/dist/view/shared/types.js.map +0 -1
- package/dist/view/site.cjs +0 -32
- package/dist/view/site.cjs.map +0 -1
- package/dist/view/site.d.cts +0 -24
- package/dist/view/site.d.mts +0 -24
- package/dist/view/site.d.ts +0 -24
- package/dist/view/site.js +0 -8
- package/dist/view/site.js.map +0 -1
- package/dist/view/styles.css +0 -170
- package/dist/view/template.html +0 -17
|
@@ -117,8 +117,8 @@ function sameRoot(left, right) {
|
|
|
117
117
|
leftPaths.portableRoot === rightPaths.portableRoot;
|
|
118
118
|
}
|
|
119
119
|
function currentFormatInspection(fileSystem, root) {
|
|
120
|
-
return (0, format_ts_1.readRecordFormatForMaintenance)(fileSystem, root).pipe(effect_1.Effect.flatMap((
|
|
121
|
-
state:
|
|
120
|
+
return (0, format_ts_1.readRecordFormatForMaintenance)(fileSystem, root).pipe(effect_1.Effect.flatMap(() => effect_1.Effect.map(planAttachmentMigration({ fileSystem, root }), (attachments) => ({
|
|
121
|
+
state: attachments.targets.length === 0
|
|
122
122
|
? "already-current"
|
|
123
123
|
: "migration-required",
|
|
124
124
|
format: identifiers_ts_1.RECORD_FORMAT,
|
|
@@ -359,49 +359,25 @@ function scanSelection(runtime, fileSystem, request) {
|
|
|
359
359
|
const wanted = request?.runIds === undefined
|
|
360
360
|
? undefined
|
|
361
361
|
: new Set(request.runIds);
|
|
362
|
-
const entries = orderedEntries(yield* fileSystem.listDirectory({
|
|
363
|
-
directory: recordPath(runtime.root, "runs"),
|
|
364
|
-
maximumEntries: MAXIMUM_RUN_ENTRIES,
|
|
365
|
-
}));
|
|
366
362
|
const snapshot = yield* readSealedCoreSnapshot(runtime, fileSystem);
|
|
367
|
-
const found = new Set();
|
|
368
363
|
const warnings = [];
|
|
369
364
|
const problems = [];
|
|
370
365
|
const documents = [];
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
continue;
|
|
374
|
-
const runId = decodeRunId(entry.name);
|
|
375
|
-
if (runId === undefined)
|
|
376
|
-
continue;
|
|
377
|
-
found.add(runId);
|
|
378
|
-
const sealed = yield* isSealedRun(fileSystem, runtime.root, runId);
|
|
379
|
-
if (!sealed) {
|
|
380
|
-
warnings.push(Object.freeze({
|
|
381
|
-
code: "incomplete-run",
|
|
382
|
-
runId,
|
|
383
|
-
cleanupCommand: "niceeval clean",
|
|
384
|
-
}));
|
|
385
|
-
if (wanted?.has(runId)) {
|
|
386
|
-
problems.push(Object.freeze({ code: "incomplete-run", runId }));
|
|
387
|
-
}
|
|
388
|
-
continue;
|
|
389
|
-
}
|
|
390
|
-
if (wanted !== undefined && !wanted.has(runId))
|
|
391
|
-
continue;
|
|
392
|
-
const core = snapshot.state === "available" ? snapshot.byRunId.get(runId) : undefined;
|
|
393
|
-
if (core === undefined) {
|
|
366
|
+
if (snapshot.state === "core-invalid") {
|
|
367
|
+
for (const runId of wanted ?? []) {
|
|
394
368
|
problems.push(Object.freeze({ code: "record-core-invalid", runId }));
|
|
395
369
|
}
|
|
396
|
-
else {
|
|
397
|
-
documents.push(core.run);
|
|
398
|
-
}
|
|
399
370
|
}
|
|
400
|
-
if (wanted
|
|
371
|
+
else if (wanted === undefined) {
|
|
372
|
+
documents.push(...[...snapshot.byRunId.values()].map((core) => core.run));
|
|
373
|
+
}
|
|
374
|
+
else {
|
|
401
375
|
for (const runId of wanted) {
|
|
402
|
-
|
|
376
|
+
const core = snapshot.byRunId.get(runId);
|
|
377
|
+
if (core === undefined)
|
|
403
378
|
problems.push(Object.freeze({ code: "selection-run-missing", runId }));
|
|
404
|
-
|
|
379
|
+
else
|
|
380
|
+
documents.push(core.run);
|
|
405
381
|
}
|
|
406
382
|
}
|
|
407
383
|
const orderedDocuments = documents.sort((left, right) => (0, identifiers_ts_1.compareCanonicalIdentity)(left.runId, right.runId));
|
|
@@ -752,7 +728,6 @@ function mintRecordDocument(entropy) {
|
|
|
752
728
|
? effect_1.Effect.fail(coreInvalid())
|
|
753
729
|
: effect_1.Effect.succeed(Object.freeze({
|
|
754
730
|
format: format.right,
|
|
755
|
-
schemaVersion: identifiers_ts_1.RECORD_SCHEMA_VERSION,
|
|
756
731
|
recordId: id.right,
|
|
757
732
|
}));
|
|
758
733
|
});
|
|
@@ -803,8 +778,6 @@ function openCurrentRead(input) {
|
|
|
803
778
|
return yield* effect_1.Effect.fail(migrationInterrupted());
|
|
804
779
|
}
|
|
805
780
|
const current = yield* (0, format_ts_1.readCurrentRecordFormat)(fileSystem, input.root);
|
|
806
|
-
yield* ensureOrdinaryCurrentAttachments({ fileSystem, root: input.root });
|
|
807
|
-
yield* coordination.verifyRecordIdentity({ root: input.root, recordId: current.document.recordId });
|
|
808
781
|
const lifecycle = { closed: false };
|
|
809
782
|
const runtime = {
|
|
810
783
|
root: input.root,
|
|
@@ -817,6 +790,15 @@ function openCurrentRead(input) {
|
|
|
817
790
|
attemptsByKey: new Map(),
|
|
818
791
|
sealedCoreSnapshot: undefined,
|
|
819
792
|
};
|
|
793
|
+
const snapshot = yield* readSealedCoreSnapshot(runtime, fileSystem);
|
|
794
|
+
if (snapshot.state === "core-invalid")
|
|
795
|
+
return yield* effect_1.Effect.fail(bootstrapInvalid());
|
|
796
|
+
yield* ensureOrdinaryCurrentAttachments({
|
|
797
|
+
fileSystem,
|
|
798
|
+
root: input.root,
|
|
799
|
+
runIds: new Set(snapshot.byRunId.keys()),
|
|
800
|
+
});
|
|
801
|
+
yield* coordination.verifyRecordIdentity({ root: input.root, recordId: current.document.recordId });
|
|
820
802
|
yield* effect_1.Effect.addFinalizer(() => effect_1.Effect.sync(() => { lifecycle.closed = true; }));
|
|
821
803
|
return makeReadSession(runtime, fileSystem);
|
|
822
804
|
});
|
|
@@ -1703,16 +1685,10 @@ function migrationDescriptor(descriptor) {
|
|
|
1703
1685
|
return descriptor;
|
|
1704
1686
|
}
|
|
1705
1687
|
const runMigrationDescriptors = Object.freeze([
|
|
1706
|
-
|
|
1707
|
-
migrationDescriptor(catalog_ts_1.NiceEvalRecordFamilyCatalog.sources),
|
|
1708
|
-
migrationDescriptor(catalog_ts_1.NiceEvalRecordFamilyCatalog.artifacts.run),
|
|
1688
|
+
...catalog_ts_1.NiceEvalRecordFamilyDescriptorsByOwner.run.map(migrationDescriptor),
|
|
1709
1689
|
]);
|
|
1710
1690
|
const attemptMigrationDescriptors = Object.freeze([
|
|
1711
|
-
|
|
1712
|
-
migrationDescriptor(catalog_ts_1.NiceEvalRecordFamilyCatalog.observability.attempt),
|
|
1713
|
-
migrationDescriptor(catalog_ts_1.NiceEvalRecordFamilyCatalog.fileChanges),
|
|
1714
|
-
migrationDescriptor(catalog_ts_1.NiceEvalRecordFamilyCatalog.sourceNavigation),
|
|
1715
|
-
migrationDescriptor(catalog_ts_1.NiceEvalRecordFamilyCatalog.artifacts.attempt),
|
|
1691
|
+
...catalog_ts_1.NiceEvalRecordFamilyDescriptorsByOwner.attempt.map(migrationDescriptor),
|
|
1716
1692
|
]);
|
|
1717
1693
|
function validateAttachmentDirectoryInventory(input) {
|
|
1718
1694
|
return effect_1.Effect.gen(function* () {
|
|
@@ -1738,7 +1714,7 @@ function validateAttachmentDirectoryInventory(input) {
|
|
|
1738
1714
|
}
|
|
1739
1715
|
});
|
|
1740
1716
|
}
|
|
1741
|
-
function validateCurrentFamilyInventory(fileSystem, root) {
|
|
1717
|
+
function validateCurrentFamilyInventory(fileSystem, root, runIds) {
|
|
1742
1718
|
const runFamilies = new Set(runMigrationDescriptors.map((descriptor) => descriptor.family));
|
|
1743
1719
|
const attemptFamilies = new Set(attemptMigrationDescriptors.map((descriptor) => descriptor.family));
|
|
1744
1720
|
return effect_1.Effect.gen(function* () {
|
|
@@ -1752,6 +1728,8 @@ function validateCurrentFamilyInventory(fileSystem, root) {
|
|
|
1752
1728
|
const runId = decodeRunId(entry.name);
|
|
1753
1729
|
if (runId === undefined || !(yield* isSealedRun(fileSystem, root, runId)))
|
|
1754
1730
|
continue;
|
|
1731
|
+
if (runIds !== undefined && !runIds.has(runId))
|
|
1732
|
+
continue;
|
|
1755
1733
|
yield* validateAttachmentDirectoryInventory({
|
|
1756
1734
|
fileSystem,
|
|
1757
1735
|
directory: (0, services_ts_1.recordPortablePath)(root, "runs", runId, "attachments"),
|
|
@@ -1798,7 +1776,7 @@ function migrationReaderLocation(location) {
|
|
|
1798
1776
|
* never enumerates an attachment directory, so unknown families cannot enter
|
|
1799
1777
|
* the migration graph or be rewritten as a side effect.
|
|
1800
1778
|
*/
|
|
1801
|
-
function knownMigrationAttachments(fileSystem, root) {
|
|
1779
|
+
function knownMigrationAttachments(fileSystem, root, runIds) {
|
|
1802
1780
|
return effect_1.Effect.gen(function* () {
|
|
1803
1781
|
const locations = [];
|
|
1804
1782
|
const runs = yield* fileSystem.listDirectory({
|
|
@@ -1811,6 +1789,8 @@ function knownMigrationAttachments(fileSystem, root) {
|
|
|
1811
1789
|
const runId = decodeRunId(entry.name);
|
|
1812
1790
|
if (runId === undefined)
|
|
1813
1791
|
continue;
|
|
1792
|
+
if (runIds !== undefined && !runIds.has(runId))
|
|
1793
|
+
continue;
|
|
1814
1794
|
// Draft directories are not Runs and belong exclusively to `niceeval
|
|
1815
1795
|
// clean`; maintenance must preserve every byte beneath them.
|
|
1816
1796
|
if (!(yield* isSealedRun(fileSystem, root, runId)))
|
|
@@ -1871,17 +1851,78 @@ function migrationFailureCode(error) {
|
|
|
1871
1851
|
const code = Reflect.get(error, "code");
|
|
1872
1852
|
return typeof code === "string" ? code : "record-command-failed";
|
|
1873
1853
|
}
|
|
1874
|
-
function
|
|
1854
|
+
function normalizedMigrationRetention(value) {
|
|
1855
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
1856
|
+
return undefined;
|
|
1857
|
+
const retention = value;
|
|
1858
|
+
const retainedFacts = retention.retainedFacts;
|
|
1859
|
+
const droppedFacts = retention.droppedFacts;
|
|
1860
|
+
const rerunRecommendation = retention.rerunRecommendation;
|
|
1861
|
+
if (!Array.isArray(retainedFacts) || retainedFacts.some((fact) => typeof fact !== "string" || fact.length === 0) ||
|
|
1862
|
+
!Array.isArray(droppedFacts) || droppedFacts.some((fact) => typeof fact !== "string" || fact.length === 0) ||
|
|
1863
|
+
(rerunRecommendation !== null &&
|
|
1864
|
+
(typeof rerunRecommendation !== "string" || rerunRecommendation.length === 0)))
|
|
1865
|
+
return undefined;
|
|
1866
|
+
return Object.freeze({
|
|
1867
|
+
retainedFacts: Object.freeze([...retainedFacts]),
|
|
1868
|
+
droppedFacts: Object.freeze([...droppedFacts]),
|
|
1869
|
+
rerunRecommendation,
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
function migrationTarget(location, fromSchemaVersion, toSchemaVersion, retention) {
|
|
1875
1873
|
return Object.freeze({
|
|
1876
1874
|
family: location.descriptor.family,
|
|
1877
1875
|
owner: location.owner,
|
|
1878
1876
|
runId: location.runId,
|
|
1879
1877
|
...(location.attemptId === undefined ? {} : { attemptId: location.attemptId }),
|
|
1880
|
-
fromSchemaVersion
|
|
1881
|
-
toSchemaVersion
|
|
1878
|
+
fromSchemaVersion,
|
|
1879
|
+
toSchemaVersion,
|
|
1880
|
+
retention,
|
|
1882
1881
|
});
|
|
1883
1882
|
}
|
|
1884
|
-
|
|
1883
|
+
function migrationLocationKey(owner, runId, attemptId, family) {
|
|
1884
|
+
return `${owner}\u0000${runId}\u0000${attemptId ?? ""}\u0000${family}`;
|
|
1885
|
+
}
|
|
1886
|
+
function validateProspectiveCrossFamilyJoins(values) {
|
|
1887
|
+
const byLocation = new Map(values.map(({ location, payload }) => [
|
|
1888
|
+
migrationLocationKey(location.owner, location.runId, location.attemptId, location.descriptor.family),
|
|
1889
|
+
payload,
|
|
1890
|
+
]));
|
|
1891
|
+
for (const { location, payload } of values) {
|
|
1892
|
+
const runSources = () => byLocation.get(migrationLocationKey("run", location.runId, undefined, catalog_ts_1.NiceEvalRecordFamilyCatalog.sources.family));
|
|
1893
|
+
if (isObservabilityDescriptor(location.descriptor)) {
|
|
1894
|
+
const observability = payload;
|
|
1895
|
+
if (hasSourceFrames(observability)) {
|
|
1896
|
+
const sources = runSources();
|
|
1897
|
+
if (sources === undefined || (0, observability_ts_1.observabilitySourceFrameIntegrityIssues)(observability, sources).length > 0) {
|
|
1898
|
+
return false;
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
else if (isAssertionsDescriptor(location.descriptor)) {
|
|
1903
|
+
const assertions = payload;
|
|
1904
|
+
if (assertions.sourceSites.length > 0) {
|
|
1905
|
+
const sources = runSources();
|
|
1906
|
+
if (sources === undefined || (0, assertions_ts_1.assertionsSourceSiteIntegrityIssues)(assertions, sources).length > 0) {
|
|
1907
|
+
return false;
|
|
1908
|
+
}
|
|
1909
|
+
}
|
|
1910
|
+
}
|
|
1911
|
+
else if (isSourceNavigationDescriptor(location.descriptor)) {
|
|
1912
|
+
if (location.attemptId === undefined)
|
|
1913
|
+
return false;
|
|
1914
|
+
const navigation = payload;
|
|
1915
|
+
const observability = byLocation.get(migrationLocationKey("attempt", location.runId, location.attemptId, catalog_ts_1.NiceEvalRecordFamilyCatalog.observability.attempt.family));
|
|
1916
|
+
const sources = hasMappedNavigationRows(navigation) ? runSources() : undefined;
|
|
1917
|
+
if (observability === undefined ||
|
|
1918
|
+
(hasMappedNavigationRows(navigation) && sources === undefined) ||
|
|
1919
|
+
(0, source_navigation_ts_1.sourceNavigationIntegrityIssues)({ payload: navigation, observability, sources }).length > 0)
|
|
1920
|
+
return false;
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
return true;
|
|
1924
|
+
}
|
|
1925
|
+
const RECORD_MIGRATION_IMPLEMENTATION_ID = "niceeval.record/current-attachments/v2";
|
|
1885
1926
|
const migrationPlanSources = new WeakMap();
|
|
1886
1927
|
function bytesEqual(left, right) {
|
|
1887
1928
|
return left.byteLength === right.byteLength && left.every((byte, index) => byte === right[index]);
|
|
@@ -1896,11 +1937,9 @@ function sameMigrationPlan(left, right) {
|
|
|
1896
1937
|
return true;
|
|
1897
1938
|
if (JSON.stringify(left.backup) !== JSON.stringify(right.backup))
|
|
1898
1939
|
return false;
|
|
1899
|
-
if (JSON.stringify(left.root) !== JSON.stringify(right.root))
|
|
1900
|
-
return false;
|
|
1901
1940
|
if (left.attachments.length !== right.attachments.length)
|
|
1902
1941
|
return false;
|
|
1903
|
-
|
|
1942
|
+
if (!left.attachments.every((target, index) => {
|
|
1904
1943
|
const candidate = right.attachments[index];
|
|
1905
1944
|
return candidate !== undefined &&
|
|
1906
1945
|
target.family === candidate.family &&
|
|
@@ -1908,23 +1947,46 @@ function sameMigrationPlan(left, right) {
|
|
|
1908
1947
|
target.runId === candidate.runId &&
|
|
1909
1948
|
target.attemptId === candidate.attemptId &&
|
|
1910
1949
|
target.fromSchemaVersion === candidate.fromSchemaVersion &&
|
|
1911
|
-
target.toSchemaVersion === candidate.toSchemaVersion
|
|
1950
|
+
target.toSchemaVersion === candidate.toSchemaVersion &&
|
|
1951
|
+
JSON.stringify(target.retention) === JSON.stringify(candidate.retention);
|
|
1952
|
+
}))
|
|
1953
|
+
return false;
|
|
1954
|
+
const leftSources = migrationPlanSources.get(left);
|
|
1955
|
+
const rightSources = migrationPlanSources.get(right);
|
|
1956
|
+
if (leftSources === undefined || rightSources === undefined ||
|
|
1957
|
+
leftSources.implementationIdentity !== rightSources.implementationIdentity ||
|
|
1958
|
+
!bytesEqual(leftSources.rootIdentityBytes, rightSources.rootIdentityBytes) ||
|
|
1959
|
+
leftSources.attachments.length !== rightSources.attachments.length)
|
|
1960
|
+
return false;
|
|
1961
|
+
return leftSources.attachments.every((source, index) => {
|
|
1962
|
+
const candidate = rightSources.attachments[index];
|
|
1963
|
+
return candidate !== undefined &&
|
|
1964
|
+
bytesEqual(source.envelopeBytes, candidate.envelopeBytes) &&
|
|
1965
|
+
bytesEqual(source.payloadBytes, candidate.payloadBytes) &&
|
|
1966
|
+
source.rewritePayload === candidate.rewritePayload &&
|
|
1967
|
+
source.removedBlobs.length === candidate.removedBlobs.length &&
|
|
1968
|
+
source.removedBlobs.every((blob, blobIndex) => {
|
|
1969
|
+
const other = candidate.removedBlobs[blobIndex];
|
|
1970
|
+
return other !== undefined && blob.key === other.key && bytesEqual(blob.bytes, other.bytes);
|
|
1971
|
+
});
|
|
1912
1972
|
});
|
|
1913
1973
|
}
|
|
1914
1974
|
function planAttachmentMigration(input) {
|
|
1915
1975
|
return effect_1.Effect.gen(function* () {
|
|
1916
|
-
yield* validateCurrentFamilyInventory(input.fileSystem, input.root);
|
|
1976
|
+
yield* validateCurrentFamilyInventory(input.fileSystem, input.root, input.runIds);
|
|
1917
1977
|
const targets = [];
|
|
1918
1978
|
const sources = [];
|
|
1919
|
-
|
|
1979
|
+
const prospective = [];
|
|
1980
|
+
for (const location of yield* knownMigrationAttachments(input.fileSystem, input.root, input.runIds)) {
|
|
1920
1981
|
const read = yield* readKnownMigrationAttachment(input.fileSystem, input.root, location);
|
|
1921
|
-
if (read.state === "available")
|
|
1982
|
+
if (read.state === "available") {
|
|
1983
|
+
prospective.push(Object.freeze({ location, payload: read.value }));
|
|
1922
1984
|
continue;
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1985
|
+
}
|
|
1986
|
+
const migrationLink = read.state === "migration-required"
|
|
1987
|
+
? location.descriptor.adjacentMigrationLinks.find((link) => link.fromSchemaVersion === read.fromSchemaVersion && link.toSchemaVersion === read.toSchemaVersion)
|
|
1988
|
+
: undefined;
|
|
1989
|
+
if (read.state === "migration-required" && migrationLink !== undefined) {
|
|
1928
1990
|
const envelopeBytes = yield* input.fileSystem.readFile({
|
|
1929
1991
|
file: migrationEnvelopePath(input.root, location),
|
|
1930
1992
|
maximumBytes: limits_ts_1.RECORD_JSON_MAXIMUM_BYTES,
|
|
@@ -1932,8 +1994,47 @@ function planAttachmentMigration(input) {
|
|
|
1932
1994
|
if (envelopeBytes === undefined) {
|
|
1933
1995
|
return yield* effect_1.Effect.fail(migrationInvalid(location.descriptor.family));
|
|
1934
1996
|
}
|
|
1997
|
+
const facet = yield* loadAttachmentMaintenance(location.descriptor);
|
|
1998
|
+
const historical = facet.historicalCodecs.find((codec) => codec.schemaVersion === read.fromSchemaVersion);
|
|
1999
|
+
const step = facet.adjacentMigrations.find((migration) => migration.fromSchemaVersion === read.fromSchemaVersion &&
|
|
2000
|
+
migration.toSchemaVersion === read.toSchemaVersion);
|
|
2001
|
+
if (historical === undefined || step === undefined) {
|
|
2002
|
+
return yield* effect_1.Effect.fail(migrationInvalid(location.descriptor.family));
|
|
2003
|
+
}
|
|
2004
|
+
const retention = normalizedMigrationRetention(step.retention);
|
|
2005
|
+
if (retention === undefined) {
|
|
2006
|
+
return yield* effect_1.Effect.fail(migrationInvalid(location.descriptor.family));
|
|
2007
|
+
}
|
|
2008
|
+
const target = migrationTarget(location, read.fromSchemaVersion, read.toSchemaVersion, retention);
|
|
2009
|
+
const prepared = yield* (0, runtime_ts_1.validateFixedRecordAttachmentMigrationSource)({
|
|
2010
|
+
fileSystem: input.fileSystem,
|
|
2011
|
+
root: input.root,
|
|
2012
|
+
location: migrationReaderLocation(location),
|
|
2013
|
+
descriptor: location.descriptor,
|
|
2014
|
+
fromSchemaVersion: read.fromSchemaVersion,
|
|
2015
|
+
decodeHistorical: historical.decode,
|
|
2016
|
+
...(historical.verify === undefined ? {} : { verifyHistorical: historical.verify }),
|
|
2017
|
+
migrate: step.migrate,
|
|
2018
|
+
});
|
|
2019
|
+
if (prepared === false || prepared.rewritePayload !== migrationLink.rewritePayload) {
|
|
2020
|
+
return yield* effect_1.Effect.fail(migrationInvalid(location.descriptor.family));
|
|
2021
|
+
}
|
|
2022
|
+
prospective.push(Object.freeze({ location, payload: prepared.payload }));
|
|
2023
|
+
const payloadBytes = yield* input.fileSystem.readFile({
|
|
2024
|
+
file: (0, services_ts_1.recordPortablePath)(input.root, ...migrationAttachmentDirectory(input.root, location).segments, "payload.json"),
|
|
2025
|
+
maximumBytes: limits_ts_1.RECORD_JSON_MAXIMUM_BYTES,
|
|
2026
|
+
});
|
|
2027
|
+
if (payloadBytes === undefined)
|
|
2028
|
+
return yield* effect_1.Effect.fail(migrationInvalid(location.descriptor.family));
|
|
1935
2029
|
targets.push(target);
|
|
1936
|
-
sources.push(Object.freeze({
|
|
2030
|
+
sources.push(Object.freeze({
|
|
2031
|
+
target,
|
|
2032
|
+
location,
|
|
2033
|
+
envelopeBytes,
|
|
2034
|
+
payloadBytes,
|
|
2035
|
+
removedBlobs: prepared.removedBlobs,
|
|
2036
|
+
rewritePayload: migrationLink.rewritePayload,
|
|
2037
|
+
}));
|
|
1937
2038
|
continue;
|
|
1938
2039
|
}
|
|
1939
2040
|
if (read.state === "unsupported") {
|
|
@@ -1944,6 +2045,9 @@ function planAttachmentMigration(input) {
|
|
|
1944
2045
|
}
|
|
1945
2046
|
return yield* effect_1.Effect.fail(migrationInvalid(location.descriptor.family));
|
|
1946
2047
|
}
|
|
2048
|
+
if (!validateProspectiveCrossFamilyJoins(prospective)) {
|
|
2049
|
+
return yield* effect_1.Effect.fail(migrationInvalid("niceeval.record cross-family"));
|
|
2050
|
+
}
|
|
1947
2051
|
return Object.freeze({
|
|
1948
2052
|
targets: Object.freeze(targets),
|
|
1949
2053
|
sources: Object.freeze(sources),
|
|
@@ -1951,29 +2055,41 @@ function planAttachmentMigration(input) {
|
|
|
1951
2055
|
});
|
|
1952
2056
|
}
|
|
1953
2057
|
function ensureOrdinaryCurrentAttachments(input) {
|
|
1954
|
-
return
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
2058
|
+
return effect_1.Effect.gen(function* () {
|
|
2059
|
+
yield* validateCurrentFamilyInventory(input.fileSystem, input.root, input.runIds);
|
|
2060
|
+
for (const location of yield* knownMigrationAttachments(input.fileSystem, input.root, input.runIds)) {
|
|
2061
|
+
const envelope = yield* (0, runtime_ts_1.inspectFixedRecordAttachmentEnvelope)({
|
|
2062
|
+
fileSystem: input.fileSystem,
|
|
2063
|
+
root: input.root,
|
|
2064
|
+
location: migrationReaderLocation(location),
|
|
2065
|
+
descriptor: location.descriptor,
|
|
2066
|
+
});
|
|
2067
|
+
if (envelope.state === "current" || envelope.state === "unavailable")
|
|
2068
|
+
continue;
|
|
2069
|
+
if (envelope.state === "migration-required") {
|
|
2070
|
+
return yield* effect_1.Effect.fail(new errors_ts_3.RecordMigrationRequired({
|
|
2071
|
+
code: "record-migration-required",
|
|
2072
|
+
source: `${envelope.family}@${envelope.fromSchemaVersion}`,
|
|
2073
|
+
target: `${envelope.family}@${envelope.toSchemaVersion}`,
|
|
2074
|
+
command: "niceeval migrate",
|
|
2075
|
+
}));
|
|
2076
|
+
}
|
|
2077
|
+
if (envelope.state === "unsupported") {
|
|
2078
|
+
return yield* effect_1.Effect.fail(new errors_ts_3.RecordFormatUnsupported({
|
|
2079
|
+
code: "record-format-unsupported",
|
|
2080
|
+
format: `${envelope.family}@${envelope.schemaVersion}`,
|
|
2081
|
+
}));
|
|
2082
|
+
}
|
|
2083
|
+
return yield* effect_1.Effect.fail(bootstrapInvalid());
|
|
2084
|
+
}
|
|
2085
|
+
});
|
|
1964
2086
|
}
|
|
1965
2087
|
function migrationPlan(input) {
|
|
1966
2088
|
return effect_1.Effect.gen(function* () {
|
|
1967
2089
|
const format = yield* (0, format_ts_1.readRecordFormatForMaintenance)(input.fileSystem, input.root);
|
|
1968
2090
|
yield* validateSealedCoreForMigration(input.fileSystem, input.root, format.document);
|
|
1969
2091
|
const attachments = yield* planAttachmentMigration(input);
|
|
1970
|
-
|
|
1971
|
-
? null
|
|
1972
|
-
: Object.freeze({
|
|
1973
|
-
fromSchemaVersion: format.sourceSchemaVersion,
|
|
1974
|
-
toSchemaVersion: identifiers_ts_1.RECORD_SCHEMA_VERSION,
|
|
1975
|
-
});
|
|
1976
|
-
if (rootMigration === null && attachments.targets.length === 0) {
|
|
2092
|
+
if (attachments.targets.length === 0) {
|
|
1977
2093
|
return Object.freeze({ state: "already-current", format: identifiers_ts_1.RECORD_FORMAT });
|
|
1978
2094
|
}
|
|
1979
2095
|
const backup = yield* input.git.inspectBackupState(input.root);
|
|
@@ -1981,13 +2097,11 @@ function migrationPlan(input) {
|
|
|
1981
2097
|
state: "migration-required",
|
|
1982
2098
|
format: identifiers_ts_1.RECORD_FORMAT,
|
|
1983
2099
|
backup,
|
|
1984
|
-
root: rootMigration,
|
|
1985
2100
|
attachments: attachments.targets,
|
|
1986
2101
|
});
|
|
1987
2102
|
migrationPlanSources.set(plan, Object.freeze({
|
|
1988
2103
|
attachments: attachments.sources,
|
|
1989
|
-
|
|
1990
|
-
record: format.document,
|
|
2104
|
+
rootIdentityBytes: format.sourceBytes,
|
|
1991
2105
|
implementationIdentity: RECORD_MIGRATION_IMPLEMENTATION_ID,
|
|
1992
2106
|
}));
|
|
1993
2107
|
return plan;
|
|
@@ -1998,39 +2112,35 @@ function validateSealedCoreForMigration(fileSystem, root, record) {
|
|
|
1998
2112
|
? effect_1.Effect.void
|
|
1999
2113
|
: effect_1.Effect.fail(migrationInvalid("niceeval.core")));
|
|
2000
2114
|
}
|
|
2001
|
-
function
|
|
2002
|
-
const loader =
|
|
2115
|
+
function loadAttachmentMaintenance(descriptor) {
|
|
2116
|
+
const loader = descriptor.maintenance;
|
|
2003
2117
|
if (loader === undefined)
|
|
2004
|
-
return effect_1.Effect.fail(migrationInvalid(
|
|
2118
|
+
return effect_1.Effect.fail(migrationInvalid(descriptor.family));
|
|
2005
2119
|
return effect_1.Effect.tryPromise({
|
|
2006
2120
|
try: loader,
|
|
2007
|
-
catch: () => migrationInvalid(
|
|
2121
|
+
catch: () => migrationInvalid(descriptor.family),
|
|
2008
2122
|
});
|
|
2009
2123
|
}
|
|
2010
|
-
function
|
|
2124
|
+
function migrateKnownAttachment(input) {
|
|
2011
2125
|
return effect_1.Effect.gen(function* () {
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
input.target.toSchemaVersion
|
|
2126
|
+
const descriptor = input.location.descriptor;
|
|
2127
|
+
const migrationLink = descriptor.adjacentMigrationLinks.find((link) => link.fromSchemaVersion === input.target.fromSchemaVersion &&
|
|
2128
|
+
link.toSchemaVersion === input.target.toSchemaVersion);
|
|
2129
|
+
if (migrationLink === undefined || migrationLink.rewritePayload !== input.rewritePayload) {
|
|
2015
2130
|
return yield* effect_1.Effect.fail(migrationInvalid(input.target.family));
|
|
2016
2131
|
}
|
|
2017
|
-
const
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
const
|
|
2021
|
-
|
|
2022
|
-
: Object.freeze({
|
|
2023
|
-
owner: "attempt",
|
|
2024
|
-
runId: input.target.runId,
|
|
2025
|
-
attemptId: input.target.attemptId,
|
|
2026
|
-
descriptor,
|
|
2027
|
-
});
|
|
2028
|
-
const facet = yield* loadObservabilityV1Maintenance();
|
|
2029
|
-
const historical = facet.historicalCodecs.find((codec) => codec.schemaVersion === 1);
|
|
2030
|
-
const step = facet.adjacentMigrations.find((migration) => migration.fromSchemaVersion === 1 && migration.toSchemaVersion === 2);
|
|
2132
|
+
const location = input.location;
|
|
2133
|
+
const facet = yield* loadAttachmentMaintenance(descriptor);
|
|
2134
|
+
const historical = facet.historicalCodecs.find((codec) => codec.schemaVersion === input.target.fromSchemaVersion);
|
|
2135
|
+
const step = facet.adjacentMigrations.find((migration) => migration.fromSchemaVersion === input.target.fromSchemaVersion &&
|
|
2136
|
+
migration.toSchemaVersion === input.target.toSchemaVersion);
|
|
2031
2137
|
if (historical === undefined || step === undefined) {
|
|
2032
2138
|
return yield* effect_1.Effect.fail(migrationInvalid(input.target.family));
|
|
2033
2139
|
}
|
|
2140
|
+
const retention = normalizedMigrationRetention(step.retention);
|
|
2141
|
+
if (retention === undefined || JSON.stringify(retention) !== JSON.stringify(input.target.retention)) {
|
|
2142
|
+
return yield* effect_1.Effect.fail(migrationInvalid(input.target.family));
|
|
2143
|
+
}
|
|
2034
2144
|
const envelopePath = migrationEnvelopePath(input.root, location);
|
|
2035
2145
|
const sourceBeforeValidation = yield* input.fileSystem.readFile({
|
|
2036
2146
|
file: envelopePath,
|
|
@@ -2039,16 +2149,25 @@ function migrateObservabilityAttachment(input) {
|
|
|
2039
2149
|
if (sourceBeforeValidation === undefined || !bytesEqual(sourceBeforeValidation, input.expectedEnvelopeBytes)) {
|
|
2040
2150
|
return yield* effect_1.Effect.fail(migrationPlanStale());
|
|
2041
2151
|
}
|
|
2042
|
-
const
|
|
2152
|
+
const payloadPath = (0, services_ts_1.recordPortablePath)(input.root, ...migrationAttachmentDirectory(input.root, location).segments, "payload.json");
|
|
2153
|
+
const payloadBeforeValidation = yield* input.fileSystem.readFile({
|
|
2154
|
+
file: payloadPath,
|
|
2155
|
+
maximumBytes: limits_ts_1.RECORD_JSON_MAXIMUM_BYTES,
|
|
2156
|
+
});
|
|
2157
|
+
if (payloadBeforeValidation === undefined || !bytesEqual(payloadBeforeValidation, input.expectedPayloadBytes)) {
|
|
2158
|
+
return yield* effect_1.Effect.fail(migrationPlanStale());
|
|
2159
|
+
}
|
|
2160
|
+
const validated = yield* (0, runtime_ts_1.validateFixedRecordAttachmentMigrationSource)({
|
|
2043
2161
|
fileSystem: input.fileSystem,
|
|
2044
2162
|
root: input.root,
|
|
2045
2163
|
location: migrationReaderLocation(location),
|
|
2046
2164
|
descriptor,
|
|
2047
|
-
fromSchemaVersion:
|
|
2165
|
+
fromSchemaVersion: input.target.fromSchemaVersion,
|
|
2048
2166
|
decodeHistorical: historical.decode,
|
|
2167
|
+
...(historical.verify === undefined ? {} : { verifyHistorical: historical.verify }),
|
|
2049
2168
|
migrate: step.migrate,
|
|
2050
2169
|
});
|
|
2051
|
-
if (
|
|
2170
|
+
if (validated === false) {
|
|
2052
2171
|
const sourceAfterInvalid = yield* input.fileSystem.readFile({
|
|
2053
2172
|
file: envelopePath,
|
|
2054
2173
|
maximumBytes: limits_ts_1.RECORD_JSON_MAXIMUM_BYTES,
|
|
@@ -2059,8 +2178,8 @@ function migrateObservabilityAttachment(input) {
|
|
|
2059
2178
|
return yield* effect_1.Effect.fail(migrationInvalid(input.target.family));
|
|
2060
2179
|
}
|
|
2061
2180
|
const envelope = (0, catalog_ts_1.encodeFixedRecordAttachmentEnvelope)({
|
|
2062
|
-
family:
|
|
2063
|
-
schemaVersion:
|
|
2181
|
+
family: descriptor.family,
|
|
2182
|
+
schemaVersion: input.target.toSchemaVersion,
|
|
2064
2183
|
});
|
|
2065
2184
|
if (effect_1.Either.isLeft(envelope))
|
|
2066
2185
|
return yield* effect_1.Effect.fail(migrationInvalid(input.target.family));
|
|
@@ -2071,6 +2190,44 @@ function migrateObservabilityAttachment(input) {
|
|
|
2071
2190
|
if (sourceBeforeWrite === undefined || !bytesEqual(sourceBeforeWrite, input.expectedEnvelopeBytes)) {
|
|
2072
2191
|
return yield* effect_1.Effect.fail(migrationPlanStale());
|
|
2073
2192
|
}
|
|
2193
|
+
if (validated.rewritePayload !== input.rewritePayload) {
|
|
2194
|
+
return yield* effect_1.Effect.fail(migrationInvalid(input.target.family));
|
|
2195
|
+
}
|
|
2196
|
+
if (validated.removedBlobs.length !== input.expectedRemovedBlobs.length ||
|
|
2197
|
+
validated.removedBlobs.some((blob, index) => {
|
|
2198
|
+
const expected = input.expectedRemovedBlobs[index];
|
|
2199
|
+
return expected === undefined || blob.key !== expected.key || !bytesEqual(blob.bytes, expected.bytes);
|
|
2200
|
+
})) {
|
|
2201
|
+
return yield* effect_1.Effect.fail(migrationPlanStale());
|
|
2202
|
+
}
|
|
2203
|
+
if (input.rewritePayload) {
|
|
2204
|
+
const encodedPayload = descriptor.write.encodePayload(validated.payload);
|
|
2205
|
+
if (effect_1.Either.isLeft(encodedPayload))
|
|
2206
|
+
return yield* effect_1.Effect.fail(migrationInvalid(input.target.family));
|
|
2207
|
+
const durablePayload = (0, attachment_payload_ts_1.encodeAttachmentPayloadForStorage)({
|
|
2208
|
+
payload: encodedPayload.right,
|
|
2209
|
+
blobKeys: validated.blobKeys,
|
|
2210
|
+
});
|
|
2211
|
+
if (effect_1.Either.isLeft(durablePayload))
|
|
2212
|
+
return yield* effect_1.Effect.fail(migrationInvalid(input.target.family));
|
|
2213
|
+
yield* input.fileSystem.writeFile({
|
|
2214
|
+
file: payloadPath,
|
|
2215
|
+
bytes: jsonBytes(durablePayload.right),
|
|
2216
|
+
maximumBytes: limits_ts_1.RECORD_JSON_MAXIMUM_BYTES,
|
|
2217
|
+
mode: "replace-no-follow",
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
for (const blob of input.expectedRemovedBlobs) {
|
|
2221
|
+
const blobPath = (0, services_ts_1.recordPortablePath)(input.root, ...migrationAttachmentDirectory(input.root, location).segments, "blobs", blob.key);
|
|
2222
|
+
const beforeDelete = yield* input.fileSystem.readFile({
|
|
2223
|
+
file: blobPath,
|
|
2224
|
+
maximumBytes: descriptor.write.budget.maximumBlobBytes,
|
|
2225
|
+
});
|
|
2226
|
+
if (beforeDelete === undefined || !bytesEqual(beforeDelete, blob.bytes)) {
|
|
2227
|
+
return yield* effect_1.Effect.fail(migrationPlanStale());
|
|
2228
|
+
}
|
|
2229
|
+
yield* input.fileSystem.removeFile((0, services_ts_1.recordPortablePath)(input.root, ...migrationAttachmentDirectory(input.root, location).segments, "blobs", blob.key));
|
|
2230
|
+
}
|
|
2074
2231
|
yield* input.fileSystem.writeFile({
|
|
2075
2232
|
file: envelopePath,
|
|
2076
2233
|
bytes: jsonBytes(envelope.right),
|
|
@@ -2102,35 +2259,10 @@ function validateCurrentKnownAttachments(input) {
|
|
|
2102
2259
|
}
|
|
2103
2260
|
function migrationRecoveryIsSafe(input) {
|
|
2104
2261
|
return effect_1.Effect.gen(function* () {
|
|
2105
|
-
const
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
if (effect_1.Either.isLeft(encoded))
|
|
2110
|
-
return false;
|
|
2111
|
-
const currentEnvelopeBytes = jsonBytes(encoded.right);
|
|
2112
|
-
const expectedPaths = [(0, services_ts_1.recordPortablePath)(input.root, "migration.in-progress")];
|
|
2113
|
-
const currentRoot = yield* input.fileSystem.readFile({
|
|
2114
|
-
file: (0, services_ts_1.recordPortablePath)(input.root, "record.json"),
|
|
2115
|
-
maximumBytes: format_ts_1.RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES,
|
|
2116
|
-
});
|
|
2117
|
-
if (currentRoot !== undefined) {
|
|
2118
|
-
const parsed = parseJson(currentRoot);
|
|
2119
|
-
if (typeof parsed === "object" && parsed !== null &&
|
|
2120
|
-
Reflect.get(parsed, "schemaVersion") === identifiers_ts_1.RECORD_SCHEMA_VERSION)
|
|
2121
|
-
expectedPaths.push((0, services_ts_1.recordPortablePath)(input.root, "record.json"));
|
|
2122
|
-
}
|
|
2123
|
-
for (const location of yield* knownMigrationAttachments(input.fileSystem, input.root)) {
|
|
2124
|
-
if (location.descriptor.family !== catalog_ts_1.NiceEvalRecordAttachments.observability.family)
|
|
2125
|
-
continue;
|
|
2126
|
-
const path = migrationEnvelopePath(input.root, location);
|
|
2127
|
-
const bytes = yield* input.fileSystem.readFile({
|
|
2128
|
-
file: path,
|
|
2129
|
-
maximumBytes: limits_ts_1.RECORD_JSON_MAXIMUM_BYTES,
|
|
2130
|
-
});
|
|
2131
|
-
if (bytes !== undefined && bytesEqual(bytes, currentEnvelopeBytes))
|
|
2132
|
-
expectedPaths.push(path);
|
|
2133
|
-
}
|
|
2262
|
+
const expectedPaths = [
|
|
2263
|
+
(0, services_ts_1.recordPortablePath)(input.root, "migration.in-progress"),
|
|
2264
|
+
...input.expectedRelativePaths.map((relative) => (0, services_ts_1.recordPortablePath)(input.root, ...relative.split("/"))),
|
|
2265
|
+
];
|
|
2134
2266
|
return yield* input.git.recoveryChangesAreExpected({
|
|
2135
2267
|
root: input.root,
|
|
2136
2268
|
restoreCommit: input.restoreCommit,
|
|
@@ -2145,11 +2277,17 @@ function openMaintenance(input) {
|
|
|
2145
2277
|
const git = yield* services_ts_1.RecordGit;
|
|
2146
2278
|
yield* coordination.enterRecordMaintenance(input.root);
|
|
2147
2279
|
if (yield* fileSystem.migrationSentinelPresent(input.root)) {
|
|
2148
|
-
const
|
|
2149
|
-
const restoreSafe =
|
|
2280
|
+
const sentinel = yield* fileSystem.readMigrationSentinel(input.root);
|
|
2281
|
+
const restoreSafe = sentinel === undefined
|
|
2150
2282
|
? false
|
|
2151
|
-
: yield* migrationRecoveryIsSafe({
|
|
2152
|
-
|
|
2283
|
+
: yield* migrationRecoveryIsSafe({
|
|
2284
|
+
fileSystem,
|
|
2285
|
+
git,
|
|
2286
|
+
root: input.root,
|
|
2287
|
+
restoreCommit: sentinel.restoreCommit,
|
|
2288
|
+
expectedRelativePaths: sentinel.expectedRelativePaths,
|
|
2289
|
+
});
|
|
2290
|
+
return yield* effect_1.Effect.fail(migrationInterrupted(sentinel?.restoreCommit, restoreSafe));
|
|
2153
2291
|
}
|
|
2154
2292
|
const inspect = () => currentFormatInspection(fileSystem, input.root);
|
|
2155
2293
|
const planMigrate = () => effect_1.Effect.gen(function* () {
|
|
@@ -2183,14 +2321,32 @@ function openMaintenance(input) {
|
|
|
2183
2321
|
const plannedSources = migrationPlanSources.get(currentPlan);
|
|
2184
2322
|
if (plannedSources === undefined ||
|
|
2185
2323
|
plannedSources.implementationIdentity !== RECORD_MIGRATION_IMPLEMENTATION_ID ||
|
|
2186
|
-
plannedSources.attachments.length !== currentPlan.attachments.length
|
|
2187
|
-
|
|
2188
|
-
return yield* effect_1.Effect.fail(migrationInvalid(catalog_ts_1.NiceEvalRecordAttachments.observability.family));
|
|
2324
|
+
plannedSources.attachments.length !== currentPlan.attachments.length) {
|
|
2325
|
+
return yield* effect_1.Effect.fail(migrationInvalid("niceeval.core"));
|
|
2189
2326
|
}
|
|
2190
2327
|
let portableTargetWritten = false;
|
|
2328
|
+
const expectedRelativePaths = Object.freeze([
|
|
2329
|
+
...plannedSources.attachments.flatMap((source) => {
|
|
2330
|
+
const base = migrationAttachmentDirectory(input.root, source.location).segments.join("/");
|
|
2331
|
+
return source.rewritePayload
|
|
2332
|
+
? [
|
|
2333
|
+
`${base}/attachment.json`,
|
|
2334
|
+
`${base}/payload.json`,
|
|
2335
|
+
...source.removedBlobs.map((blob) => `${base}/blobs/${blob.key}`),
|
|
2336
|
+
]
|
|
2337
|
+
: [`${base}/attachment.json`];
|
|
2338
|
+
}),
|
|
2339
|
+
]);
|
|
2340
|
+
const rootBeforeSentinel = yield* fileSystem.readFile({
|
|
2341
|
+
file: (0, services_ts_1.recordPortablePath)(input.root, "record.json"),
|
|
2342
|
+
maximumBytes: format_ts_1.RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES,
|
|
2343
|
+
});
|
|
2344
|
+
if (rootBeforeSentinel === undefined ||
|
|
2345
|
+
!bytesEqual(rootBeforeSentinel, plannedSources.rootIdentityBytes))
|
|
2346
|
+
return yield* effect_1.Effect.fail(migrationPlanStale());
|
|
2191
2347
|
// The sentinel is the first portable write. Any later failure or
|
|
2192
2348
|
// interruption intentionally leaves it behind for Git recovery.
|
|
2193
|
-
yield* fileSystem.createMigrationSentinel(input.root, restoreCommit);
|
|
2349
|
+
yield* fileSystem.createMigrationSentinel(input.root, restoreCommit, expectedRelativePaths);
|
|
2194
2350
|
const sentinelOnly = yield* git.recoveryChangesAreExpected({
|
|
2195
2351
|
root: input.root,
|
|
2196
2352
|
restoreCommit,
|
|
@@ -2202,31 +2358,15 @@ function openMaintenance(input) {
|
|
|
2202
2358
|
}
|
|
2203
2359
|
yield* effect_1.Effect.gen(function* () {
|
|
2204
2360
|
for (const source of plannedSources.attachments) {
|
|
2205
|
-
yield*
|
|
2361
|
+
yield* migrateKnownAttachment({
|
|
2206
2362
|
fileSystem,
|
|
2207
2363
|
root: input.root,
|
|
2364
|
+
location: source.location,
|
|
2208
2365
|
target: source.target,
|
|
2209
2366
|
expectedEnvelopeBytes: source.envelopeBytes,
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
if (plannedSources.rootBytes !== null) {
|
|
2214
|
-
const rootPath = (0, services_ts_1.recordPortablePath)(input.root, "record.json");
|
|
2215
|
-
const sourceBeforeRootWrite = yield* fileSystem.readFile({
|
|
2216
|
-
file: rootPath,
|
|
2217
|
-
maximumBytes: format_ts_1.RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES,
|
|
2218
|
-
});
|
|
2219
|
-
if (sourceBeforeRootWrite === undefined ||
|
|
2220
|
-
!bytesEqual(sourceBeforeRootWrite, plannedSources.rootBytes))
|
|
2221
|
-
return yield* effect_1.Effect.fail(migrationPlanStale());
|
|
2222
|
-
const encodedRoot = (0, index_ts_1.encodeRecordDocument)(plannedSources.record);
|
|
2223
|
-
if (effect_1.Either.isLeft(encodedRoot))
|
|
2224
|
-
return yield* effect_1.Effect.fail(migrationInvalid("niceeval.core"));
|
|
2225
|
-
yield* fileSystem.writeFile({
|
|
2226
|
-
file: rootPath,
|
|
2227
|
-
bytes: jsonBytes(encodedRoot.right),
|
|
2228
|
-
maximumBytes: format_ts_1.RECORD_FORMAT_DOCUMENT_MAXIMUM_BYTES,
|
|
2229
|
-
mode: "replace-no-follow",
|
|
2367
|
+
expectedPayloadBytes: source.payloadBytes,
|
|
2368
|
+
expectedRemovedBlobs: source.removedBlobs,
|
|
2369
|
+
rewritePayload: source.rewritePayload,
|
|
2230
2370
|
});
|
|
2231
2371
|
portableTargetWritten = true;
|
|
2232
2372
|
}
|
|
@@ -2235,7 +2375,13 @@ function openMaintenance(input) {
|
|
|
2235
2375
|
yield* validateCurrentKnownAttachments({ fileSystem, root: input.root });
|
|
2236
2376
|
yield* fileSystem.removeMigrationSentinel(input.root);
|
|
2237
2377
|
}).pipe(effect_1.Effect.catchAll((error) => {
|
|
2238
|
-
const recoveryRequired = () => effect_1.Effect.flatMap(migrationRecoveryIsSafe({
|
|
2378
|
+
const recoveryRequired = () => effect_1.Effect.flatMap(migrationRecoveryIsSafe({
|
|
2379
|
+
fileSystem,
|
|
2380
|
+
git,
|
|
2381
|
+
root: input.root,
|
|
2382
|
+
restoreCommit,
|
|
2383
|
+
expectedRelativePaths,
|
|
2384
|
+
}), (restoreSafe) => effect_1.Effect.fail(new errors_ts_3.RecordMigrationRecoveryRequired({
|
|
2239
2385
|
code: "record-migration-recovery-required",
|
|
2240
2386
|
causeCode: migrationFailureCode(error),
|
|
2241
2387
|
restoreCommit,
|
|
@@ -2249,7 +2395,11 @@ function openMaintenance(input) {
|
|
|
2249
2395
|
}
|
|
2250
2396
|
return recoveryRequired();
|
|
2251
2397
|
}));
|
|
2252
|
-
return Object.freeze({
|
|
2398
|
+
return Object.freeze({
|
|
2399
|
+
state: "migrated",
|
|
2400
|
+
format: identifiers_ts_1.RECORD_FORMAT,
|
|
2401
|
+
attachments: currentPlan.attachments,
|
|
2402
|
+
});
|
|
2253
2403
|
}),
|
|
2254
2404
|
});
|
|
2255
2405
|
});
|