@smthrs/engine-store 1.0.0-rc.4 → 1.0.0-rc.6
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/README.md +5 -5
- package/dist/cjs/ArtifactGc.d.ts +1 -1
- package/dist/cjs/ArtifactGc.d.ts.map +1 -1
- package/dist/cjs/ArtifactGc.js +1 -1
- package/dist/cjs/ArtifactGc.js.map +1 -1
- package/dist/cjs/DeferredClockFold.d.ts +4 -4
- package/dist/cjs/DeferredClockFold.d.ts.map +1 -1
- package/dist/cjs/DeferredClockFold.js +1 -1
- package/dist/cjs/DeferredClockFold.js.map +1 -1
- package/dist/cjs/DisasterRecovery.d.ts +1 -1
- package/dist/cjs/DisasterRecovery.d.ts.map +1 -1
- package/dist/cjs/DisasterRecovery.js +1 -1
- package/dist/cjs/DisasterRecovery.js.map +1 -1
- package/dist/cjs/DurableEngineState.d.ts +1 -1
- package/dist/cjs/DurableEngineState.d.ts.map +1 -1
- package/dist/cjs/DurableEngineState.js +1 -1
- package/dist/cjs/DurableEngineState.js.map +1 -1
- package/dist/cjs/ExecutionSnapshot.d.ts +2 -2
- package/dist/cjs/ExecutionSnapshot.d.ts.map +1 -1
- package/dist/cjs/ExecutionSnapshot.js +1 -1
- package/dist/cjs/ExecutionSnapshot.js.map +1 -1
- package/dist/cjs/Migrations.d.ts +2 -2
- package/dist/cjs/Migrations.d.ts.map +1 -1
- package/dist/cjs/OwnerIdentity.js +1 -1
- package/dist/cjs/OwnerIdentity.js.map +2 -2
- package/dist/cjs/PlanInputStore.d.ts +1 -1
- package/dist/cjs/PlanInputStore.d.ts.map +1 -1
- package/dist/cjs/PlanInputStore.js +1 -1
- package/dist/cjs/PlanInputStore.js.map +1 -1
- package/dist/cjs/PlanMergeStore.d.ts +1 -1
- package/dist/cjs/PlanMergeStore.d.ts.map +1 -1
- package/dist/cjs/PlanMergeStore.js +1 -1
- package/dist/cjs/PlanMergeStore.js.map +1 -1
- package/dist/cjs/Retention.d.ts +2 -2
- package/dist/cjs/Retention.d.ts.map +1 -1
- package/dist/cjs/Retention.js +1 -1
- package/dist/cjs/Retention.js.map +1 -1
- package/dist/cjs/RunChangeFeed.d.ts +1 -1
- package/dist/cjs/RunChangeFeed.d.ts.map +1 -1
- package/dist/cjs/RunChangeFeed.js +1 -1
- package/dist/cjs/RunChangeFeed.js.map +1 -1
- package/dist/cjs/SelectionStore.d.ts +1 -1
- package/dist/cjs/SelectionStore.d.ts.map +1 -1
- package/dist/cjs/SelectionStore.js +1 -1
- package/dist/cjs/SelectionStore.js.map +1 -1
- package/dist/cjs/StepBoundary.js +3 -3
- package/dist/cjs/StepBoundary.js.map +2 -2
- package/dist/cjs/StepCacheFold.d.ts +2 -2
- package/dist/cjs/StepCacheFold.d.ts.map +1 -1
- package/dist/cjs/StepCacheFold.js +1 -1
- package/dist/cjs/StepCacheFold.js.map +1 -1
- package/dist/cjs/internal/EngineStateSchema.d.ts +1 -1
- package/dist/cjs/internal/EngineStateSchema.d.ts.map +1 -1
- package/dist/cjs/internal/EngineStateSchema.js.map +1 -1
- package/dist/cjs/internal/ExecutionSnapshotRead.d.ts +3 -3
- package/dist/cjs/internal/ExecutionSnapshotRead.d.ts.map +1 -1
- package/dist/cjs/internal/ExecutionSnapshotRead.js.map +1 -1
- package/dist/cjs/internal/ExecutionSnapshotRelations.d.ts +1 -1
- package/dist/cjs/internal/ExecutionSnapshotRelations.d.ts.map +1 -1
- package/dist/cjs/internal/ExecutionSnapshotRelations.js.map +1 -1
- package/dist/cjs/internal/RetentionOps.d.ts +2 -2
- package/dist/cjs/internal/RetentionOps.d.ts.map +1 -1
- package/dist/cjs/internal/RetentionOps.js +1 -1
- package/dist/cjs/internal/RetentionOps.js.map +1 -1
- package/dist/cjs/internal/RunCatalogOps.d.ts +1 -1
- package/dist/cjs/internal/RunCatalogOps.d.ts.map +1 -1
- package/dist/cjs/internal/RunCatalogOps.js +1 -1
- package/dist/cjs/internal/RunCatalogOps.js.map +1 -1
- package/dist/cjs/internal/RunListing.d.ts +1 -1
- package/dist/cjs/internal/RunListing.d.ts.map +1 -1
- package/dist/cjs/internal/RunListing.js +1 -1
- package/dist/cjs/internal/RunListing.js.map +1 -1
- package/dist/cjs/migrations/0001_initial.d.ts +1 -1
- package/dist/cjs/migrations/0001_initial.d.ts.map +1 -1
- package/dist/cjs/migrations/0001_initial.js +1 -1
- package/dist/cjs/migrations/0001_initial.js.map +1 -1
- package/dist/cjs/migrations/0002_selection_store.d.ts +1 -1
- package/dist/cjs/migrations/0002_selection_store.d.ts.map +1 -1
- package/dist/cjs/migrations/0002_selection_store.js +1 -1
- package/dist/cjs/migrations/0002_selection_store.js.map +1 -1
- package/dist/cjs/migrations/0003_plan_inputs.d.ts +1 -1
- package/dist/cjs/migrations/0003_plan_inputs.d.ts.map +1 -1
- package/dist/cjs/migrations/0003_plan_inputs.js +1 -1
- package/dist/cjs/migrations/0003_plan_inputs.js.map +1 -1
- package/dist/cjs/migrations/0004_plan_environment.d.ts +1 -1
- package/dist/cjs/migrations/0004_plan_environment.d.ts.map +1 -1
- package/dist/cjs/migrations/0004_plan_environment.js +1 -1
- package/dist/cjs/migrations/0004_plan_environment.js.map +1 -1
- package/dist/cjs/migrations/0005_plan_merges.d.ts +1 -1
- package/dist/cjs/migrations/0005_plan_merges.d.ts.map +1 -1
- package/dist/cjs/migrations/0005_plan_merges.js +1 -1
- package/dist/cjs/migrations/0005_plan_merges.js.map +1 -1
- package/dist/cjs/migrations/0006_execution_listing.d.ts +1 -1
- package/dist/cjs/migrations/0006_execution_listing.d.ts.map +1 -1
- package/dist/cjs/migrations/0006_execution_listing.js +1 -1
- package/dist/cjs/migrations/0006_execution_listing.js.map +1 -1
- package/dist/cjs/migrations/0007_run_parent_sequence.d.ts +1 -1
- package/dist/cjs/migrations/0007_run_parent_sequence.d.ts.map +1 -1
- package/dist/cjs/migrations/0007_run_parent_sequence.js +1 -1
- package/dist/cjs/migrations/0007_run_parent_sequence.js.map +1 -1
- package/dist/cjs/migrations/0008_deferred_consumption.d.ts +1 -1
- package/dist/cjs/migrations/0008_deferred_consumption.d.ts.map +1 -1
- package/dist/cjs/migrations/0008_deferred_consumption.js +1 -1
- package/dist/cjs/migrations/0008_deferred_consumption.js.map +1 -1
- package/dist/cjs/migrations/0009_deferred_clock_facts.d.ts +1 -1
- package/dist/cjs/migrations/0009_deferred_clock_facts.d.ts.map +1 -1
- package/dist/cjs/migrations/0009_deferred_clock_facts.js +1 -1
- package/dist/cjs/migrations/0009_deferred_clock_facts.js.map +1 -1
- package/dist/cjs/migrations/0010_pending_cancellation.d.ts +1 -1
- package/dist/cjs/migrations/0010_pending_cancellation.d.ts.map +1 -1
- package/dist/cjs/migrations/0010_pending_cancellation.js +1 -1
- package/dist/cjs/migrations/0010_pending_cancellation.js.map +1 -1
- package/dist/cjs/test/TestStores.d.ts +4 -4
- package/dist/cjs/test/TestStores.d.ts.map +1 -1
- package/dist/esm/ArtifactGc.d.ts +1 -1
- package/dist/esm/ArtifactGc.d.ts.map +1 -1
- package/dist/esm/ArtifactGc.js +1 -1
- package/dist/esm/ArtifactGc.js.map +1 -1
- package/dist/esm/DeferredClockFold.d.ts +4 -4
- package/dist/esm/DeferredClockFold.d.ts.map +1 -1
- package/dist/esm/DeferredClockFold.js +1 -1
- package/dist/esm/DeferredClockFold.js.map +1 -1
- package/dist/esm/DisasterRecovery.d.ts +1 -1
- package/dist/esm/DisasterRecovery.d.ts.map +1 -1
- package/dist/esm/DisasterRecovery.js +1 -1
- package/dist/esm/DisasterRecovery.js.map +1 -1
- package/dist/esm/DurableEngineState.d.ts +1 -1
- package/dist/esm/DurableEngineState.d.ts.map +1 -1
- package/dist/esm/DurableEngineState.js +1 -1
- package/dist/esm/DurableEngineState.js.map +1 -1
- package/dist/esm/ExecutionSnapshot.d.ts +2 -2
- package/dist/esm/ExecutionSnapshot.d.ts.map +1 -1
- package/dist/esm/ExecutionSnapshot.js +1 -1
- package/dist/esm/ExecutionSnapshot.js.map +1 -1
- package/dist/esm/Migrations.d.ts +2 -2
- package/dist/esm/Migrations.d.ts.map +1 -1
- package/dist/esm/OwnerIdentity.js +1 -1
- package/dist/esm/OwnerIdentity.js.map +1 -1
- package/dist/esm/PlanInputStore.d.ts +1 -1
- package/dist/esm/PlanInputStore.d.ts.map +1 -1
- package/dist/esm/PlanInputStore.js +1 -1
- package/dist/esm/PlanInputStore.js.map +1 -1
- package/dist/esm/PlanMergeStore.d.ts +1 -1
- package/dist/esm/PlanMergeStore.d.ts.map +1 -1
- package/dist/esm/PlanMergeStore.js +1 -1
- package/dist/esm/PlanMergeStore.js.map +1 -1
- package/dist/esm/Retention.d.ts +2 -2
- package/dist/esm/Retention.d.ts.map +1 -1
- package/dist/esm/Retention.js +1 -1
- package/dist/esm/Retention.js.map +1 -1
- package/dist/esm/RunChangeFeed.d.ts +1 -1
- package/dist/esm/RunChangeFeed.d.ts.map +1 -1
- package/dist/esm/RunChangeFeed.js +1 -1
- package/dist/esm/RunChangeFeed.js.map +1 -1
- package/dist/esm/SelectionStore.d.ts +1 -1
- package/dist/esm/SelectionStore.d.ts.map +1 -1
- package/dist/esm/SelectionStore.js +1 -1
- package/dist/esm/SelectionStore.js.map +1 -1
- package/dist/esm/StepBoundary.js +3 -3
- package/dist/esm/StepBoundary.js.map +1 -1
- package/dist/esm/StepCacheFold.d.ts +2 -2
- package/dist/esm/StepCacheFold.d.ts.map +1 -1
- package/dist/esm/StepCacheFold.js +1 -1
- package/dist/esm/StepCacheFold.js.map +1 -1
- package/dist/esm/internal/EngineStateSchema.d.ts +1 -1
- package/dist/esm/internal/EngineStateSchema.d.ts.map +1 -1
- package/dist/esm/internal/EngineStateSchema.js.map +1 -1
- package/dist/esm/internal/ExecutionSnapshotRead.d.ts +3 -3
- package/dist/esm/internal/ExecutionSnapshotRead.d.ts.map +1 -1
- package/dist/esm/internal/ExecutionSnapshotRead.js.map +1 -1
- package/dist/esm/internal/ExecutionSnapshotRelations.d.ts +1 -1
- package/dist/esm/internal/ExecutionSnapshotRelations.d.ts.map +1 -1
- package/dist/esm/internal/ExecutionSnapshotRelations.js.map +1 -1
- package/dist/esm/internal/RetentionOps.d.ts +2 -2
- package/dist/esm/internal/RetentionOps.d.ts.map +1 -1
- package/dist/esm/internal/RetentionOps.js +1 -1
- package/dist/esm/internal/RetentionOps.js.map +1 -1
- package/dist/esm/internal/RunCatalogOps.d.ts +1 -1
- package/dist/esm/internal/RunCatalogOps.d.ts.map +1 -1
- package/dist/esm/internal/RunCatalogOps.js +1 -1
- package/dist/esm/internal/RunCatalogOps.js.map +1 -1
- package/dist/esm/internal/RunListing.d.ts +1 -1
- package/dist/esm/internal/RunListing.d.ts.map +1 -1
- package/dist/esm/internal/RunListing.js +1 -1
- package/dist/esm/internal/RunListing.js.map +1 -1
- package/dist/esm/migrations/0001_initial.d.ts +1 -1
- package/dist/esm/migrations/0001_initial.d.ts.map +1 -1
- package/dist/esm/migrations/0001_initial.js +1 -1
- package/dist/esm/migrations/0001_initial.js.map +1 -1
- package/dist/esm/migrations/0002_selection_store.d.ts +1 -1
- package/dist/esm/migrations/0002_selection_store.d.ts.map +1 -1
- package/dist/esm/migrations/0002_selection_store.js +1 -1
- package/dist/esm/migrations/0002_selection_store.js.map +1 -1
- package/dist/esm/migrations/0003_plan_inputs.d.ts +1 -1
- package/dist/esm/migrations/0003_plan_inputs.d.ts.map +1 -1
- package/dist/esm/migrations/0003_plan_inputs.js +1 -1
- package/dist/esm/migrations/0003_plan_inputs.js.map +1 -1
- package/dist/esm/migrations/0004_plan_environment.d.ts +1 -1
- package/dist/esm/migrations/0004_plan_environment.d.ts.map +1 -1
- package/dist/esm/migrations/0004_plan_environment.js +1 -1
- package/dist/esm/migrations/0004_plan_environment.js.map +1 -1
- package/dist/esm/migrations/0005_plan_merges.d.ts +1 -1
- package/dist/esm/migrations/0005_plan_merges.d.ts.map +1 -1
- package/dist/esm/migrations/0005_plan_merges.js +1 -1
- package/dist/esm/migrations/0005_plan_merges.js.map +1 -1
- package/dist/esm/migrations/0006_execution_listing.d.ts +1 -1
- package/dist/esm/migrations/0006_execution_listing.d.ts.map +1 -1
- package/dist/esm/migrations/0006_execution_listing.js +1 -1
- package/dist/esm/migrations/0006_execution_listing.js.map +1 -1
- package/dist/esm/migrations/0007_run_parent_sequence.d.ts +1 -1
- package/dist/esm/migrations/0007_run_parent_sequence.d.ts.map +1 -1
- package/dist/esm/migrations/0007_run_parent_sequence.js +1 -1
- package/dist/esm/migrations/0007_run_parent_sequence.js.map +1 -1
- package/dist/esm/migrations/0008_deferred_consumption.d.ts +1 -1
- package/dist/esm/migrations/0008_deferred_consumption.d.ts.map +1 -1
- package/dist/esm/migrations/0008_deferred_consumption.js +1 -1
- package/dist/esm/migrations/0008_deferred_consumption.js.map +1 -1
- package/dist/esm/migrations/0009_deferred_clock_facts.d.ts +1 -1
- package/dist/esm/migrations/0009_deferred_clock_facts.d.ts.map +1 -1
- package/dist/esm/migrations/0009_deferred_clock_facts.js +1 -1
- package/dist/esm/migrations/0009_deferred_clock_facts.js.map +1 -1
- package/dist/esm/migrations/0010_pending_cancellation.d.ts +1 -1
- package/dist/esm/migrations/0010_pending_cancellation.d.ts.map +1 -1
- package/dist/esm/migrations/0010_pending_cancellation.js +1 -1
- package/dist/esm/migrations/0010_pending_cancellation.js.map +1 -1
- package/dist/esm/test/TestStores.d.ts +4 -4
- package/dist/esm/test/TestStores.d.ts.map +1 -1
- package/package.json +22 -22
- package/src/ArtifactGc.ts +1 -1
- package/src/DeferredClockFold.ts +1 -1
- package/src/DisasterRecovery.ts +1 -1
- package/src/DurableEngineState.ts +1 -1
- package/src/ExecutionSnapshot.ts +1 -1
- package/src/OwnerIdentity.ts +1 -1
- package/src/PlanInputStore.ts +1 -1
- package/src/PlanMergeStore.ts +1 -1
- package/src/Retention.ts +2 -2
- package/src/RunChangeFeed.ts +1 -1
- package/src/SelectionStore.ts +1 -1
- package/src/StepBoundary.ts +3 -3
- package/src/StepCacheFold.ts +1 -1
- package/src/internal/EngineStateSchema.ts +1 -1
- package/src/internal/ExecutionSnapshotRead.ts +1 -1
- package/src/internal/ExecutionSnapshotRelations.ts +1 -1
- package/src/internal/RetentionOps.ts +2 -2
- package/src/internal/RunCatalogOps.ts +1 -1
- package/src/internal/RunListing.ts +1 -1
- package/src/migrations/0001_initial.ts +1 -1
- package/src/migrations/0002_selection_store.ts +1 -1
- package/src/migrations/0003_plan_inputs.ts +1 -1
- package/src/migrations/0004_plan_environment.ts +1 -1
- package/src/migrations/0005_plan_merges.ts +1 -1
- package/src/migrations/0006_execution_listing.ts +1 -1
- package/src/migrations/0007_run_parent_sequence.ts +1 -1
- package/src/migrations/0008_deferred_consumption.ts +1 -1
- package/src/migrations/0009_deferred_clock_facts.ts +1 -1
- package/src/migrations/0010_pending_cancellation.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RunChangeFeed.js","sourceRoot":"","sources":["../../src/RunChangeFeed.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvD,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"RunChangeFeed.js","sourceRoot":"","sources":["../../src/RunChangeFeed.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvD,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AAEjD,OAAO,KAAK,IAAI,MAAM,qCAAqC,CAAA;AAkC3D;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,OAAO,CAAC,OAAO,EAA0B,CAAC,oCAAoC,CAAC;CAAG;AACrH;;;;;GAKG;A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AAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,QAAQ;iBAC5E,CAAA;YACH,CAAC,CAAC,CACH,CAAA;QACH,CAAC,CAAC,CACH;KACJ,CAAA;AACH,CAAC,CAAC,CAAA;AACJ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAA2D,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA","sourcesContent":["/**\n * Coalesced execution catch-up with permanent deletion evidence.\n *\n * @since 1.0.0\n */\n\nimport { RunStoreError } from \"@smthrs/run-store/RunStore\"\nimport { Context, Effect, Layer, Schema } from \"effect\"\nimport * as SqlClient from \"effect/sql/SqlClient\"\nimport type { Position } from \"./ExecutionSnapshot.ts\"\nimport * as Read from \"./internal/ExecutionSnapshotRead.ts\"\n\n/**\n * A live-row change or retained tombstone.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Change extends Position {\n readonly runId: string\n readonly deleted: boolean\n}\n/**\n * One catch-up page at an engine watermark.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Page extends Position {\n readonly changes: ReadonlyArray<Change>\n /** Resume here, including across gaps from coalesced changes. */\n readonly nextRevision: number\n readonly hasMore: boolean\n}\n/**\n * Bounded state-feed operations.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Service {\n readonly current: Effect.Effect<Position, RunStoreError>\n readonly changesSince: (options: Position & { readonly limit: number }) => Effect.Effect<Page, RunStoreError>\n}\n/**\n * Durable change-feed service.\n *\n * @category services\n * @since 1.0.0\n */\nexport class RunChangeFeed extends Context.Service<RunChangeFeed, Service>()(\"@smthrs/engine-store/RunChangeFeed\") {}\n/**\n * Maximum change-feed page size.\n *\n * @category constants\n * @since 1.0.0\n */\nexport const maximumPageSize = 1000\nconst Options = Schema.Struct({\n source: Read.Source,\n revision: Read.Natural,\n limit: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: maximumPageSize }))\n})\nconst ChangeRow = Schema.Struct({ run_id: Read.Identifier, revision: Read.Natural, deleted: Schema.Literals([0, 1]) })\n\n/**\n * Constructs the feed without polling or retention timers.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const make = (): Effect.Effect<Service, never, SqlClient.SqlClient> =>\n Effect.gen(function*() {\n const sql = yield* SqlClient.SqlClient\n return {\n current: Read.boundary(\"RunChangeFeed.current\", Read.position(sql)),\n changesSince: (options) =>\n Read.boundary(\n \"RunChangeFeed.changesSince\",\n Effect.gen(function*() {\n const input = yield* Read.decode(Options, options)\n return yield* Read.transaction(\n sql,\n Effect.gen(function*() {\n const at = yield* Read.position(sql)\n if (input.source !== at.source || input.revision > at.revision) {\n return yield* Effect.fail(\n new RunStoreError({\n method: \"RunChangeFeed.changesSince\",\n code: \"invalid_run\",\n message: \"change cursor requires an explicit source rebuild\",\n cause: { requested: input, observed: at }\n })\n )\n }\n const rows = yield* sql`SELECT run_id, revision, deleted FROM flows_run_changes\n WHERE revision > ${input.revision} AND revision <= ${at.revision}\n ORDER BY revision LIMIT ${input.limit + 1}`\n const decoded = yield* Effect.forEach(rows, (row) => Read.decode(ChangeRow, row))\n const changes = decoded.slice(0, input.limit).map((row) => ({\n runId: row.run_id,\n source: at.source,\n revision: row.revision,\n deleted: row.deleted === 1\n }))\n const hasMore = decoded.length > input.limit\n return {\n ...at,\n changes,\n hasMore,\n nextRevision: hasMore ? changes[changes.length - 1]!.revision : at.revision\n }\n })\n )\n })\n )\n }\n })\n/**\n * Provides the SQL feed.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layer: Layer.Layer<RunChangeFeed, never, SqlClient.SqlClient> = Layer.effect(RunChangeFeed)(make())\n"]}
|
|
@@ -24,7 +24,7 @@ import * as Context from "effect/Context";
|
|
|
24
24
|
import * as Effect from "effect/Effect";
|
|
25
25
|
import * as Layer from "effect/Layer";
|
|
26
26
|
import * as Schema from "effect/Schema";
|
|
27
|
-
import * as SqlClient from "effect/
|
|
27
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
28
28
|
import * as Selection from "./Selection.ts";
|
|
29
29
|
/**
|
|
30
30
|
* Training outcomes for a suspected edge: a `hit` is a recertified deferral
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionStore.d.ts","sourceRoot":"","sources":["../../src/SelectionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAE9D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM
|
|
1
|
+
{"version":3,"file":"SelectionStore.d.ts","sourceRoot":"","sources":["../../src/SelectionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAE9D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,2CAAmC,CAAA;AAE/D;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAA;AAEzD;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB;;;;EAI9B,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC,IAAI,CAA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* as Effect from "effect/Effect";
|
|
26
26
|
import * as Layer from "effect/Layer";
|
|
27
27
|
import * as Schema from "effect/Schema";
|
|
28
|
-
import * as SqlClient from "effect/
|
|
28
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
29
29
|
import * as Selection from "./Selection.js";
|
|
30
30
|
/**
|
|
31
31
|
* Training outcomes for a suspected edge: a `hit` is a recertified deferral
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionStore.js","sourceRoot":"","sources":["../../src/SelectionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAA;AAC1D,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;AAU/D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAC,cAAc;IAC5B,OAAO,EAAE,MAAM,CAAC,cAAc;IAC9B,OAAO,EAAE,eAAe;CACzB,CAAC,CAAA;AAUF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,QAAQ,CAAC;IACrD,eAAe;IACf,eAAe;IACf,oBAAoB;CACrB,CAAC,CAAA;AAUF;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,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["/**\n * Durable suspected-edge storage for probabilistic selection.\n *\n * The store persists advisory beliefs only: training moves edge confidence and\n * appends evidence, but it never writes scheduler journal records, step keys,\n * or cache rows (law 5). The edge and snapshot schemas are `Selection`'s own —\n * one source of truth, so a stored edge is by construction what\n * `Selection.select` consumes. Evidence entries stay strings: training appends\n * the observation JSON-encoded, so audits can replay the asymmetric rule\n * without the schema forking from `Selection.SuspectedEdge`.\n *\n * Model-backed selection, CLI verbs, approval routing, auto-appending\n * proposals, and scheduled recertification cadence are deliberately out of\n * scope here: `engine-store` must not grow a model dependency, no selection\n * CLI verbs are exposed yet, approval routing belongs to\n * `@smthrs/control`, proposal admission still needs human product review, and\n * cadence belongs to a system-flow/product layer rather than the primitive\n * store.\n *\n * @since 0.1.0\n */\n\nimport { DurableWriter } from \"@smthrs/database/DurableWriter\"\nimport * as Clock from \"effect/Clock\"\nimport * as Context from \"effect/Context\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as Schema from \"effect/Schema\"\nimport * as SqlClient from \"effect/unstable/sql/SqlClient\"\nimport * as Selection from \"./Selection.ts\"\n\n/**\n * Training outcomes for a suspected edge: a `hit` is a recertified deferral\n * that passed, a `miss` is one that failed — the guess was confidently wrong.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const TrainingOutcome = Schema.Literals([\"hit\", \"miss\"])\n\n/**\n * Training outcomes for a suspected edge.\n *\n * @category models\n * @since 0.1.0\n */\nexport type TrainingOutcome = typeof TrainingOutcome.Type\n\n/**\n * One observed result for a stored suspected edge.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const TrainingObservation = Schema.Struct({\n scope: Schema.NonEmptyString,\n affects: Schema.NonEmptyString,\n outcome: TrainingOutcome\n})\n\n/**\n * One observed result for a stored suspected edge.\n *\n * @category models\n * @since 0.1.0\n */\nexport type TrainingObservation = typeof TrainingObservation.Type\n\n/**\n * Stable selection-store failure codes.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const SelectionStoreErrorCode = Schema.Literals([\n \"invalid_input\",\n \"decode_failed\",\n \"persistence_failed\"\n])\n\n/**\n * Stable selection-store failure codes.\n *\n * @category models\n * @since 1.0.0\n */\nexport type SelectionStoreErrorCode = typeof SelectionStoreErrorCode.Type\n\n/**\n * A rejected public value, corrupt stored row, or unavailable database.\n *\n * @category errors\n * @since 1.0.0\n */\nexport class SelectionStoreError extends Schema.TaggedError<SelectionStoreError>()(\n \"@smthrs/engine-store/SelectionStoreError\",\n {\n code: SelectionStoreErrorCode,\n message: Schema.String,\n scope: Schema.optional(Schema.String),\n affects: Schema.optional(Schema.String),\n cause: Schema.optional(Schema.Unknown)\n }\n) {}\n\n/**\n * Durable suspected-edge persistence operations. `snapshot` pins the injected\n * clock's now, never `Date.now()`; `train` applies the asymmetric rule — a\n * hit gains five percent of the remaining headroom, a miss halves — to\n * matching stored edges only, ignoring unknown pairs rather than creating\n * them. Training retains at most {@link maxEvidenceEntries} newest evidence\n * entries per edge.\n *\n * @category models\n * @since 0.1.0\n */\nexport interface Service {\n readonly upsert: (\n edges: ReadonlyArray<Selection.SuspectedEdge>\n ) => Effect.Effect<void, SelectionStoreError>\n readonly list: () => Effect.Effect<ReadonlyArray<Selection.SuspectedEdge>, SelectionStoreError>\n readonly snapshot: () => Effect.Effect<Selection.BeliefSnapshot, SelectionStoreError>\n readonly train: (\n observations: ReadonlyArray<TrainingObservation>\n ) => Effect.Effect<void, SelectionStoreError>\n}\n\n/**\n * Service tag for the durable suspected-edge store.\n *\n * @category services\n * @since 0.1.0\n */\nexport class SelectionStore extends Context.Service<SelectionStore, Service>()(\n \"@smthrs/engine-store/SelectionStore\"\n) {}\n\nconst EvidenceListFromJsonString = Schema.fromJsonString(Schema.Array(Schema.String))\n\nconst EdgeRow = Schema.Struct({\n scope: Schema.NonEmptyString,\n affects: Schema.NonEmptyString,\n confidence: Schema.Number,\n validFromMs: Selection.NonNegativeSafeInt,\n evidenceJson: Schema.String\n})\n\ntype EdgeRow = typeof EdgeRow.Type\n\nconst invalidInput = (message: string, cause: unknown): SelectionStoreError =>\n new SelectionStoreError({ code: \"invalid_input\", message, cause })\n\nconst persistenceFailed = (message: string, cause: unknown): SelectionStoreError =>\n cause instanceof SelectionStoreError\n ? cause\n : new SelectionStoreError({ code: \"persistence_failed\", message, cause })\n\nconst decodeObservation = (input: unknown): Effect.Effect<TrainingObservation, SelectionStoreError> =>\n Schema.decodeUnknownEffect(TrainingObservation)(input).pipe(\n Effect.mapError((cause) => invalidInput(\"a training observation is invalid\", cause))\n )\n\nconst decodeEdge = (input: unknown): Effect.Effect<Selection.SuspectedEdge, SelectionStoreError> =>\n Schema.decodeUnknownEffect(Selection.SuspectedEdge)(input).pipe(\n Effect.mapError((cause) => invalidInput(\"a suspected edge is invalid\", cause))\n )\n\n// `decodeEdge` has already copied and validated this as an array of strings.\n// JSON encoding that closed value cannot fail, so retaining a fictitious\n// schema-error branch here only obscures the actual persistence failures.\nconst encodeEvidence = (evidence: ReadonlyArray<string>): Effect.Effect<string> =>\n Effect.succeed(JSON.stringify(evidence))\n\nconst decodeEvidence = (\n evidenceJson: string,\n row: Pick<EdgeRow, \"scope\" | \"affects\">\n): Effect.Effect<ReadonlyArray<string>, SelectionStoreError> =>\n Schema.decodeUnknownEffect(EvidenceListFromJsonString)(evidenceJson).pipe(\n Effect.mapError((cause) =>\n new SelectionStoreError({\n code: \"decode_failed\",\n message: `stored edge ${row.scope} -> ${row.affects} has invalid evidence`,\n scope: row.scope,\n affects: row.affects,\n cause\n })\n )\n )\n\nconst decodeRow = (input: unknown): Effect.Effect<Selection.SuspectedEdge, SelectionStoreError> =>\n Schema.decodeUnknownEffect(EdgeRow)(input).pipe(\n Effect.mapError((cause) =>\n new SelectionStoreError({\n code: \"decode_failed\",\n message: \"a stored selection edge row is invalid\",\n cause\n })\n ),\n Effect.flatMap((row) =>\n decodeEvidence(row.evidenceJson, row).pipe(\n Effect.flatMap((evidence) =>\n Schema.decodeUnknownEffect(Selection.SuspectedEdge)({\n scope: row.scope,\n affects: row.affects,\n confidence: row.confidence,\n validFromMs: row.validFromMs,\n evidence\n }).pipe(Effect.mapError((cause) =>\n new SelectionStoreError({\n code: \"decode_failed\",\n message: `stored edge ${row.scope} -> ${row.affects} is invalid`,\n scope: row.scope,\n affects: row.affects,\n cause\n })\n ))\n )\n )\n )\n )\n\nconst trainConfidence = (confidence: number, outcome: TrainingOutcome): number =>\n outcome === \"hit\"\n ? confidence + 0.05 * (1 - confidence)\n : confidence * 0.5\n\n/**\n * Maximum evidence entries retained for one suspected edge. Training drops\n * the oldest entries after this bound and preserves the newest entries in\n * observation order.\n *\n * @category constants\n * @since 1.0.0\n */\nexport const maxEvidenceEntries = 128\n\n/**\n * Builds the SQL-backed suspected-edge store.\n *\n * @category constructors\n * @since 0.1.0\n */\nexport const make: Effect.Effect<Service, never, DurableWriter | SqlClient.SqlClient> = Effect.gen(function*() {\n const sql = yield* SqlClient.SqlClient\n const writer = yield* DurableWriter\n\n const selectEdge = (observation: TrainingObservation) =>\n sql<EdgeRow>`\n SELECT\n scope,\n affects,\n confidence,\n valid_from_ms AS \"validFromMs\",\n evidence_json AS \"evidenceJson\"\n FROM flows_selection_suspected_edges\n WHERE scope = ${observation.scope}\n AND affects = ${observation.affects}\n `\n\n const writeEdge = (edge: Selection.SuspectedEdge): Effect.Effect<void, SelectionStoreError> =>\n Effect.gen(function*() {\n const evidenceJson = yield* encodeEvidence(edge.evidence)\n yield* sql`\n INSERT INTO flows_selection_suspected_edges (\n scope, affects, confidence, valid_from_ms, evidence_json\n ) VALUES (\n ${edge.scope}, ${edge.affects}, ${edge.confidence}, ${edge.validFromMs}, ${evidenceJson}\n ) ON CONFLICT (scope, affects) DO UPDATE SET\n confidence = excluded.confidence,\n valid_from_ms = excluded.valid_from_ms,\n evidence_json = excluded.evidence_json\n `.pipe(Effect.mapError((cause) =>\n persistenceFailed(\n `could not persist edge ${edge.scope} -> ${edge.affects}`,\n cause\n )\n ))\n })\n\n const upsert: Service[\"upsert\"] = Effect.fn(\"SelectionStore.upsert\")((edges) =>\n Effect.gen(function*() {\n const decoded = yield* Effect.forEach(edges, decodeEdge)\n yield* writer.write(Effect.forEach(decoded, writeEdge, { discard: true })).pipe(\n Effect.mapError((cause) => persistenceFailed(\"could not persist suspected edges\", cause))\n )\n })\n )\n\n const list: Service[\"list\"] = Effect.fn(\"SelectionStore.list\")(() =>\n Effect.gen(function*() {\n const rows = yield* sql<EdgeRow>`\n SELECT\n scope,\n affects,\n confidence,\n valid_from_ms AS \"validFromMs\",\n evidence_json AS \"evidenceJson\"\n FROM flows_selection_suspected_edges\n ORDER BY scope, affects\n `.pipe(Effect.mapError((cause) => persistenceFailed(\"could not list suspected edges\", cause)))\n return yield* Effect.forEach(rows, decodeRow)\n })\n )\n\n const snapshot: Service[\"snapshot\"] = Effect.fn(\"SelectionStore.snapshot\")(() =>\n Effect.gen(function*() {\n const pinnedAtMs = yield* Clock.currentTimeMillis.pipe(Effect.map(Math.floor))\n const edges = yield* list()\n return { pinnedAtMs, edges }\n })\n )\n\n const train: Service[\"train\"] = Effect.fn(\"SelectionStore.train\")((observations) =>\n Effect.gen(function*() {\n const decoded = yield* Effect.forEach(observations, decodeObservation)\n yield* writer.write(Effect.forEach(\n decoded,\n (observation) =>\n Effect.gen(function*() {\n const rows = yield* selectEdge(observation).pipe(\n Effect.mapError((cause) =>\n persistenceFailed(\n `could not read edge ${observation.scope} -> ${observation.affects}`,\n cause\n )\n )\n )\n const row = rows[0]\n if (row === undefined) return\n const edge = yield* decodeRow(row)\n yield* writeEdge({\n ...edge,\n confidence: trainConfidence(edge.confidence, observation.outcome),\n evidence: [...edge.evidence, JSON.stringify(observation)].slice(-maxEvidenceEntries)\n })\n }),\n { discard: true }\n )).pipe(Effect.mapError((cause) => persistenceFailed(\"could not train suspected edges\", cause)))\n })\n )\n\n return { upsert, list, snapshot, train }\n})\n\n/**\n * Provides the SQL-backed suspected-edge store.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layer: Layer.Layer<SelectionStore, never, DurableWriter | SqlClient.SqlClient> = Layer.effect(\n SelectionStore\n)(make)\n"]}
|
|
1
|
+
{"version":3,"file":"SelectionStore.js","sourceRoot":"","sources":["../../src/SelectionStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAA;AAC9D,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAA;AACjD,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAA;AAE3C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAA;AAU/D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IAC/C,KAAK,EAAE,MAAM,CAAC,cAAc;IAC5B,OAAO,EAAE,MAAM,CAAC,cAAc;IAC9B,OAAO,EAAE,eAAe;CACzB,CAAC,CAAA;AAUF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,QAAQ,CAAC;IACrD,eAAe;IACf,eAAe;IACf,oBAAoB;CACrB,CAAC,CAAA;AAUF;;;;;GAKG;AACH,MAAM,OAAO,mBAAoB,SAAQ,MAAM,CAAC,WAAW,EAAuB,CAChF,0CAA0C,EAC1C;IACE,IAAI,EAAE,uBAAuB;IAC7B,OAAO,EAAE,MAAM,CAAC,MAAM;IACtB,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC;IACrC,OAA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C,CAAC,KAAK,EAAE,EAAE,CACxB,iBAAiB,CACf,uBAAuB,WAAW,CAAC,KAAK,OAAO,WAAW,CAAC,OAAO,EAAE,EACpE,KAAK,CACN,CACF,CACF,CAAA;YACD,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;YACnB,IAAI,GAAG,KAAK,SAAS;gBAAE,OAAM;YAC7B,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAA;YAClC,KAAK,CAAC,CAAC,SAAS,CAAC;gBACf,GAAG,IAAI;gBACP,UAAU,EAAE,eAAe,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC;gBACjE,QAAQ,EAAE,CAAC,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC;aACrF,CAAC,CAAA;QACJ,CAAC,CAAC,EACJ,EAAE,OAAO,EAAE,IAAI,EAAE,CAClB,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,iBAAiB,CAAC,iCAAiC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAA;IAClG,CAAC,CAAC,CACH,CAAA;IAED,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAA;AAC1C,CAAC,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAA4E,KAAK,CAAC,MAAM,CACxG,cAAc,CACf,CAAC,IAAI,CAAC,CAAA","sourcesContent":["/**\n * Durable suspected-edge storage for probabilistic selection.\n *\n * The store persists advisory beliefs only: training moves edge confidence and\n * appends evidence, but it never writes scheduler journal records, step keys,\n * or cache rows (law 5). The edge and snapshot schemas are `Selection`'s own —\n * one source of truth, so a stored edge is by construction what\n * `Selection.select` consumes. Evidence entries stay strings: training appends\n * the observation JSON-encoded, so audits can replay the asymmetric rule\n * without the schema forking from `Selection.SuspectedEdge`.\n *\n * Model-backed selection, CLI verbs, approval routing, auto-appending\n * proposals, and scheduled recertification cadence are deliberately out of\n * scope here: `engine-store` must not grow a model dependency, no selection\n * CLI verbs are exposed yet, approval routing belongs to\n * `@smthrs/control`, proposal admission still needs human product review, and\n * cadence belongs to a system-flow/product layer rather than the primitive\n * store.\n *\n * @since 0.1.0\n */\n\nimport { DurableWriter } from \"@smthrs/database/DurableWriter\"\nimport * as Clock from \"effect/Clock\"\nimport * as Context from \"effect/Context\"\nimport * as Effect from \"effect/Effect\"\nimport * as Layer from \"effect/Layer\"\nimport * as Schema from \"effect/Schema\"\nimport * as SqlClient from \"effect/sql/SqlClient\"\nimport * as Selection from \"./Selection.ts\"\n\n/**\n * Training outcomes for a suspected edge: a `hit` is a recertified deferral\n * that passed, a `miss` is one that failed — the guess was confidently wrong.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const TrainingOutcome = Schema.Literals([\"hit\", \"miss\"])\n\n/**\n * Training outcomes for a suspected edge.\n *\n * @category models\n * @since 0.1.0\n */\nexport type TrainingOutcome = typeof TrainingOutcome.Type\n\n/**\n * One observed result for a stored suspected edge.\n *\n * @category schemas\n * @since 0.1.0\n */\nexport const TrainingObservation = Schema.Struct({\n scope: Schema.NonEmptyString,\n affects: Schema.NonEmptyString,\n outcome: TrainingOutcome\n})\n\n/**\n * One observed result for a stored suspected edge.\n *\n * @category models\n * @since 0.1.0\n */\nexport type TrainingObservation = typeof TrainingObservation.Type\n\n/**\n * Stable selection-store failure codes.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const SelectionStoreErrorCode = Schema.Literals([\n \"invalid_input\",\n \"decode_failed\",\n \"persistence_failed\"\n])\n\n/**\n * Stable selection-store failure codes.\n *\n * @category models\n * @since 1.0.0\n */\nexport type SelectionStoreErrorCode = typeof SelectionStoreErrorCode.Type\n\n/**\n * A rejected public value, corrupt stored row, or unavailable database.\n *\n * @category errors\n * @since 1.0.0\n */\nexport class SelectionStoreError extends Schema.TaggedError<SelectionStoreError>()(\n \"@smthrs/engine-store/SelectionStoreError\",\n {\n code: SelectionStoreErrorCode,\n message: Schema.String,\n scope: Schema.optional(Schema.String),\n affects: Schema.optional(Schema.String),\n cause: Schema.optional(Schema.Unknown)\n }\n) {}\n\n/**\n * Durable suspected-edge persistence operations. `snapshot` pins the injected\n * clock's now, never `Date.now()`; `train` applies the asymmetric rule — a\n * hit gains five percent of the remaining headroom, a miss halves — to\n * matching stored edges only, ignoring unknown pairs rather than creating\n * them. Training retains at most {@link maxEvidenceEntries} newest evidence\n * entries per edge.\n *\n * @category models\n * @since 0.1.0\n */\nexport interface Service {\n readonly upsert: (\n edges: ReadonlyArray<Selection.SuspectedEdge>\n ) => Effect.Effect<void, SelectionStoreError>\n readonly list: () => Effect.Effect<ReadonlyArray<Selection.SuspectedEdge>, SelectionStoreError>\n readonly snapshot: () => Effect.Effect<Selection.BeliefSnapshot, SelectionStoreError>\n readonly train: (\n observations: ReadonlyArray<TrainingObservation>\n ) => Effect.Effect<void, SelectionStoreError>\n}\n\n/**\n * Service tag for the durable suspected-edge store.\n *\n * @category services\n * @since 0.1.0\n */\nexport class SelectionStore extends Context.Service<SelectionStore, Service>()(\n \"@smthrs/engine-store/SelectionStore\"\n) {}\n\nconst EvidenceListFromJsonString = Schema.fromJsonString(Schema.Array(Schema.String))\n\nconst EdgeRow = Schema.Struct({\n scope: Schema.NonEmptyString,\n affects: Schema.NonEmptyString,\n confidence: Schema.Number,\n validFromMs: Selection.NonNegativeSafeInt,\n evidenceJson: Schema.String\n})\n\ntype EdgeRow = typeof EdgeRow.Type\n\nconst invalidInput = (message: string, cause: unknown): SelectionStoreError =>\n new SelectionStoreError({ code: \"invalid_input\", message, cause })\n\nconst persistenceFailed = (message: string, cause: unknown): SelectionStoreError =>\n cause instanceof SelectionStoreError\n ? cause\n : new SelectionStoreError({ code: \"persistence_failed\", message, cause })\n\nconst decodeObservation = (input: unknown): Effect.Effect<TrainingObservation, SelectionStoreError> =>\n Schema.decodeUnknownEffect(TrainingObservation)(input).pipe(\n Effect.mapError((cause) => invalidInput(\"a training observation is invalid\", cause))\n )\n\nconst decodeEdge = (input: unknown): Effect.Effect<Selection.SuspectedEdge, SelectionStoreError> =>\n Schema.decodeUnknownEffect(Selection.SuspectedEdge)(input).pipe(\n Effect.mapError((cause) => invalidInput(\"a suspected edge is invalid\", cause))\n )\n\n// `decodeEdge` has already copied and validated this as an array of strings.\n// JSON encoding that closed value cannot fail, so retaining a fictitious\n// schema-error branch here only obscures the actual persistence failures.\nconst encodeEvidence = (evidence: ReadonlyArray<string>): Effect.Effect<string> =>\n Effect.succeed(JSON.stringify(evidence))\n\nconst decodeEvidence = (\n evidenceJson: string,\n row: Pick<EdgeRow, \"scope\" | \"affects\">\n): Effect.Effect<ReadonlyArray<string>, SelectionStoreError> =>\n Schema.decodeUnknownEffect(EvidenceListFromJsonString)(evidenceJson).pipe(\n Effect.mapError((cause) =>\n new SelectionStoreError({\n code: \"decode_failed\",\n message: `stored edge ${row.scope} -> ${row.affects} has invalid evidence`,\n scope: row.scope,\n affects: row.affects,\n cause\n })\n )\n )\n\nconst decodeRow = (input: unknown): Effect.Effect<Selection.SuspectedEdge, SelectionStoreError> =>\n Schema.decodeUnknownEffect(EdgeRow)(input).pipe(\n Effect.mapError((cause) =>\n new SelectionStoreError({\n code: \"decode_failed\",\n message: \"a stored selection edge row is invalid\",\n cause\n })\n ),\n Effect.flatMap((row) =>\n decodeEvidence(row.evidenceJson, row).pipe(\n Effect.flatMap((evidence) =>\n Schema.decodeUnknownEffect(Selection.SuspectedEdge)({\n scope: row.scope,\n affects: row.affects,\n confidence: row.confidence,\n validFromMs: row.validFromMs,\n evidence\n }).pipe(Effect.mapError((cause) =>\n new SelectionStoreError({\n code: \"decode_failed\",\n message: `stored edge ${row.scope} -> ${row.affects} is invalid`,\n scope: row.scope,\n affects: row.affects,\n cause\n })\n ))\n )\n )\n )\n )\n\nconst trainConfidence = (confidence: number, outcome: TrainingOutcome): number =>\n outcome === \"hit\"\n ? confidence + 0.05 * (1 - confidence)\n : confidence * 0.5\n\n/**\n * Maximum evidence entries retained for one suspected edge. Training drops\n * the oldest entries after this bound and preserves the newest entries in\n * observation order.\n *\n * @category constants\n * @since 1.0.0\n */\nexport const maxEvidenceEntries = 128\n\n/**\n * Builds the SQL-backed suspected-edge store.\n *\n * @category constructors\n * @since 0.1.0\n */\nexport const make: Effect.Effect<Service, never, DurableWriter | SqlClient.SqlClient> = Effect.gen(function*() {\n const sql = yield* SqlClient.SqlClient\n const writer = yield* DurableWriter\n\n const selectEdge = (observation: TrainingObservation) =>\n sql<EdgeRow>`\n SELECT\n scope,\n affects,\n confidence,\n valid_from_ms AS \"validFromMs\",\n evidence_json AS \"evidenceJson\"\n FROM flows_selection_suspected_edges\n WHERE scope = ${observation.scope}\n AND affects = ${observation.affects}\n `\n\n const writeEdge = (edge: Selection.SuspectedEdge): Effect.Effect<void, SelectionStoreError> =>\n Effect.gen(function*() {\n const evidenceJson = yield* encodeEvidence(edge.evidence)\n yield* sql`\n INSERT INTO flows_selection_suspected_edges (\n scope, affects, confidence, valid_from_ms, evidence_json\n ) VALUES (\n ${edge.scope}, ${edge.affects}, ${edge.confidence}, ${edge.validFromMs}, ${evidenceJson}\n ) ON CONFLICT (scope, affects) DO UPDATE SET\n confidence = excluded.confidence,\n valid_from_ms = excluded.valid_from_ms,\n evidence_json = excluded.evidence_json\n `.pipe(Effect.mapError((cause) =>\n persistenceFailed(\n `could not persist edge ${edge.scope} -> ${edge.affects}`,\n cause\n )\n ))\n })\n\n const upsert: Service[\"upsert\"] = Effect.fn(\"SelectionStore.upsert\")((edges) =>\n Effect.gen(function*() {\n const decoded = yield* Effect.forEach(edges, decodeEdge)\n yield* writer.write(Effect.forEach(decoded, writeEdge, { discard: true })).pipe(\n Effect.mapError((cause) => persistenceFailed(\"could not persist suspected edges\", cause))\n )\n })\n )\n\n const list: Service[\"list\"] = Effect.fn(\"SelectionStore.list\")(() =>\n Effect.gen(function*() {\n const rows = yield* sql<EdgeRow>`\n SELECT\n scope,\n affects,\n confidence,\n valid_from_ms AS \"validFromMs\",\n evidence_json AS \"evidenceJson\"\n FROM flows_selection_suspected_edges\n ORDER BY scope, affects\n `.pipe(Effect.mapError((cause) => persistenceFailed(\"could not list suspected edges\", cause)))\n return yield* Effect.forEach(rows, decodeRow)\n })\n )\n\n const snapshot: Service[\"snapshot\"] = Effect.fn(\"SelectionStore.snapshot\")(() =>\n Effect.gen(function*() {\n const pinnedAtMs = yield* Clock.currentTimeMillis.pipe(Effect.map(Math.floor))\n const edges = yield* list()\n return { pinnedAtMs, edges }\n })\n )\n\n const train: Service[\"train\"] = Effect.fn(\"SelectionStore.train\")((observations) =>\n Effect.gen(function*() {\n const decoded = yield* Effect.forEach(observations, decodeObservation)\n yield* writer.write(Effect.forEach(\n decoded,\n (observation) =>\n Effect.gen(function*() {\n const rows = yield* selectEdge(observation).pipe(\n Effect.mapError((cause) =>\n persistenceFailed(\n `could not read edge ${observation.scope} -> ${observation.affects}`,\n cause\n )\n )\n )\n const row = rows[0]\n if (row === undefined) return\n const edge = yield* decodeRow(row)\n yield* writeEdge({\n ...edge,\n confidence: trainConfidence(edge.confidence, observation.outcome),\n evidence: [...edge.evidence, JSON.stringify(observation)].slice(-maxEvidenceEntries)\n })\n }),\n { discard: true }\n )).pipe(Effect.mapError((cause) => persistenceFailed(\"could not train suspected edges\", cause)))\n })\n )\n\n return { upsert, list, snapshot, train }\n})\n\n/**\n * Provides the SQL-backed suspected-edge store.\n *\n * @category layers\n * @since 0.1.0\n */\nexport const layer: Layer.Layer<SelectionStore, never, DurableWriter | SqlClient.SqlClient> = Layer.effect(\n SelectionStore\n)(make)\n"]}
|
package/dist/esm/StepBoundary.js
CHANGED
|
@@ -14,7 +14,7 @@ import { DerivedKey } from "@smthrs/keys";
|
|
|
14
14
|
import * as FileSet from "@smthrs/plan/FileSet";
|
|
15
15
|
import * as Context from "effect/Context";
|
|
16
16
|
import * as Effect from "effect/Effect";
|
|
17
|
-
import * as
|
|
17
|
+
import * as Base64 from "effect/encoding/Base64";
|
|
18
18
|
import * as FileSystem from "effect/FileSystem";
|
|
19
19
|
import * as Layer from "effect/Layer";
|
|
20
20
|
import * as Path from "effect/Path";
|
|
@@ -505,7 +505,7 @@ export const makeFileSystem = (fs, platformPath, artifacts, options = {}) => {
|
|
|
505
505
|
path,
|
|
506
506
|
digest,
|
|
507
507
|
sizeBytes: bytes.length,
|
|
508
|
-
content:
|
|
508
|
+
content: Base64.encode(bytes)
|
|
509
509
|
},
|
|
510
510
|
inlinedBytes: bytes.length
|
|
511
511
|
};
|
|
@@ -537,7 +537,7 @@ export const makeFileSystem = (fs, platformPath, artifacts, options = {}) => {
|
|
|
537
537
|
return;
|
|
538
538
|
let bytes;
|
|
539
539
|
if (output.content !== undefined) {
|
|
540
|
-
const decoded =
|
|
540
|
+
const decoded = Base64.decode(output.content);
|
|
541
541
|
if (Result.isFailure(decoded)) {
|
|
542
542
|
// Inline content is cache-origin bytes: an undecodable payload is a
|
|
543
543
|
// tampered durable row, classified exactly like a digest mismatch so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StepBoundary.js","sourceRoot":"","sources":["../../src/StepBoundary.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,aAAa,MAAM,iCAAiC,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,KAAK,OAAO,MAAM,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ic step boundary contracts, the filesystem-backed production\n * implementation, and the deterministic test implementation.\n *\n * @since 0.1.0\n */\n\nimport * as ArtifactStore from \"@smthrs/artifacts/ArtifactStore\"\nimport { Sha256 } from \"@smthrs/crypto\"\nimport { FileBoundary } from \"@smthrs/flow/FileBoundary\"\nimport { FileInput } from \"@smthrs/flow/FileInput\"\nimport * as KernelFileSystem from \"@smthrs/kernel/FileSystem\"\nimport { Workspace as KernelWorkspace } from \"@smthrs/kernel/Workspace\"\nimport { DerivedKey } from \"@smthrs/keys\"\nimport * as FileSet from \"@smthrs/plan/FileSet\"\nimport * as Context from \"effect/Context\"\nimport type * as Crypto from \"effect/Crypto\"\nimport * as Effect from \"effect/Effect\"\nimport * as Encoding from \"effect/Encoding\"\nimport * as FileSystem from \"effect/FileSystem\"\nimport * as Layer from \"effect/Layer\"\nimport * as Path from \"effect/Path\"\nimport * as Result from \"effect/Result\"\nimport * as Schema from \"effect/Schema\"\nimport * as FileBoundarySnapshot from \"./internal/FileBoundarySnapshot.ts\"\nimport * as FileEnumeration from \"./internal/FileEnumeration.ts\"\nimport { compareText } from \"./internal/Ordering.ts\"\n\n/**\n * A file boundary that has been measured but not yet run: the caller's\n * declaration, paired with what the host actually found on disk for it.\n *\n * `prepare` produces one of these before a step executes and `settle` consumes\n * it afterwards, which is what lets the boundary say whether the world moved\n * underneath the declaration. Check it with {@link readSetMatches}.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const PreparedBoundary = Schema.Struct({\n descriptor: FileBoundary,\n /**\n * What the host actually measured for the declared read set at prepare\n * time. The declared digests are caller metadata folded into the step key;\n * this is the evidence that they still describe reality, and a sealed\n * cache hit is refused when the two disagree (issue #90).\n */\n readSnapshot: Schema.Array(FileInput)\n})\n\n/**\n * The value form of {@link PreparedBoundary}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type PreparedBoundary = typeof PreparedBoundary.Type\n\n/**\n * Exact read inputs from a boundary after ignoring declarations that still need expansion.\n *\n * @category accessors\n * @since 0.1.0\n */\nexport const exactReads = (descriptor: FileBoundary): ReadonlyArray<FileInput> =>\n descriptor.readSet.filter((entry): entry is FileInput => !FileSet.isGlob(entry))\n\n/**\n * Whether every declared read still matches what the host measured.\n *\n * Reads the host reports but the declaration never claimed are ignored: the\n * declaration is the dependency edge set, and an incidental extra read is not\n * one of its edges. A declared path missing from the measurement counts as a\n * mismatch — its value is unknown, so reuse cannot be justified.\n *\n * @since 0.1.0\n * @category predicates\n */\nexport const readSetMatches = (prepared: PreparedBoundary): boolean => {\n const digestsByPath = new Map<string, Set<string>>()\n for (const measured of prepared.readSnapshot) {\n const digests = digestsByPath.get(measured.path)\n if (digests === undefined) digestsByPath.set(measured.path, new Set([measured.digest]))\n else digests.add(measured.digest)\n }\n return prepared.descriptor.readSet.every((entry) =>\n !FileSet.isGlob(entry) &&\n digestsByPath.get(entry.path)?.has(entry.digest) === true\n )\n}\n\n/**\n * The paths a step wrote that its `expected` write set did not name, together\n * with the diff identity they were observed under.\n *\n * An expected-mode boundary reports these rather than failing: the declaration\n * is a prediction, and a wrong prediction is evidence to journal, not an\n * error. A hard-mode boundary raises {@link UndeclaredWrite} for the same\n * observation.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const ExpectedSetDeviation = Schema.TaggedStruct(\"ExpectedSetDeviation\", {\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n})\n\n/**\n * Declared writes an expected-mode step did not produce, and did not declare\n * as removals.\n *\n * The absence itself is the defect: recording it as valid evidence caches the\n * claim \"this file should not exist\", which `replayOutputs` then acts on by\n * deleting the path on a workspace that never ran the step. A hard-mode\n * boundary raises {@link MissingDeclaredOutput} for the same observation.\n *\n * Expected mode records it rather than failing because the declaration there is\n * a prediction — and because a deviation of any variant already bars the\n * evidence from the shared cache (`ActionPersistence` gates `recordCache` on\n * `deviation === undefined`), so an unexplained absence never reaches another\n * host either way.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const MissingOutputDeviation = Schema.TaggedStruct(\"MissingDeclaredOutput\", {\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n})\n\n/**\n * Declared removals an expected-mode step left in place.\n *\n * The dual of {@link MissingOutputDeviation}: a removal is a promise about the\n * post-state exactly as a write is. A path that was promised absent but is\n * still present — possibly mutated — must not settle as valid evidence, or\n * the mutation is cached under a declaration that disclaimed it and replay\n * materializes it everywhere. A hard-mode boundary raises\n * {@link SurvivingDeclaredRemoval} for the same observation.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const SurvivingRemovalDeviation = Schema.TaggedStruct(\"SurvivingDeclaredRemoval\", {\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n})\n\n/**\n * What a settled boundary observed that its declaration did not predict.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const BoundaryDeviation = Schema.Union([ExpectedSetDeviation, MissingOutputDeviation, SurvivingRemovalDeviation])\n\n/**\n * The value form of {@link BoundaryDeviation}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type BoundaryDeviation = typeof BoundaryDeviation.Type\n\n/**\n * What a settled boundary proved about a step's writes — the record the\n * journal keeps and a later cache hit is justified against.\n *\n * `diffIdentity` names the post-state the step produced; `declaredOutputs`\n * carries whatever the implementation needs to reproduce it on a workspace\n * that never ran the step. The two optional fields are the honest gaps:\n * `wholeTreeWritesVerified` is present only when the boundary could observe\n * the entire execution tree, and `deviation` only when it saw writes the\n * declaration did not predict.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const BoundaryEvidence = Schema.Struct({\n declaredOutputs: Schema.Unknown,\n diffIdentity: Schema.NonEmptyString,\n /**\n * The boundary observed the whole execution tree and proved that every\n * write was covered by the descriptor's write set. Only evidence carrying\n * this explicit proof may enter the cross-run cache. Older evidence and\n * boundaries that can inspect declared paths only omit it.\n */\n wholeTreeWritesVerified: Schema.optional(Schema.Literal(true)),\n /** The body could observe only declared filesystem inputs. */\n hermeticReadsVerified: Schema.optional(Schema.Literal(true)),\n deviation: Schema.optional(BoundaryDeviation)\n})\n\n/**\n * The value form of {@link BoundaryEvidence}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type BoundaryEvidence = typeof BoundaryEvidence.Type\n\n/**\n * A hard-mode step wrote outside its declared write set.\n *\n * Hard mode treats the declaration as a contract, so this is a refusal, not a\n * report: the step's evidence is never journaled and never becomes a cache\n * entry. An expected-mode boundary records the same observation as a\n * {@link BoundaryDeviation} instead.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class UndeclaredWrite extends Schema.TaggedError<UndeclaredWrite>()(\n \"@smthrs/engine-store/UndeclaredWrite\",\n {\n code: Schema.Literal(\"undeclared_write\"),\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n }\n) {}\n\n/**\n * A step finished without producing a path its write set declared, and did not\n * declare that path as a removal.\n *\n * Bazel hard-fails the same observation — `SkyframeActionExecutor.checkOutputs`\n * reports \"output was not created\" — and for the same reason: the alternative\n * is to record `digest: null` as valid evidence, which caches the claim \"this\n * file should not exist\" and makes every later replay delete the path. A step\n * that crashed after declaring its writes would poison the cache with an\n * eraser.\n *\n * Declaring the path in {@link FileBoundary}'s `removes` is how a deliberate\n * deletion says so, and it is the only thing that makes the absence legitimate.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class MissingDeclaredOutput extends Schema.TaggedError<MissingDeclaredOutput>()(\n \"@smthrs/engine-store/MissingDeclaredOutput\",\n {\n code: Schema.Literal(\"missing_declared_output\"),\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n }\n) {}\n\n/**\n * A hard-mode step left a declared removal in place.\n *\n * The dual of {@link MissingDeclaredOutput}: `removes` promises the path is\n * absent afterwards, and a path that survived — or was quietly rewritten —\n * is a post-state the declaration disclaimed. Settling it as evidence would\n * cache the surviving bytes under a removal and hand them to every replay.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class SurvivingDeclaredRemoval extends Schema.TaggedError<SurvivingDeclaredRemoval>()(\n \"@smthrs/engine-store/SurvivingDeclaredRemoval\",\n {\n code: Schema.Literal(\"surviving_declared_removal\"),\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n }\n) {}\n\n/**\n * The host could not honour the boundary at all — a filesystem that cannot be\n * measured, a path that cannot be read, a transient I/O failure.\n *\n * It is the catch-all host refusal, deliberately kept distinct from the two\n * refusals a caller can act on: {@link BoundaryCorruption} (the bytes changed\n * under a recorded digest) and {@link MissingArtifact} (the bytes might be\n * fetchable from a shared tier).\n *\n * @since 0.1.0\n * @category errors\n */\nexport class UnsupportedBoundary extends Schema.TaggedError<UnsupportedBoundary>()(\n \"@smthrs/engine-store/UnsupportedBoundary\",\n {\n code: Schema.Literal(\"unsupported_boundary\"),\n message: Schema.String,\n /**\n * The refusing host or artifact-store failure, carried whole rather than\n * flattened into the message (`PlatformError`'s own convention), so the\n * journal record and a live debugger both see the original error.\n */\n cause: Schema.optional(Schema.Defect())\n }\n) {}\n\n/**\n * Recorded boundary evidence whose bytes no longer match their recorded\n * digest — an integrity violation of the store's strongest invariant, as\n * opposed to a transient host failure (issue #150). The two classes were\n * previously conflated under one `UnsupportedBoundary` tag, so a failing\n * disk corrupting many blobs journalled identically to a one-off EIO.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class BoundaryCorruption extends Schema.TaggedError<BoundaryCorruption>()(\n \"@smthrs/engine-store/BoundaryCorruption\",\n {\n code: Schema.Literal(\"boundary_corruption\"),\n path: Schema.String,\n recordedDigest: Schema.String,\n measuredDigest: Schema.String\n }\n) {}\n\n/**\n * Recorded evidence references an artifact this host's store does not hold\n * (issue #172). Distinct from {@link UnsupportedBoundary} because it is the one\n * replay refusal a *shared artifact tier* can repair: the caller fetches the\n * blob from the remote store, writes it back locally, and retries the replay\n * once before falling through to a real execution. Every other host refusal\n * says nothing about where the bytes might be.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class MissingArtifact extends Schema.TaggedError<MissingArtifact>()(\n \"@smthrs/engine-store/MissingArtifact\",\n {\n code: Schema.Literal(\"missing_artifact\"),\n path: Schema.String,\n digest: Schema.String\n }\n) {}\n\n/**\n * The three-call lifecycle of a hermetic step boundary.\n *\n * `prepare` measures the declared read set before the step runs; `settle`\n * measures the writes afterwards and turns them into {@link BoundaryEvidence};\n * `replayOutputs` reproduces a previous step's outputs from that evidence, so\n * a cache hit can materialize results on a workspace that never executed\n * anything.\n *\n * @since 0.1.0\n * @category services\n */\nexport interface Service {\n readonly prepare: (\n descriptor: FileBoundary\n ) => Effect.Effect<PreparedBoundary, UnsupportedBoundary, Crypto.Crypto>\n readonly settle: (\n prepared: PreparedBoundary\n ) => Effect.Effect<\n BoundaryEvidence,\n UndeclaredWrite | MissingDeclaredOutput | SurvivingDeclaredRemoval | UnsupportedBoundary | BoundaryCorruption,\n Crypto.Crypto\n >\n readonly replayOutputs: (\n evidence: BoundaryEvidence\n ) => Effect.Effect<void, UnsupportedBoundary | BoundaryCorruption | MissingArtifact, Crypto.Crypto>\n}\n\n/**\n * The service key for a {@link Service}. Provide it with `layer` for\n * a real workspace or `layerTest` for a deterministic in-memory one.\n *\n * @since 0.1.0\n * @category services\n */\nexport const StepBoundary: Context.Service<Service, Service> = Context.Service<Service>(\n \"@smthrs/engine-store/StepBoundary\"\n)\n\n/**\n * Brands a {@link Service} implementation as a `StepBoundary`, so a new\n * boundary backend is type-checked where it is written rather than where it is\n * provided.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const make = (service: Service): Service => StepBoundary.of(service)\n\n/**\n * The digest a measurement reports for a declared path that does not exist.\n * Declared digests are hex SHA-256 strings, so the sentinel can never\n * collide with a real measurement — a declaration naming a vanished file\n * always mismatches and the cache hit is refused.\n */\nconst absentDigest = \"absent\"\n\n/**\n * The persisted shape of the production layer's `declaredOutputs`: the\n * declared write set's materialized post-state, so a cache-hit replay can\n * reproduce the outputs on a workspace that never ran the step.\n *\n * Outputs are recorded by content digest, never inlined unbounded\n * (issue #113): a `null` digest records that the path did not exist at\n * settle time; `content` (base64) is present only when the payload fits the\n * configured inline bound, otherwise the bytes live in the host's\n * content-addressed object directory under the digest and the row carries\n * only the reference. Temporal's blob-size limits are the prior art — the\n * evidence is persisted into every attempt row and cache entry.\n *\n * The digest is decoded against the store's strict address schema\n * (`ArtifactStore.Digest`), so a persisted row carrying a malformed address\n * fails the decode here instead of reaching the store or the sync RPCs.\n */\nconst DigestReferencedOutput = Schema.Struct({\n path: Schema.String,\n digest: Schema.NullOr(ArtifactStore.Digest),\n sizeBytes: Schema.optional(Schema.Number),\n content: Schema.optional(Schema.String)\n})\n\nconst MaterializedOutputs = Schema.Struct({\n outputs: Schema.Array(DigestReferencedOutput),\n trees: Schema.optional(Schema.Array(Schema.Struct({\n path: Schema.String,\n identity: Schema.String\n })))\n})\n\n/**\n * The directory portion of a slash-separated path, or `undefined` for a\n * bare filename (nothing to create). Boundary paths are workspace-relative\n * and slash-separated — the same normalization the kernel `FileSystem`\n * layer applies.\n */\nconst parentDirectory = (path: string): string | undefined => {\n const index = path.lastIndexOf(\"/\")\n return index <= 0 ? undefined : path.slice(0, index)\n}\n\nconst hostFailure = (cause: unknown): UnsupportedBoundary =>\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message: \"the host filesystem could not enforce the step boundary\",\n cause\n })\n\n/**\n * An artifact store that refused the operation outright — a failing disk, an\n * unreachable shared tier, an address that is not a content address. Unlike a\n * miss or a corruption it says nothing about the artifact, so it stays the\n * ordinary retryable host refusal the issue-#107 call sites already handle.\n */\nconst artifactFailure = (cause: ArtifactStore.ArtifactStoreError): UnsupportedBoundary =>\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message: `the artifact store could not serve the step boundary: ${cause.message}`,\n cause\n })\n\n/**\n * Corruption of an *inline* evidence payload (issue #159): the recorded\n * base64 no longer decodes, so there are no bytes to measure a digest of —\n * the `invalid_base64` sentinel records that the measurement itself was\n * impossible, which is still cache-origin corruption and never a transient\n * host refusal.\n */\nconst inlineCorruption = (path: string, recordedDigest: string): BoundaryCorruption =>\n new BoundaryCorruption({\n code: \"boundary_corruption\",\n path,\n recordedDigest,\n measuredDigest: \"invalid_base64\"\n })\n\n/**\n * The two size bounds that decide when a settled output is inlined into\n * boundary evidence and when it is spilled to the `ArtifactStore` by digest.\n *\n * Both default to values that keep an evidence row small enough to journal;\n * raise them only when the workspace's outputs are known to be small and the\n * extra artifact round-trip is measurably costing something.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface FileSystemOptions {\n /**\n * The largest output (in bytes) inlined into the boundary evidence\n * itself. Anything larger is handed to the `ArtifactStore` and recorded by\n * digest reference only (issue #113). Defaults to 1 MiB.\n */\n readonly maxInlineBytes?: number | undefined\n /**\n * The largest *aggregate* inline payload (in bytes) a single settle may\n * fold into its boundary evidence (issue #122). A per-output bound alone\n * still let a wide write set multiply many individually-small payloads\n * into an unbounded evidence row; once an output would push the running\n * total past this bound it is spilled to the `ArtifactStore` and\n * recorded by digest reference only, even though it individually fits\n * {@link maxInlineBytes}. Defaults to 8 MiB.\n */\n readonly maxTotalInlineBytes?: number | undefined\n /**\n * The workspace root cache replay confines its writes, removals, and prune\n * walk to. A filesystem already confined to a root (the kernel-guarded\n * layer's service, or a `confined` view) keeps its own root and ignores\n * this. Otherwise it defaults to the process working directory, the root a\n * path-based host resolves `prepare` and `settle` against. {@link layer}\n * passes the kernel `Workspace` root when one is in context.\n */\n readonly root?: string | undefined\n}\n\nconst defaultMaxInlineBytes = 1024 * 1024\nconst defaultMaxTotalInlineBytes = 8 * 1024 * 1024\ninterface MeasuredDigest {\n readonly digest: ArtifactStore.Digest\n readonly bytes: Uint8Array\n}\n\ninterface BatchedDigest {\n readonly digest: ArtifactStore.Digest\n readonly sizeBytes: number\n readonly bytes?: Uint8Array\n}\n\ntype MaterializedOutput = typeof DigestReferencedOutput.Type\n\n/**\n * The digests this evidence references rather than inlines — the set that must\n * be durable in a shared artifact tier before the evidence's cache entry\n * becomes observable there, and the set a replay on a fresh host has to fetch.\n *\n * Evidence recorded by a foreign boundary implementation references nothing\n * this store can name, so it yields the empty list rather than failing: the\n * caller's replay path already refuses such evidence with\n * {@link UnsupportedBoundary}.\n *\n * @since 0.1.0\n * @category accessors\n */\nexport const referencedDigests = (evidence: BoundaryEvidence): ReadonlyArray<ArtifactStore.Digest> => {\n const decoded = Schema.decodeUnknownResult(MaterializedOutputs)(evidence.declaredOutputs)\n if (decoded._tag === \"Failure\") return []\n const digests: Array<ArtifactStore.Digest> = []\n for (const output of decoded.success.outputs) {\n if (output.digest === null || output.content !== undefined) continue\n digests.push(output.digest)\n }\n return digests\n}\n\n/**\n * Builds the filesystem-backed boundary service.\n *\n * The blob mechanics — content addressing, atomic publication, digest\n * verification, dedupe — belong to `artifacts` and were extracted into\n * `@smthrs/artifacts` (`packages/smithers/flows/artifacts/docs/api.md`). What stays here\n * is the *policy* that decides which outputs become blobs at all: the\n * inline-versus-spill budgets are a property of how large an evidence row may\n * get, not of how bytes are stored.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const makeFileSystem = (\n fs: FileSystem.FileSystem,\n platformPath: Path.Path,\n artifacts: ArtifactStore.Service,\n options: FileSystemOptions = {}\n): Service => {\n const maxInlineBytes = options.maxInlineBytes ?? defaultMaxInlineBytes\n const maxTotalInlineBytes = options.maxTotalInlineBytes ?? defaultMaxTotalInlineBytes\n // Stat tuples are not content identities: a same-size rewrite can preserve\n // mtime, device, and inode on every supported filesystem.\n const readDigestFrom = Effect.fn(\"StepBoundary.readDigest\")(function*(host: FileSystem.FileSystem, path: string) {\n const bytes = yield* host.readFile(path)\n const digest = yield* Schema.decodeUnknownEffect(Sha256)(bytes).pipe(Effect.orDie)\n return { digest, bytes } satisfies MeasuredDigest\n })\n const readDigest = (path: string) => readDigestFrom(fs, path)\n const batch = KernelFileSystem.batch(fs)\n const measurements = Effect.fn(\"StepBoundary.measurements\")(\n function*(paths: ReadonlyArray<string>, content: boolean) {\n if (batch === undefined) {\n return yield* Effect.forEach(paths, (path) =>\n readDigest(path).pipe(\n Effect.map((value): BatchedDigest => ({\n digest: value.digest,\n sizeBytes: value.bytes.length,\n ...(content ? { bytes: value.bytes } : {})\n })),\n Effect.catchReason(\"PlatformError\", \"NotFound\", () => Effect.succeed(undefined)),\n Effect.mapError(hostFailure)\n ), { concurrency: KernelFileSystem.fallbackConcurrency })\n }\n const values: Array<BatchedDigest | undefined> = []\n for (let offset = 0; offset < paths.length; offset += batch.maxSize) {\n const response = yield* batch.execute(\n paths.slice(offset, offset + batch.maxSize).map((path) => ({\n operation: \"digest\",\n path,\n content\n }))\n ).pipe(Effect.mapError(hostFailure))\n for (const entry of [...response.entries].sort((a, b) => a.index - b.index)) {\n const measured = yield* Effect.fromResult(entry.result).pipe(\n Effect.catchReason(\"PlatformError\", \"NotFound\", () => Effect.succeed(undefined)),\n Effect.mapError(hostFailure)\n )\n if (measured === undefined) values.push(undefined)\n else if (measured.operation !== \"digest\") {\n return yield* Effect.fail(hostFailure(new Error(\"host returned a non-digest batch result\")))\n } else values.push({ ...measured, digest: measured.digest as ArtifactStore.Digest })\n }\n }\n return values\n }\n )\n /**\n * One host call, never two. An `exists` probe ahead of the read asked\n * exactly what the read itself answers — a path that is not there refuses\n * with `NotFound` — and every declared read was therefore measured twice.\n * On the confined host that is two CPython forks per path\n * (`@smthrs/platform-node/AtomicFileSystem` spawns one interpreter per\n * operation, ~130 ms each), so the probe doubled the cost of every\n * `prepare`, every post-body change check, and every materialization.\n */\n const measure = (\n path: string,\n host: FileSystem.FileSystem = fs\n ): Effect.Effect<string, UnsupportedBoundary, Crypto.Crypto> =>\n readDigestFrom(host, path).pipe(\n Effect.map((measured) => measured.digest),\n Effect.catchReason(\"PlatformError\", \"NotFound\", () => Effect.succeed(absentDigest)),\n Effect.mapError(hostFailure)\n )\n // Both expansions enumerate through `FileEnumeration`, never the host\n // `glob`: host results are absolute under the kernel FileSystem and skip\n // dotfiles under Node's matcher, so trusting them silently emptied every\n // workspace-relative expansion and let a tree replay delete dotfiles the\n // producer wrote.\n const expandGlob = Effect.fn(\"StepBoundary.expandGlob\")(function*(glob: FileSet.Glob) {\n return yield* FileEnumeration.expandGlob(fs, glob).pipe(Effect.mapError(hostFailure))\n })\n const treeEntries = Effect.fn(\"StepBoundary.treeEntries\")(function*(host: FileSystem.FileSystem, path: string) {\n return yield* FileEnumeration.entriesUnder(host, path).pipe(Effect.mapError(hostFailure))\n })\n // Replay writes and deletes what evidence names, so the lexical check alone\n // is not a boundary: a symlink planted on a lexically valid path would carry\n // the mutation outside the workspace. Every replay mutation, its probes, and\n // its prune walk go through a view pinned to the root, where each call is\n // one descriptor-relative, no-follow request and a symlink anywhere on the\n // path is refused rather than followed. `prepare` and `settle` only read,\n // and keep the caller's filesystem.\n const replayRoot = KernelFileSystem.confinedRoot(fs) ?? options.root ?? \".\"\n const replayHost: Effect.Effect<FileSystem.FileSystem, UnsupportedBoundary> = KernelFileSystem.isConfinable(fs)\n ? KernelFileSystem.confined(fs, replayRoot).pipe(\n Effect.provideService(Path.Path, platformPath),\n Effect.mapError(hostFailure)\n )\n : Effect.fail(\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message:\n \"cache replay needs a confined host filesystem; the host carries no descriptor-relative executor or isolation attestation\"\n })\n )\n const capture = Effect.fn(\"StepBoundary.capture\")(\n function*(path: string, inlineBudget: number, measured: BatchedDigest | undefined) {\n yield* Effect.annotateCurrentSpan({ path })\n // As in `measure`: the read reports absence itself, so the output is\n // captured in one host call rather than an `exists` probe plus a read.\n if (measured === undefined) {\n return { output: { path, digest: null } satisfies MaterializedOutput, inlinedBytes: 0 }\n }\n const bytes = measured.bytes\n if (bytes === undefined) return yield* Effect.fail(hostFailure(new Error(\"host omitted requested batch content\")))\n const digest = measured.digest\n // Inline only while both bounds hold (issue #122): the per-output bound\n // and the settle-wide aggregate budget the caller threads through.\n if (bytes.length <= maxInlineBytes && bytes.length <= inlineBudget) {\n return {\n output: {\n path,\n digest,\n sizeBytes: bytes.length,\n content: Encoding.encodeBase64(bytes)\n } satisfies MaterializedOutput,\n inlinedBytes: bytes.length\n }\n }\n // Over the inline bound: the payload goes to the content-addressed\n // artifact store and the persisted row carries only the reference. Every\n // property that used to live here — atomic publication, verify-once\n // dedupe, healing rewrite of a corrupt address — is now the store's, and\n // is tested there (`@smthrs/artifacts`).\n const stored = yield* artifacts.put(bytes).pipe(Effect.mapError(artifactFailure))\n if (stored !== digest) {\n return yield* Effect.fail(\n new BoundaryCorruption({\n code: \"boundary_corruption\",\n path,\n recordedDigest: `${stored}`,\n measuredDigest: digest\n })\n )\n }\n return { output: { path, digest, sizeBytes: bytes.length } satisfies MaterializedOutput, inlinedBytes: 0 }\n }\n )\n const materialize = Effect.fn(\"StepBoundary.materialize\")(function*(\n host: FileSystem.FileSystem,\n output: MaterializedOutput\n ) {\n yield* Effect.annotateCurrentSpan({ path: output.path })\n // The filesystem is the cheapest source of truth for a warm workspace.\n // Probe before decoding inline bytes or consulting the artifact store; a\n // transient probe refusal merely forfeits the optimization and the\n // ordinary materialization path retains its existing typed failures.\n const current = yield* measure(output.path, host).pipe(\n Effect.map((digest) => digest !== absentDigest && digest === output.digest),\n Effect.catch(() => Effect.succeed(false))\n )\n if (current) return\n let bytes: Uint8Array\n if (output.content !== undefined) {\n const decoded = Encoding.decodeBase64(output.content)\n if (Result.isFailure(decoded)) {\n // Inline content is cache-origin bytes: an undecodable payload is a\n // tampered durable row, classified exactly like a digest mismatch so\n // the caller routes it to the Inconsistency receiver instead of\n // retrying it as a transient host refusal (issue #159).\n return yield* Effect.fail(inlineCorruption(output.path, `${output.digest}`))\n }\n bytes = decoded.success\n // Inline evidence is verified here because nothing else can: the bytes\n // travel inside the row rather than at a content address. A referenced\n // artifact is verified by the store on the way out, so the check below\n // would be a second read+hash of the same bytes.\n const measured = yield* Schema.decodeUnknownEffect(Sha256)(bytes).pipe(Effect.orDie)\n if (measured !== output.digest) {\n return yield* Effect.fail(\n new BoundaryCorruption({\n code: \"boundary_corruption\",\n path: output.path,\n recordedDigest: `${output.digest}`,\n measuredDigest: measured\n })\n )\n }\n } else {\n bytes = yield* artifacts.get(`${output.digest}`).pipe(\n Effect.catchTags({\n // A reference this host cannot resolve is not a host refusal: a\n // shared artifact tier may still hold it, so the caller gets a\n // typed, repairable failure and fetches before falling back to a\n // real execution (issue #172).\n \"@smthrs/artifacts/ArtifactMissing\": (missing) =>\n Effect.fail(\n new MissingArtifact({ code: \"missing_artifact\", path: output.path, digest: missing.digest })\n ),\n // Corruption is a distinct typed failure from a transient host\n // error (issue #150): the caller routes it to the Inconsistency\n // receiver instead of treating it as an ordinary retryable refusal.\n \"@smthrs/artifacts/ArtifactCorruption\": (corrupt) =>\n Effect.fail(\n new BoundaryCorruption({\n code: \"boundary_corruption\",\n path: output.path,\n recordedDigest: corrupt.recordedDigest,\n measuredDigest: corrupt.measuredDigest\n })\n ),\n \"@smthrs/artifacts/ArtifactStoreError\": (failure) => Effect.fail(artifactFailure(failure))\n })\n )\n }\n // The original body may have created the output's directory itself; a\n // fresh workspace replaying the evidence has no such directory and\n // `writeFile` does not create parents (issue #107).\n const parent = parentDirectory(output.path)\n if (parent !== undefined) {\n yield* host.makeDirectory(parent, { recursive: true }).pipe(Effect.mapError(hostFailure))\n }\n yield* host.writeFile(output.path, bytes).pipe(Effect.mapError(hostFailure))\n })\n return make({\n prepare: Effect.fn(\"StepBoundary.prepare\")(function*(descriptor) {\n const boundary = FileBoundarySnapshot.make(descriptor)\n yield* Effect.annotateCurrentSpan({\n reads: boundary.readSet.length,\n boundaryMode: boundary.boundaryMode\n })\n // The dirty check's evidence (issue #90): what the host actually\n // measured for every declared read, never the declaration itself —\n // defaulting the snapshot to the declaration made `readSetMatches`\n // compare the declaration against itself and pass unconditionally\n // (issue #104).\n const readSnapshot: Array<FileInput> = []\n const paths: Array<string> = []\n for (const entry of boundary.readSet) {\n if (FileSet.isGlob(entry)) {\n paths.push(...yield* expandGlob(entry))\n } else paths.push(entry.path)\n }\n const measured = yield* measurements(paths, false)\n for (const [index, path] of paths.entries()) {\n readSnapshot.push({ path, digest: measured[index]?.digest ?? absentDigest })\n }\n readSnapshot.sort((left, right) => compareText(left.path, right.path))\n return Object.freeze({\n descriptor: boundary,\n readSnapshot: Object.freeze(readSnapshot.map((entry) => Object.freeze({ ...entry })))\n })\n }),\n settle: Effect.fn(\"StepBoundary.settle\")(function*(prepared) {\n yield* Effect.annotateCurrentSpan({\n writes: prepared.descriptor.writeSet.length,\n boundaryMode: prepared.descriptor.boundaryMode\n })\n // Undeclared-write detection is scoped to the declared read set: a\n // declared read whose content moved during the body and is not also a\n // declared write was mutated outside the contract. Whole-tree change\n // detection needs the jj diff surface and stays a documented\n // limitation of this layer rather than a silent pass — the read set\n // is exactly the material cacheability rests on.\n const removes = prepared.descriptor.removes ?? []\n const declaredWrites = [...prepared.descriptor.writeSet, ...removes]\n const declaredCovers = (path: string) =>\n declaredWrites.some((entry) =>\n typeof entry === \"string\"\n ? entry === path\n : entry._tag === \"TreeArtifact\"\n ? path === entry.path || path.startsWith(`${entry.path}/`)\n : FileSet.matchesGlob(entry, path)\n )\n const undeclared: Array<string> = []\n const checkedReads = prepared.readSnapshot.filter((entry) => !declaredCovers(entry.path))\n const currentReads = yield* measurements(checkedReads.map((entry) => entry.path), false)\n for (const [index, entry] of checkedReads.entries()) {\n if ((currentReads[index]?.digest ?? absentDigest) !== entry.digest) undeclared.push(entry.path)\n }\n const outputs: Array<MaterializedOutput> = []\n // Declared removals are captured on the same path and under the same\n // `digest: null` semantics they have always had — the difference is that\n // here the absence was declared, so it is evidence rather than a defect.\n const missing: Array<string> = []\n const surviving: Array<string> = []\n let inlinedBytes = 0\n const outputPaths: Array<string> = []\n const treeMembers: Array<{ readonly path: string; readonly files: ReadonlyArray<string> }> = []\n for (const entry of prepared.descriptor.writeSet) {\n if (typeof entry === \"string\") outputPaths.push(entry)\n else if (entry._tag === \"Glob\") outputPaths.push(...yield* expandGlob(entry))\n else {\n const files = (yield* treeEntries(fs, entry.path)).files\n outputPaths.push(...files)\n treeMembers.push({ path: entry.path, files })\n }\n }\n outputPaths.push(...removes)\n const captured = new Map<string, MaterializedOutput>()\n const sortedPaths = [...new Set(outputPaths)].sort(compareText)\n // Digest-only preflight bounds content batches by bytes as well as path\n // count. Both measurements share the guarded host's pinned root identity;\n // a rewrite between them is a refusal, never mismatched cached content.\n const sizes = batch === undefined ? undefined : yield* measurements(sortedPaths, false)\n for (let offset = 0; offset < sortedPaths.length;) {\n let end = offset\n let responseBytes = 256\n const size = batch?.maxSize ?? KernelFileSystem.fallbackConcurrency\n while (end < sortedPaths.length && end - offset < size) {\n const estimate = 4096 + new TextEncoder().encode(sortedPaths[end]).length * 6 +\n Math.ceil((sizes?.[end]?.sizeBytes ?? 0) / 3) * 4\n if (end > offset && batch !== undefined && responseBytes + estimate > batch.maxResponseBytes) break\n responseBytes += estimate\n end++\n }\n const group = sortedPaths.slice(offset, end)\n const contents = yield* measurements(group, true)\n for (const [index, path] of group.entries()) {\n const measured = contents[index]\n if (sizes !== undefined && measured?.digest !== sizes[offset + index]?.digest) {\n return yield* Effect.fail(hostFailure(new Error(`output changed during measurement: ${path}`)))\n }\n const output = yield* capture(path, maxTotalInlineBytes - inlinedBytes, measured)\n // `capture` reports the bytes it actually inlined (zero for a\n // digest-only reference), so the aggregate budget never has to\n // re-derive them from the row it just built.\n inlinedBytes += output.inlinedBytes\n outputs.push(output.output)\n captured.set(path, output.output)\n if (\n output.output.digest === null &&\n !removes.includes(path) &&\n prepared.descriptor.writeSet.some((entry) => typeof entry === \"string\" && entry === path)\n ) missing.push(path)\n // The dual check: a removal promised the path absent, and it is still\n // here — possibly rewritten. Settling it would cache the surviving\n // bytes under a declaration that disclaimed them.\n if (output.output.digest !== null && removes.includes(path)) surviving.push(path)\n }\n offset = end\n }\n // A tree member is already one of the captured outputs, so its identity\n // is folded from the digest that capture measured rather than from a\n // second read of the same bytes. `capture` spells an absent member\n // `null` where `measure` spells it `absentDigest`; the identity keeps\n // the `measure` spelling, so a tree recorded before this and one\n // recorded after hash identically.\n const trees: Array<{ readonly path: string; readonly identity: string }> = []\n for (const tree of treeMembers) {\n const pairs = tree.files.map((path) =>\n [path.slice(tree.path.length + 1), captured.get(path)!.digest ?? absentDigest] as const\n )\n trees.push({\n path: tree.path,\n identity: yield* Schema.decodeUnknownEffect(DerivedKey)({ kind: \"tree-artifact\", files: pairs }).pipe(\n Effect.orDie\n )\n })\n }\n // Through `DerivedKey` — the repo's one hashing chokepoint — so the identity is\n // a digest of the RFC 8785 canonical form rather than of whatever\n // `JSON.stringify` happened to emit for this shape.\n const diffIdentity = yield* Schema.decodeUnknownEffect(DerivedKey)({\n kind: \"diff-identity\",\n outputs: outputs.map((output) => [output.path, output.digest]),\n trees\n }).pipe(Effect.orDie)\n yield* Effect.annotateCurrentSpan({ diffIdentity })\n if (prepared.descriptor.boundaryMode === \"hard\") {\n if (undeclared.length > 0) {\n return yield* Effect.fail(\n new UndeclaredWrite({ code: \"undeclared_write\", paths: undeclared, diffIdentity })\n )\n }\n // A declared output that was never produced is a defect, not evidence\n // (Bazel's `checkOutputs`). Recording it would cache `digest: null`,\n // which every later `replayOutputs` reads as \"delete this path\".\n if (missing.length > 0) {\n return yield* Effect.fail(\n new MissingDeclaredOutput({ code: \"missing_declared_output\", paths: missing, diffIdentity })\n )\n }\n if (surviving.length > 0) {\n return yield* Effect.fail(\n new SurvivingDeclaredRemoval({ code: \"surviving_declared_removal\", paths: surviving, diffIdentity })\n )\n }\n }\n return {\n declaredOutputs: { outputs, ...(trees.length === 0 ? {} : { trees }) },\n diffIdentity,\n // This filesystem-only boundary cannot observe writes elsewhere in\n // the tree. Omission is deliberate: ActionPersistence treats the\n // result as run-local and will not publish it to the shared cache.\n //\n // An undeclared write is reported ahead of a missing output, and a\n // missing output ahead of a surviving removal: each is the stronger\n // claim about the same execution, and every variant bars the evidence\n // from the shared cache identically.\n ...(undeclared.length > 0\n ? { deviation: { _tag: \"ExpectedSetDeviation\" as const, paths: undeclared, diffIdentity } }\n : missing.length > 0\n ? { deviation: { _tag: \"MissingDeclaredOutput\" as const, paths: missing, diffIdentity } }\n : surviving.length > 0\n ? { deviation: { _tag: \"SurvivingDeclaredRemoval\" as const, paths: surviving, diffIdentity } }\n : {})\n }\n }),\n replayOutputs: Effect.fn(\"StepBoundary.replayOutputs\")(function*(evidence) {\n yield* Effect.annotateCurrentSpan({ diffIdentity: evidence.diffIdentity })\n const decoded = Schema.decodeUnknownResult(MaterializedOutputs)(evidence.declaredOutputs)\n if (decoded._tag === \"Failure\") {\n // Evidence recorded by a different boundary implementation carries\n // no materializable outputs; refusing is honest — the caller's\n // dispatch path falls back to a real execution or fails visibly.\n return yield* Effect.fail(\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message: \"the recorded boundary evidence carries no materializable outputs\"\n })\n )\n }\n // Replay writes and DELETES whatever the evidence names, so a path is\n // honored only in the coordinate system declarations are written in.\n // Evidence can arrive from a foreign producer through cache sync; an\n // absolute or upward spelling is an eraser aimed outside the workspace,\n // and refusing it here is what keeps that a refusal instead of a wipe.\n const foreign = [\n ...(decoded.success.trees ?? []).map((tree) => tree.path),\n ...decoded.success.outputs.map((output) => output.path)\n ].filter((path) => !FileSet.workspaceRelative(path))\n if (foreign.length > 0) {\n return yield* Effect.fail(\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message: `the recorded boundary evidence names paths outside the workspace: ${foreign.join(\", \")}`\n })\n )\n }\n // Before any mutation: a host that cannot be confined refuses the whole\n // replay, and the caller falls back to a real execution.\n const host = yield* replayHost\n const emptyDirectoryCandidates = new Set<string>()\n for (const tree of decoded.success.trees ?? []) {\n const prefix = `${tree.path}/`.replace(/\\/{2,}$/g, \"/\")\n const recorded = new Set(\n decoded.success.outputs\n .map((output) => output.path)\n .filter((path) => path.startsWith(prefix))\n )\n const entries = yield* treeEntries(host, tree.path)\n for (const path of entries.files) {\n if (!recorded.has(path)) yield* host.remove(path).pipe(Effect.mapError(hostFailure))\n }\n for (const directory of entries.directories) emptyDirectoryCandidates.add(directory)\n }\n for (const output of decoded.success.outputs) {\n if (output.digest === null) {\n // `force` IS the probe: the evidence says this path must not exist,\n // and a removal that finds it already gone has done its job. The\n // `exists` call that used to precede it was a second host call — a\n // second process on the confined host — for the same answer.\n yield* host.remove(output.path, { force: true }).pipe(Effect.mapError(hostFailure))\n } else {\n yield* materialize(host, output)\n }\n }\n // Remove only directories proven empty after pruning and\n // materialization. Deepest-first preserves every directory that still\n // contains a recorded child while clearing stale empty scaffolding.\n const directories = [...emptyDirectoryCandidates].sort((left, right) =>\n right.length - left.length || compareText(left, right)\n )\n for (const directory of directories) {\n const entries = yield* host.readDirectory(directory).pipe(Effect.mapError(hostFailure))\n if (entries.length === 0) yield* host.remove(directory).pipe(Effect.mapError(hostFailure))\n }\n })\n })\n}\n\n/**\n * Provides the filesystem-backed production boundary: `prepare` measures the\n * declared read set for real, `settle` detects reads mutated outside the\n * declared write set and captures the write set's post-state, and\n * `replayOutputs` re-materializes those outputs on cache-hit replay.\n *\n * Host access arrives through Effect's `FileSystem` tag, which the capability\n * kernel decorates in place — the same seam every host implementation (node,\n * bun, browser, sandbox) already provides. Blob storage arrives through\n * `@smthrs/artifacts`, so the same boundary runs over a purely local store or\n * over a local-plus-shared composition without knowing which it got.\n *\n * Replay confines its own mutations rather than trusting the composition:\n * they run through `@smthrs/kernel/FileSystem`'s `confined` view, rooted at\n * the kernel `Workspace` when one is in context. A symlink on a replayed path\n * (a parent, the final component, or a member of a replayed tree) and a host\n * with no descriptor-relative executor or isolation attestation both refuse\n * with {@link UnsupportedBoundary}, which the caller journals as\n * `replay_failed` before executing the step for real.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layer: Layer.Layer<\n Service,\n never,\n FileSystem.FileSystem | Path.Path | ArtifactStore.ArtifactStore\n> = Layer.effect(\n StepBoundary,\n Effect.gen(function*() {\n const fs = yield* FileSystem.FileSystem\n const platformPath = yield* Path.Path\n const artifacts = yield* ArtifactStore.ArtifactStore\n const workspace = yield* Effect.serviceOption(KernelWorkspace)\n return makeFileSystem(fs, platformPath, artifacts, workspace._tag === \"Some\" ? { root: workspace.value.root } : {})\n })\n)\n\n/**\n * What the deterministic test boundary should pretend the host observed.\n *\n * Every field is a fixture, not a classification rule: a test supplies settlement\n * evidence or failure, the read snapshot, and whether the host claims\n * to support the boundary at all — then asserts on the resulting evidence or\n * refusal. Defaults describe a well-behaved, fully-supported host.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface TestOptions {\n /** A settlement failure supplied verbatim by an integration fixture. */\n readonly failure?: UndeclaredWrite | MissingDeclaredOutput | SurvivingDeclaredRemoval | undefined\n /** Settlement evidence supplied verbatim; classification belongs to the real layer. */\n readonly deviation?: BoundaryDeviation | undefined\n /**\n * What `prepare` reports as measured for the declared read set. Defaults\n * to the declaration itself; a test supplies a different snapshot to stand\n * for a file whose content moved out from under a stale declaration\n * (issue #90).\n */\n readonly readSnapshot?: ReadonlyArray<FileInput> | undefined\n /** The opaque replay payload recorded in the evidence. */\n readonly declaredOutputs?: unknown\n /** The post-state identity the evidence names. Defaults to a fixed string. */\n readonly diffIdentity?: string | undefined\n /** When false, every call fails with {@link UnsupportedBoundary}. Defaults to true. */\n readonly supported?: boolean | undefined\n /** Whether the fixture attests a whole-tree observation. Defaults to true. */\n readonly wholeTreeWriteDetection?: boolean | undefined\n /** Whether the fixture models an isolated read surface. Defaults to true. */\n readonly hermeticReadDetection?: boolean | undefined\n /** Observes each `replayOutputs` call, so a test can assert replay happened. */\n readonly onReplay?: (evidence: BoundaryEvidence) => void\n}\n\nconst unsupported = (): UnsupportedBoundary =>\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message: \"the host cannot enforce the declared step boundary\"\n })\n\n/**\n * Deterministic in-memory boundary suitable only for tests. Production\n * wiring uses {@link layer}, the filesystem-backed implementation.\n *\n * Whole-tree change detection is supplied by sandboxed settlement, not by any\n * boundary layer: an isolated execution's transaction IS the tree, so\n * `ActionPersistence` compares its diff against the declared sets and sets\n * `wholeTreeWritesVerified` structurally (the retired piece-6 limitation).\n * {@link layer} still detects mutations within the declared read set only,\n * which is why unsandboxed evidence stays run-local.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layerTest = (options: TestOptions = {}): Layer.Layer<Service> => {\n const diffIdentity = options.diffIdentity ?? \"test-diff\"\n const service = make({\n prepare: Effect.fn(\"StepBoundary.prepare\")(function*(descriptor) {\n if (options.supported === false) return yield* Effect.fail(unsupported())\n return {\n descriptor,\n readSnapshot: options.readSnapshot ?? exactReads(descriptor)\n }\n }),\n settle: Effect.fn(\"StepBoundary.settle\")(function*(prepared) {\n if (options.supported === false) return yield* Effect.fail(unsupported())\n if (options.failure !== undefined) return yield* Effect.fail(options.failure)\n return {\n declaredOutputs: options.declaredOutputs ?? { paths: prepared.descriptor.writeSet },\n diffIdentity,\n ...(options.wholeTreeWriteDetection === false ? {} : { wholeTreeWritesVerified: true as const }),\n ...(options.hermeticReadDetection === false ? {} : { hermeticReadsVerified: true as const }),\n ...(options.deviation === undefined ? {} : { deviation: options.deviation })\n }\n }),\n replayOutputs: Effect.fn(\"StepBoundary.replayOutputs\")(function*(evidence) {\n if (options.supported === false) return yield* Effect.fail(unsupported())\n yield* Effect.sync(() => {\n options.onReplay?.(evidence)\n })\n })\n })\n return Layer.succeed(StepBoundary, service)\n}\n"]}
|
|
1
|
+
{"version":3,"file":"StepBoundary.js","sourceRoot":"","sources":["../../src/StepBoundary.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,aAAa,MAAM,iCAAiC,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,KAAK,gBAAgB,MAAM,2BAA2B,CAAA;AAC7D,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,MAAM,0BAA0B,CAAA;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,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sourcesContent":["/**\n * Hermetic step boundary contracts, the filesystem-backed production\n * implementation, and the deterministic test implementation.\n *\n * @since 0.1.0\n */\n\nimport * as ArtifactStore from \"@smthrs/artifacts/ArtifactStore\"\nimport { Sha256 } from \"@smthrs/crypto\"\nimport { FileBoundary } from \"@smthrs/flow/FileBoundary\"\nimport { FileInput } from \"@smthrs/flow/FileInput\"\nimport * as KernelFileSystem from \"@smthrs/kernel/FileSystem\"\nimport { Workspace as KernelWorkspace } from \"@smthrs/kernel/Workspace\"\nimport { DerivedKey } from \"@smthrs/keys\"\nimport * as FileSet from \"@smthrs/plan/FileSet\"\nimport * as Context from \"effect/Context\"\nimport type * as Crypto from \"effect/Crypto\"\nimport * as Effect from \"effect/Effect\"\nimport * as Base64 from \"effect/encoding/Base64\"\nimport * as FileSystem from \"effect/FileSystem\"\nimport * as Layer from \"effect/Layer\"\nimport * as Path from \"effect/Path\"\nimport * as Result from \"effect/Result\"\nimport * as Schema from \"effect/Schema\"\nimport * as FileBoundarySnapshot from \"./internal/FileBoundarySnapshot.ts\"\nimport * as FileEnumeration from \"./internal/FileEnumeration.ts\"\nimport { compareText } from \"./internal/Ordering.ts\"\n\n/**\n * A file boundary that has been measured but not yet run: the caller's\n * declaration, paired with what the host actually found on disk for it.\n *\n * `prepare` produces one of these before a step executes and `settle` consumes\n * it afterwards, which is what lets the boundary say whether the world moved\n * underneath the declaration. Check it with {@link readSetMatches}.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const PreparedBoundary = Schema.Struct({\n descriptor: FileBoundary,\n /**\n * What the host actually measured for the declared read set at prepare\n * time. The declared digests are caller metadata folded into the step key;\n * this is the evidence that they still describe reality, and a sealed\n * cache hit is refused when the two disagree (issue #90).\n */\n readSnapshot: Schema.Array(FileInput)\n})\n\n/**\n * The value form of {@link PreparedBoundary}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type PreparedBoundary = typeof PreparedBoundary.Type\n\n/**\n * Exact read inputs from a boundary after ignoring declarations that still need expansion.\n *\n * @category accessors\n * @since 0.1.0\n */\nexport const exactReads = (descriptor: FileBoundary): ReadonlyArray<FileInput> =>\n descriptor.readSet.filter((entry): entry is FileInput => !FileSet.isGlob(entry))\n\n/**\n * Whether every declared read still matches what the host measured.\n *\n * Reads the host reports but the declaration never claimed are ignored: the\n * declaration is the dependency edge set, and an incidental extra read is not\n * one of its edges. A declared path missing from the measurement counts as a\n * mismatch — its value is unknown, so reuse cannot be justified.\n *\n * @since 0.1.0\n * @category predicates\n */\nexport const readSetMatches = (prepared: PreparedBoundary): boolean => {\n const digestsByPath = new Map<string, Set<string>>()\n for (const measured of prepared.readSnapshot) {\n const digests = digestsByPath.get(measured.path)\n if (digests === undefined) digestsByPath.set(measured.path, new Set([measured.digest]))\n else digests.add(measured.digest)\n }\n return prepared.descriptor.readSet.every((entry) =>\n !FileSet.isGlob(entry) &&\n digestsByPath.get(entry.path)?.has(entry.digest) === true\n )\n}\n\n/**\n * The paths a step wrote that its `expected` write set did not name, together\n * with the diff identity they were observed under.\n *\n * An expected-mode boundary reports these rather than failing: the declaration\n * is a prediction, and a wrong prediction is evidence to journal, not an\n * error. A hard-mode boundary raises {@link UndeclaredWrite} for the same\n * observation.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const ExpectedSetDeviation = Schema.TaggedStruct(\"ExpectedSetDeviation\", {\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n})\n\n/**\n * Declared writes an expected-mode step did not produce, and did not declare\n * as removals.\n *\n * The absence itself is the defect: recording it as valid evidence caches the\n * claim \"this file should not exist\", which `replayOutputs` then acts on by\n * deleting the path on a workspace that never ran the step. A hard-mode\n * boundary raises {@link MissingDeclaredOutput} for the same observation.\n *\n * Expected mode records it rather than failing because the declaration there is\n * a prediction — and because a deviation of any variant already bars the\n * evidence from the shared cache (`ActionPersistence` gates `recordCache` on\n * `deviation === undefined`), so an unexplained absence never reaches another\n * host either way.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const MissingOutputDeviation = Schema.TaggedStruct(\"MissingDeclaredOutput\", {\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n})\n\n/**\n * Declared removals an expected-mode step left in place.\n *\n * The dual of {@link MissingOutputDeviation}: a removal is a promise about the\n * post-state exactly as a write is. A path that was promised absent but is\n * still present — possibly mutated — must not settle as valid evidence, or\n * the mutation is cached under a declaration that disclaimed it and replay\n * materializes it everywhere. A hard-mode boundary raises\n * {@link SurvivingDeclaredRemoval} for the same observation.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const SurvivingRemovalDeviation = Schema.TaggedStruct(\"SurvivingDeclaredRemoval\", {\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n})\n\n/**\n * What a settled boundary observed that its declaration did not predict.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const BoundaryDeviation = Schema.Union([ExpectedSetDeviation, MissingOutputDeviation, SurvivingRemovalDeviation])\n\n/**\n * The value form of {@link BoundaryDeviation}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type BoundaryDeviation = typeof BoundaryDeviation.Type\n\n/**\n * What a settled boundary proved about a step's writes — the record the\n * journal keeps and a later cache hit is justified against.\n *\n * `diffIdentity` names the post-state the step produced; `declaredOutputs`\n * carries whatever the implementation needs to reproduce it on a workspace\n * that never ran the step. The two optional fields are the honest gaps:\n * `wholeTreeWritesVerified` is present only when the boundary could observe\n * the entire execution tree, and `deviation` only when it saw writes the\n * declaration did not predict.\n *\n * @since 0.1.0\n * @category schemas\n */\nexport const BoundaryEvidence = Schema.Struct({\n declaredOutputs: Schema.Unknown,\n diffIdentity: Schema.NonEmptyString,\n /**\n * The boundary observed the whole execution tree and proved that every\n * write was covered by the descriptor's write set. Only evidence carrying\n * this explicit proof may enter the cross-run cache. Older evidence and\n * boundaries that can inspect declared paths only omit it.\n */\n wholeTreeWritesVerified: Schema.optional(Schema.Literal(true)),\n /** The body could observe only declared filesystem inputs. */\n hermeticReadsVerified: Schema.optional(Schema.Literal(true)),\n deviation: Schema.optional(BoundaryDeviation)\n})\n\n/**\n * The value form of {@link BoundaryEvidence}.\n *\n * @since 0.1.0\n * @category models\n */\nexport type BoundaryEvidence = typeof BoundaryEvidence.Type\n\n/**\n * A hard-mode step wrote outside its declared write set.\n *\n * Hard mode treats the declaration as a contract, so this is a refusal, not a\n * report: the step's evidence is never journaled and never becomes a cache\n * entry. An expected-mode boundary records the same observation as a\n * {@link BoundaryDeviation} instead.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class UndeclaredWrite extends Schema.TaggedError<UndeclaredWrite>()(\n \"@smthrs/engine-store/UndeclaredWrite\",\n {\n code: Schema.Literal(\"undeclared_write\"),\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n }\n) {}\n\n/**\n * A step finished without producing a path its write set declared, and did not\n * declare that path as a removal.\n *\n * Bazel hard-fails the same observation — `SkyframeActionExecutor.checkOutputs`\n * reports \"output was not created\" — and for the same reason: the alternative\n * is to record `digest: null` as valid evidence, which caches the claim \"this\n * file should not exist\" and makes every later replay delete the path. A step\n * that crashed after declaring its writes would poison the cache with an\n * eraser.\n *\n * Declaring the path in {@link FileBoundary}'s `removes` is how a deliberate\n * deletion says so, and it is the only thing that makes the absence legitimate.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class MissingDeclaredOutput extends Schema.TaggedError<MissingDeclaredOutput>()(\n \"@smthrs/engine-store/MissingDeclaredOutput\",\n {\n code: Schema.Literal(\"missing_declared_output\"),\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n }\n) {}\n\n/**\n * A hard-mode step left a declared removal in place.\n *\n * The dual of {@link MissingDeclaredOutput}: `removes` promises the path is\n * absent afterwards, and a path that survived — or was quietly rewritten —\n * is a post-state the declaration disclaimed. Settling it as evidence would\n * cache the surviving bytes under a removal and hand them to every replay.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class SurvivingDeclaredRemoval extends Schema.TaggedError<SurvivingDeclaredRemoval>()(\n \"@smthrs/engine-store/SurvivingDeclaredRemoval\",\n {\n code: Schema.Literal(\"surviving_declared_removal\"),\n paths: Schema.Array(Schema.String),\n diffIdentity: Schema.NonEmptyString\n }\n) {}\n\n/**\n * The host could not honour the boundary at all — a filesystem that cannot be\n * measured, a path that cannot be read, a transient I/O failure.\n *\n * It is the catch-all host refusal, deliberately kept distinct from the two\n * refusals a caller can act on: {@link BoundaryCorruption} (the bytes changed\n * under a recorded digest) and {@link MissingArtifact} (the bytes might be\n * fetchable from a shared tier).\n *\n * @since 0.1.0\n * @category errors\n */\nexport class UnsupportedBoundary extends Schema.TaggedError<UnsupportedBoundary>()(\n \"@smthrs/engine-store/UnsupportedBoundary\",\n {\n code: Schema.Literal(\"unsupported_boundary\"),\n message: Schema.String,\n /**\n * The refusing host or artifact-store failure, carried whole rather than\n * flattened into the message (`PlatformError`'s own convention), so the\n * journal record and a live debugger both see the original error.\n */\n cause: Schema.optional(Schema.Defect())\n }\n) {}\n\n/**\n * Recorded boundary evidence whose bytes no longer match their recorded\n * digest — an integrity violation of the store's strongest invariant, as\n * opposed to a transient host failure (issue #150). The two classes were\n * previously conflated under one `UnsupportedBoundary` tag, so a failing\n * disk corrupting many blobs journalled identically to a one-off EIO.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class BoundaryCorruption extends Schema.TaggedError<BoundaryCorruption>()(\n \"@smthrs/engine-store/BoundaryCorruption\",\n {\n code: Schema.Literal(\"boundary_corruption\"),\n path: Schema.String,\n recordedDigest: Schema.String,\n measuredDigest: Schema.String\n }\n) {}\n\n/**\n * Recorded evidence references an artifact this host's store does not hold\n * (issue #172). Distinct from {@link UnsupportedBoundary} because it is the one\n * replay refusal a *shared artifact tier* can repair: the caller fetches the\n * blob from the remote store, writes it back locally, and retries the replay\n * once before falling through to a real execution. Every other host refusal\n * says nothing about where the bytes might be.\n *\n * @since 0.1.0\n * @category errors\n */\nexport class MissingArtifact extends Schema.TaggedError<MissingArtifact>()(\n \"@smthrs/engine-store/MissingArtifact\",\n {\n code: Schema.Literal(\"missing_artifact\"),\n path: Schema.String,\n digest: Schema.String\n }\n) {}\n\n/**\n * The three-call lifecycle of a hermetic step boundary.\n *\n * `prepare` measures the declared read set before the step runs; `settle`\n * measures the writes afterwards and turns them into {@link BoundaryEvidence};\n * `replayOutputs` reproduces a previous step's outputs from that evidence, so\n * a cache hit can materialize results on a workspace that never executed\n * anything.\n *\n * @since 0.1.0\n * @category services\n */\nexport interface Service {\n readonly prepare: (\n descriptor: FileBoundary\n ) => Effect.Effect<PreparedBoundary, UnsupportedBoundary, Crypto.Crypto>\n readonly settle: (\n prepared: PreparedBoundary\n ) => Effect.Effect<\n BoundaryEvidence,\n UndeclaredWrite | MissingDeclaredOutput | SurvivingDeclaredRemoval | UnsupportedBoundary | BoundaryCorruption,\n Crypto.Crypto\n >\n readonly replayOutputs: (\n evidence: BoundaryEvidence\n ) => Effect.Effect<void, UnsupportedBoundary | BoundaryCorruption | MissingArtifact, Crypto.Crypto>\n}\n\n/**\n * The service key for a {@link Service}. Provide it with `layer` for\n * a real workspace or `layerTest` for a deterministic in-memory one.\n *\n * @since 0.1.0\n * @category services\n */\nexport const StepBoundary: Context.Service<Service, Service> = Context.Service<Service>(\n \"@smthrs/engine-store/StepBoundary\"\n)\n\n/**\n * Brands a {@link Service} implementation as a `StepBoundary`, so a new\n * boundary backend is type-checked where it is written rather than where it is\n * provided.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const make = (service: Service): Service => StepBoundary.of(service)\n\n/**\n * The digest a measurement reports for a declared path that does not exist.\n * Declared digests are hex SHA-256 strings, so the sentinel can never\n * collide with a real measurement — a declaration naming a vanished file\n * always mismatches and the cache hit is refused.\n */\nconst absentDigest = \"absent\"\n\n/**\n * The persisted shape of the production layer's `declaredOutputs`: the\n * declared write set's materialized post-state, so a cache-hit replay can\n * reproduce the outputs on a workspace that never ran the step.\n *\n * Outputs are recorded by content digest, never inlined unbounded\n * (issue #113): a `null` digest records that the path did not exist at\n * settle time; `content` (base64) is present only when the payload fits the\n * configured inline bound, otherwise the bytes live in the host's\n * content-addressed object directory under the digest and the row carries\n * only the reference. Temporal's blob-size limits are the prior art — the\n * evidence is persisted into every attempt row and cache entry.\n *\n * The digest is decoded against the store's strict address schema\n * (`ArtifactStore.Digest`), so a persisted row carrying a malformed address\n * fails the decode here instead of reaching the store or the sync RPCs.\n */\nconst DigestReferencedOutput = Schema.Struct({\n path: Schema.String,\n digest: Schema.NullOr(ArtifactStore.Digest),\n sizeBytes: Schema.optional(Schema.Number),\n content: Schema.optional(Schema.String)\n})\n\nconst MaterializedOutputs = Schema.Struct({\n outputs: Schema.Array(DigestReferencedOutput),\n trees: Schema.optional(Schema.Array(Schema.Struct({\n path: Schema.String,\n identity: Schema.String\n })))\n})\n\n/**\n * The directory portion of a slash-separated path, or `undefined` for a\n * bare filename (nothing to create). Boundary paths are workspace-relative\n * and slash-separated — the same normalization the kernel `FileSystem`\n * layer applies.\n */\nconst parentDirectory = (path: string): string | undefined => {\n const index = path.lastIndexOf(\"/\")\n return index <= 0 ? undefined : path.slice(0, index)\n}\n\nconst hostFailure = (cause: unknown): UnsupportedBoundary =>\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message: \"the host filesystem could not enforce the step boundary\",\n cause\n })\n\n/**\n * An artifact store that refused the operation outright — a failing disk, an\n * unreachable shared tier, an address that is not a content address. Unlike a\n * miss or a corruption it says nothing about the artifact, so it stays the\n * ordinary retryable host refusal the issue-#107 call sites already handle.\n */\nconst artifactFailure = (cause: ArtifactStore.ArtifactStoreError): UnsupportedBoundary =>\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message: `the artifact store could not serve the step boundary: ${cause.message}`,\n cause\n })\n\n/**\n * Corruption of an *inline* evidence payload (issue #159): the recorded\n * base64 no longer decodes, so there are no bytes to measure a digest of —\n * the `invalid_base64` sentinel records that the measurement itself was\n * impossible, which is still cache-origin corruption and never a transient\n * host refusal.\n */\nconst inlineCorruption = (path: string, recordedDigest: string): BoundaryCorruption =>\n new BoundaryCorruption({\n code: \"boundary_corruption\",\n path,\n recordedDigest,\n measuredDigest: \"invalid_base64\"\n })\n\n/**\n * The two size bounds that decide when a settled output is inlined into\n * boundary evidence and when it is spilled to the `ArtifactStore` by digest.\n *\n * Both default to values that keep an evidence row small enough to journal;\n * raise them only when the workspace's outputs are known to be small and the\n * extra artifact round-trip is measurably costing something.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface FileSystemOptions {\n /**\n * The largest output (in bytes) inlined into the boundary evidence\n * itself. Anything larger is handed to the `ArtifactStore` and recorded by\n * digest reference only (issue #113). Defaults to 1 MiB.\n */\n readonly maxInlineBytes?: number | undefined\n /**\n * The largest *aggregate* inline payload (in bytes) a single settle may\n * fold into its boundary evidence (issue #122). A per-output bound alone\n * still let a wide write set multiply many individually-small payloads\n * into an unbounded evidence row; once an output would push the running\n * total past this bound it is spilled to the `ArtifactStore` and\n * recorded by digest reference only, even though it individually fits\n * {@link maxInlineBytes}. Defaults to 8 MiB.\n */\n readonly maxTotalInlineBytes?: number | undefined\n /**\n * The workspace root cache replay confines its writes, removals, and prune\n * walk to. A filesystem already confined to a root (the kernel-guarded\n * layer's service, or a `confined` view) keeps its own root and ignores\n * this. Otherwise it defaults to the process working directory, the root a\n * path-based host resolves `prepare` and `settle` against. {@link layer}\n * passes the kernel `Workspace` root when one is in context.\n */\n readonly root?: string | undefined\n}\n\nconst defaultMaxInlineBytes = 1024 * 1024\nconst defaultMaxTotalInlineBytes = 8 * 1024 * 1024\ninterface MeasuredDigest {\n readonly digest: ArtifactStore.Digest\n readonly bytes: Uint8Array\n}\n\ninterface BatchedDigest {\n readonly digest: ArtifactStore.Digest\n readonly sizeBytes: number\n readonly bytes?: Uint8Array\n}\n\ntype MaterializedOutput = typeof DigestReferencedOutput.Type\n\n/**\n * The digests this evidence references rather than inlines — the set that must\n * be durable in a shared artifact tier before the evidence's cache entry\n * becomes observable there, and the set a replay on a fresh host has to fetch.\n *\n * Evidence recorded by a foreign boundary implementation references nothing\n * this store can name, so it yields the empty list rather than failing: the\n * caller's replay path already refuses such evidence with\n * {@link UnsupportedBoundary}.\n *\n * @since 0.1.0\n * @category accessors\n */\nexport const referencedDigests = (evidence: BoundaryEvidence): ReadonlyArray<ArtifactStore.Digest> => {\n const decoded = Schema.decodeUnknownResult(MaterializedOutputs)(evidence.declaredOutputs)\n if (decoded._tag === \"Failure\") return []\n const digests: Array<ArtifactStore.Digest> = []\n for (const output of decoded.success.outputs) {\n if (output.digest === null || output.content !== undefined) continue\n digests.push(output.digest)\n }\n return digests\n}\n\n/**\n * Builds the filesystem-backed boundary service.\n *\n * The blob mechanics — content addressing, atomic publication, digest\n * verification, dedupe — belong to `artifacts` and were extracted into\n * `@smthrs/artifacts` (`packages/smithers/flows/artifacts/docs/api.md`). What stays here\n * is the *policy* that decides which outputs become blobs at all: the\n * inline-versus-spill budgets are a property of how large an evidence row may\n * get, not of how bytes are stored.\n *\n * @since 0.1.0\n * @category constructors\n */\nexport const makeFileSystem = (\n fs: FileSystem.FileSystem,\n platformPath: Path.Path,\n artifacts: ArtifactStore.Service,\n options: FileSystemOptions = {}\n): Service => {\n const maxInlineBytes = options.maxInlineBytes ?? defaultMaxInlineBytes\n const maxTotalInlineBytes = options.maxTotalInlineBytes ?? defaultMaxTotalInlineBytes\n // Stat tuples are not content identities: a same-size rewrite can preserve\n // mtime, device, and inode on every supported filesystem.\n const readDigestFrom = Effect.fn(\"StepBoundary.readDigest\")(function*(host: FileSystem.FileSystem, path: string) {\n const bytes = yield* host.readFile(path)\n const digest = yield* Schema.decodeUnknownEffect(Sha256)(bytes).pipe(Effect.orDie)\n return { digest, bytes } satisfies MeasuredDigest\n })\n const readDigest = (path: string) => readDigestFrom(fs, path)\n const batch = KernelFileSystem.batch(fs)\n const measurements = Effect.fn(\"StepBoundary.measurements\")(\n function*(paths: ReadonlyArray<string>, content: boolean) {\n if (batch === undefined) {\n return yield* Effect.forEach(paths, (path) =>\n readDigest(path).pipe(\n Effect.map((value): BatchedDigest => ({\n digest: value.digest,\n sizeBytes: value.bytes.length,\n ...(content ? { bytes: value.bytes } : {})\n })),\n Effect.catchReason(\"PlatformError\", \"NotFound\", () => Effect.succeed(undefined)),\n Effect.mapError(hostFailure)\n ), { concurrency: KernelFileSystem.fallbackConcurrency })\n }\n const values: Array<BatchedDigest | undefined> = []\n for (let offset = 0; offset < paths.length; offset += batch.maxSize) {\n const response = yield* batch.execute(\n paths.slice(offset, offset + batch.maxSize).map((path) => ({\n operation: \"digest\",\n path,\n content\n }))\n ).pipe(Effect.mapError(hostFailure))\n for (const entry of [...response.entries].sort((a, b) => a.index - b.index)) {\n const measured = yield* Effect.fromResult(entry.result).pipe(\n Effect.catchReason(\"PlatformError\", \"NotFound\", () => Effect.succeed(undefined)),\n Effect.mapError(hostFailure)\n )\n if (measured === undefined) values.push(undefined)\n else if (measured.operation !== \"digest\") {\n return yield* Effect.fail(hostFailure(new Error(\"host returned a non-digest batch result\")))\n } else values.push({ ...measured, digest: measured.digest as ArtifactStore.Digest })\n }\n }\n return values\n }\n )\n /**\n * One host call, never two. An `exists` probe ahead of the read asked\n * exactly what the read itself answers — a path that is not there refuses\n * with `NotFound` — and every declared read was therefore measured twice.\n * On the confined host that is two CPython forks per path\n * (`@smthrs/platform-node/AtomicFileSystem` spawns one interpreter per\n * operation, ~130 ms each), so the probe doubled the cost of every\n * `prepare`, every post-body change check, and every materialization.\n */\n const measure = (\n path: string,\n host: FileSystem.FileSystem = fs\n ): Effect.Effect<string, UnsupportedBoundary, Crypto.Crypto> =>\n readDigestFrom(host, path).pipe(\n Effect.map((measured) => measured.digest),\n Effect.catchReason(\"PlatformError\", \"NotFound\", () => Effect.succeed(absentDigest)),\n Effect.mapError(hostFailure)\n )\n // Both expansions enumerate through `FileEnumeration`, never the host\n // `glob`: host results are absolute under the kernel FileSystem and skip\n // dotfiles under Node's matcher, so trusting them silently emptied every\n // workspace-relative expansion and let a tree replay delete dotfiles the\n // producer wrote.\n const expandGlob = Effect.fn(\"StepBoundary.expandGlob\")(function*(glob: FileSet.Glob) {\n return yield* FileEnumeration.expandGlob(fs, glob).pipe(Effect.mapError(hostFailure))\n })\n const treeEntries = Effect.fn(\"StepBoundary.treeEntries\")(function*(host: FileSystem.FileSystem, path: string) {\n return yield* FileEnumeration.entriesUnder(host, path).pipe(Effect.mapError(hostFailure))\n })\n // Replay writes and deletes what evidence names, so the lexical check alone\n // is not a boundary: a symlink planted on a lexically valid path would carry\n // the mutation outside the workspace. Every replay mutation, its probes, and\n // its prune walk go through a view pinned to the root, where each call is\n // one descriptor-relative, no-follow request and a symlink anywhere on the\n // path is refused rather than followed. `prepare` and `settle` only read,\n // and keep the caller's filesystem.\n const replayRoot = KernelFileSystem.confinedRoot(fs) ?? options.root ?? \".\"\n const replayHost: Effect.Effect<FileSystem.FileSystem, UnsupportedBoundary> = KernelFileSystem.isConfinable(fs)\n ? KernelFileSystem.confined(fs, replayRoot).pipe(\n Effect.provideService(Path.Path, platformPath),\n Effect.mapError(hostFailure)\n )\n : Effect.fail(\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message:\n \"cache replay needs a confined host filesystem; the host carries no descriptor-relative executor or isolation attestation\"\n })\n )\n const capture = Effect.fn(\"StepBoundary.capture\")(\n function*(path: string, inlineBudget: number, measured: BatchedDigest | undefined) {\n yield* Effect.annotateCurrentSpan({ path })\n // As in `measure`: the read reports absence itself, so the output is\n // captured in one host call rather than an `exists` probe plus a read.\n if (measured === undefined) {\n return { output: { path, digest: null } satisfies MaterializedOutput, inlinedBytes: 0 }\n }\n const bytes = measured.bytes\n if (bytes === undefined) return yield* Effect.fail(hostFailure(new Error(\"host omitted requested batch content\")))\n const digest = measured.digest\n // Inline only while both bounds hold (issue #122): the per-output bound\n // and the settle-wide aggregate budget the caller threads through.\n if (bytes.length <= maxInlineBytes && bytes.length <= inlineBudget) {\n return {\n output: {\n path,\n digest,\n sizeBytes: bytes.length,\n content: Base64.encode(bytes)\n } satisfies MaterializedOutput,\n inlinedBytes: bytes.length\n }\n }\n // Over the inline bound: the payload goes to the content-addressed\n // artifact store and the persisted row carries only the reference. Every\n // property that used to live here — atomic publication, verify-once\n // dedupe, healing rewrite of a corrupt address — is now the store's, and\n // is tested there (`@smthrs/artifacts`).\n const stored = yield* artifacts.put(bytes).pipe(Effect.mapError(artifactFailure))\n if (stored !== digest) {\n return yield* Effect.fail(\n new BoundaryCorruption({\n code: \"boundary_corruption\",\n path,\n recordedDigest: `${stored}`,\n measuredDigest: digest\n })\n )\n }\n return { output: { path, digest, sizeBytes: bytes.length } satisfies MaterializedOutput, inlinedBytes: 0 }\n }\n )\n const materialize = Effect.fn(\"StepBoundary.materialize\")(function*(\n host: FileSystem.FileSystem,\n output: MaterializedOutput\n ) {\n yield* Effect.annotateCurrentSpan({ path: output.path })\n // The filesystem is the cheapest source of truth for a warm workspace.\n // Probe before decoding inline bytes or consulting the artifact store; a\n // transient probe refusal merely forfeits the optimization and the\n // ordinary materialization path retains its existing typed failures.\n const current = yield* measure(output.path, host).pipe(\n Effect.map((digest) => digest !== absentDigest && digest === output.digest),\n Effect.catch(() => Effect.succeed(false))\n )\n if (current) return\n let bytes: Uint8Array\n if (output.content !== undefined) {\n const decoded = Base64.decode(output.content)\n if (Result.isFailure(decoded)) {\n // Inline content is cache-origin bytes: an undecodable payload is a\n // tampered durable row, classified exactly like a digest mismatch so\n // the caller routes it to the Inconsistency receiver instead of\n // retrying it as a transient host refusal (issue #159).\n return yield* Effect.fail(inlineCorruption(output.path, `${output.digest}`))\n }\n bytes = decoded.success\n // Inline evidence is verified here because nothing else can: the bytes\n // travel inside the row rather than at a content address. A referenced\n // artifact is verified by the store on the way out, so the check below\n // would be a second read+hash of the same bytes.\n const measured = yield* Schema.decodeUnknownEffect(Sha256)(bytes).pipe(Effect.orDie)\n if (measured !== output.digest) {\n return yield* Effect.fail(\n new BoundaryCorruption({\n code: \"boundary_corruption\",\n path: output.path,\n recordedDigest: `${output.digest}`,\n measuredDigest: measured\n })\n )\n }\n } else {\n bytes = yield* artifacts.get(`${output.digest}`).pipe(\n Effect.catchTags({\n // A reference this host cannot resolve is not a host refusal: a\n // shared artifact tier may still hold it, so the caller gets a\n // typed, repairable failure and fetches before falling back to a\n // real execution (issue #172).\n \"@smthrs/artifacts/ArtifactMissing\": (missing) =>\n Effect.fail(\n new MissingArtifact({ code: \"missing_artifact\", path: output.path, digest: missing.digest })\n ),\n // Corruption is a distinct typed failure from a transient host\n // error (issue #150): the caller routes it to the Inconsistency\n // receiver instead of treating it as an ordinary retryable refusal.\n \"@smthrs/artifacts/ArtifactCorruption\": (corrupt) =>\n Effect.fail(\n new BoundaryCorruption({\n code: \"boundary_corruption\",\n path: output.path,\n recordedDigest: corrupt.recordedDigest,\n measuredDigest: corrupt.measuredDigest\n })\n ),\n \"@smthrs/artifacts/ArtifactStoreError\": (failure) => Effect.fail(artifactFailure(failure))\n })\n )\n }\n // The original body may have created the output's directory itself; a\n // fresh workspace replaying the evidence has no such directory and\n // `writeFile` does not create parents (issue #107).\n const parent = parentDirectory(output.path)\n if (parent !== undefined) {\n yield* host.makeDirectory(parent, { recursive: true }).pipe(Effect.mapError(hostFailure))\n }\n yield* host.writeFile(output.path, bytes).pipe(Effect.mapError(hostFailure))\n })\n return make({\n prepare: Effect.fn(\"StepBoundary.prepare\")(function*(descriptor) {\n const boundary = FileBoundarySnapshot.make(descriptor)\n yield* Effect.annotateCurrentSpan({\n reads: boundary.readSet.length,\n boundaryMode: boundary.boundaryMode\n })\n // The dirty check's evidence (issue #90): what the host actually\n // measured for every declared read, never the declaration itself —\n // defaulting the snapshot to the declaration made `readSetMatches`\n // compare the declaration against itself and pass unconditionally\n // (issue #104).\n const readSnapshot: Array<FileInput> = []\n const paths: Array<string> = []\n for (const entry of boundary.readSet) {\n if (FileSet.isGlob(entry)) {\n paths.push(...yield* expandGlob(entry))\n } else paths.push(entry.path)\n }\n const measured = yield* measurements(paths, false)\n for (const [index, path] of paths.entries()) {\n readSnapshot.push({ path, digest: measured[index]?.digest ?? absentDigest })\n }\n readSnapshot.sort((left, right) => compareText(left.path, right.path))\n return Object.freeze({\n descriptor: boundary,\n readSnapshot: Object.freeze(readSnapshot.map((entry) => Object.freeze({ ...entry })))\n })\n }),\n settle: Effect.fn(\"StepBoundary.settle\")(function*(prepared) {\n yield* Effect.annotateCurrentSpan({\n writes: prepared.descriptor.writeSet.length,\n boundaryMode: prepared.descriptor.boundaryMode\n })\n // Undeclared-write detection is scoped to the declared read set: a\n // declared read whose content moved during the body and is not also a\n // declared write was mutated outside the contract. Whole-tree change\n // detection needs the jj diff surface and stays a documented\n // limitation of this layer rather than a silent pass — the read set\n // is exactly the material cacheability rests on.\n const removes = prepared.descriptor.removes ?? []\n const declaredWrites = [...prepared.descriptor.writeSet, ...removes]\n const declaredCovers = (path: string) =>\n declaredWrites.some((entry) =>\n typeof entry === \"string\"\n ? entry === path\n : entry._tag === \"TreeArtifact\"\n ? path === entry.path || path.startsWith(`${entry.path}/`)\n : FileSet.matchesGlob(entry, path)\n )\n const undeclared: Array<string> = []\n const checkedReads = prepared.readSnapshot.filter((entry) => !declaredCovers(entry.path))\n const currentReads = yield* measurements(checkedReads.map((entry) => entry.path), false)\n for (const [index, entry] of checkedReads.entries()) {\n if ((currentReads[index]?.digest ?? absentDigest) !== entry.digest) undeclared.push(entry.path)\n }\n const outputs: Array<MaterializedOutput> = []\n // Declared removals are captured on the same path and under the same\n // `digest: null` semantics they have always had — the difference is that\n // here the absence was declared, so it is evidence rather than a defect.\n const missing: Array<string> = []\n const surviving: Array<string> = []\n let inlinedBytes = 0\n const outputPaths: Array<string> = []\n const treeMembers: Array<{ readonly path: string; readonly files: ReadonlyArray<string> }> = []\n for (const entry of prepared.descriptor.writeSet) {\n if (typeof entry === \"string\") outputPaths.push(entry)\n else if (entry._tag === \"Glob\") outputPaths.push(...yield* expandGlob(entry))\n else {\n const files = (yield* treeEntries(fs, entry.path)).files\n outputPaths.push(...files)\n treeMembers.push({ path: entry.path, files })\n }\n }\n outputPaths.push(...removes)\n const captured = new Map<string, MaterializedOutput>()\n const sortedPaths = [...new Set(outputPaths)].sort(compareText)\n // Digest-only preflight bounds content batches by bytes as well as path\n // count. Both measurements share the guarded host's pinned root identity;\n // a rewrite between them is a refusal, never mismatched cached content.\n const sizes = batch === undefined ? undefined : yield* measurements(sortedPaths, false)\n for (let offset = 0; offset < sortedPaths.length;) {\n let end = offset\n let responseBytes = 256\n const size = batch?.maxSize ?? KernelFileSystem.fallbackConcurrency\n while (end < sortedPaths.length && end - offset < size) {\n const estimate = 4096 + new TextEncoder().encode(sortedPaths[end]).length * 6 +\n Math.ceil((sizes?.[end]?.sizeBytes ?? 0) / 3) * 4\n if (end > offset && batch !== undefined && responseBytes + estimate > batch.maxResponseBytes) break\n responseBytes += estimate\n end++\n }\n const group = sortedPaths.slice(offset, end)\n const contents = yield* measurements(group, true)\n for (const [index, path] of group.entries()) {\n const measured = contents[index]\n if (sizes !== undefined && measured?.digest !== sizes[offset + index]?.digest) {\n return yield* Effect.fail(hostFailure(new Error(`output changed during measurement: ${path}`)))\n }\n const output = yield* capture(path, maxTotalInlineBytes - inlinedBytes, measured)\n // `capture` reports the bytes it actually inlined (zero for a\n // digest-only reference), so the aggregate budget never has to\n // re-derive them from the row it just built.\n inlinedBytes += output.inlinedBytes\n outputs.push(output.output)\n captured.set(path, output.output)\n if (\n output.output.digest === null &&\n !removes.includes(path) &&\n prepared.descriptor.writeSet.some((entry) => typeof entry === \"string\" && entry === path)\n ) missing.push(path)\n // The dual check: a removal promised the path absent, and it is still\n // here — possibly rewritten. Settling it would cache the surviving\n // bytes under a declaration that disclaimed them.\n if (output.output.digest !== null && removes.includes(path)) surviving.push(path)\n }\n offset = end\n }\n // A tree member is already one of the captured outputs, so its identity\n // is folded from the digest that capture measured rather than from a\n // second read of the same bytes. `capture` spells an absent member\n // `null` where `measure` spells it `absentDigest`; the identity keeps\n // the `measure` spelling, so a tree recorded before this and one\n // recorded after hash identically.\n const trees: Array<{ readonly path: string; readonly identity: string }> = []\n for (const tree of treeMembers) {\n const pairs = tree.files.map((path) =>\n [path.slice(tree.path.length + 1), captured.get(path)!.digest ?? absentDigest] as const\n )\n trees.push({\n path: tree.path,\n identity: yield* Schema.decodeUnknownEffect(DerivedKey)({ kind: \"tree-artifact\", files: pairs }).pipe(\n Effect.orDie\n )\n })\n }\n // Through `DerivedKey` — the repo's one hashing chokepoint — so the identity is\n // a digest of the RFC 8785 canonical form rather than of whatever\n // `JSON.stringify` happened to emit for this shape.\n const diffIdentity = yield* Schema.decodeUnknownEffect(DerivedKey)({\n kind: \"diff-identity\",\n outputs: outputs.map((output) => [output.path, output.digest]),\n trees\n }).pipe(Effect.orDie)\n yield* Effect.annotateCurrentSpan({ diffIdentity })\n if (prepared.descriptor.boundaryMode === \"hard\") {\n if (undeclared.length > 0) {\n return yield* Effect.fail(\n new UndeclaredWrite({ code: \"undeclared_write\", paths: undeclared, diffIdentity })\n )\n }\n // A declared output that was never produced is a defect, not evidence\n // (Bazel's `checkOutputs`). Recording it would cache `digest: null`,\n // which every later `replayOutputs` reads as \"delete this path\".\n if (missing.length > 0) {\n return yield* Effect.fail(\n new MissingDeclaredOutput({ code: \"missing_declared_output\", paths: missing, diffIdentity })\n )\n }\n if (surviving.length > 0) {\n return yield* Effect.fail(\n new SurvivingDeclaredRemoval({ code: \"surviving_declared_removal\", paths: surviving, diffIdentity })\n )\n }\n }\n return {\n declaredOutputs: { outputs, ...(trees.length === 0 ? {} : { trees }) },\n diffIdentity,\n // This filesystem-only boundary cannot observe writes elsewhere in\n // the tree. Omission is deliberate: ActionPersistence treats the\n // result as run-local and will not publish it to the shared cache.\n //\n // An undeclared write is reported ahead of a missing output, and a\n // missing output ahead of a surviving removal: each is the stronger\n // claim about the same execution, and every variant bars the evidence\n // from the shared cache identically.\n ...(undeclared.length > 0\n ? { deviation: { _tag: \"ExpectedSetDeviation\" as const, paths: undeclared, diffIdentity } }\n : missing.length > 0\n ? { deviation: { _tag: \"MissingDeclaredOutput\" as const, paths: missing, diffIdentity } }\n : surviving.length > 0\n ? { deviation: { _tag: \"SurvivingDeclaredRemoval\" as const, paths: surviving, diffIdentity } }\n : {})\n }\n }),\n replayOutputs: Effect.fn(\"StepBoundary.replayOutputs\")(function*(evidence) {\n yield* Effect.annotateCurrentSpan({ diffIdentity: evidence.diffIdentity })\n const decoded = Schema.decodeUnknownResult(MaterializedOutputs)(evidence.declaredOutputs)\n if (decoded._tag === \"Failure\") {\n // Evidence recorded by a different boundary implementation carries\n // no materializable outputs; refusing is honest — the caller's\n // dispatch path falls back to a real execution or fails visibly.\n return yield* Effect.fail(\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message: \"the recorded boundary evidence carries no materializable outputs\"\n })\n )\n }\n // Replay writes and DELETES whatever the evidence names, so a path is\n // honored only in the coordinate system declarations are written in.\n // Evidence can arrive from a foreign producer through cache sync; an\n // absolute or upward spelling is an eraser aimed outside the workspace,\n // and refusing it here is what keeps that a refusal instead of a wipe.\n const foreign = [\n ...(decoded.success.trees ?? []).map((tree) => tree.path),\n ...decoded.success.outputs.map((output) => output.path)\n ].filter((path) => !FileSet.workspaceRelative(path))\n if (foreign.length > 0) {\n return yield* Effect.fail(\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message: `the recorded boundary evidence names paths outside the workspace: ${foreign.join(\", \")}`\n })\n )\n }\n // Before any mutation: a host that cannot be confined refuses the whole\n // replay, and the caller falls back to a real execution.\n const host = yield* replayHost\n const emptyDirectoryCandidates = new Set<string>()\n for (const tree of decoded.success.trees ?? []) {\n const prefix = `${tree.path}/`.replace(/\\/{2,}$/g, \"/\")\n const recorded = new Set(\n decoded.success.outputs\n .map((output) => output.path)\n .filter((path) => path.startsWith(prefix))\n )\n const entries = yield* treeEntries(host, tree.path)\n for (const path of entries.files) {\n if (!recorded.has(path)) yield* host.remove(path).pipe(Effect.mapError(hostFailure))\n }\n for (const directory of entries.directories) emptyDirectoryCandidates.add(directory)\n }\n for (const output of decoded.success.outputs) {\n if (output.digest === null) {\n // `force` IS the probe: the evidence says this path must not exist,\n // and a removal that finds it already gone has done its job. The\n // `exists` call that used to precede it was a second host call — a\n // second process on the confined host — for the same answer.\n yield* host.remove(output.path, { force: true }).pipe(Effect.mapError(hostFailure))\n } else {\n yield* materialize(host, output)\n }\n }\n // Remove only directories proven empty after pruning and\n // materialization. Deepest-first preserves every directory that still\n // contains a recorded child while clearing stale empty scaffolding.\n const directories = [...emptyDirectoryCandidates].sort((left, right) =>\n right.length - left.length || compareText(left, right)\n )\n for (const directory of directories) {\n const entries = yield* host.readDirectory(directory).pipe(Effect.mapError(hostFailure))\n if (entries.length === 0) yield* host.remove(directory).pipe(Effect.mapError(hostFailure))\n }\n })\n })\n}\n\n/**\n * Provides the filesystem-backed production boundary: `prepare` measures the\n * declared read set for real, `settle` detects reads mutated outside the\n * declared write set and captures the write set's post-state, and\n * `replayOutputs` re-materializes those outputs on cache-hit replay.\n *\n * Host access arrives through Effect's `FileSystem` tag, which the capability\n * kernel decorates in place — the same seam every host implementation (node,\n * bun, browser, sandbox) already provides. Blob storage arrives through\n * `@smthrs/artifacts`, so the same boundary runs over a purely local store or\n * over a local-plus-shared composition without knowing which it got.\n *\n * Replay confines its own mutations rather than trusting the composition:\n * they run through `@smthrs/kernel/FileSystem`'s `confined` view, rooted at\n * the kernel `Workspace` when one is in context. A symlink on a replayed path\n * (a parent, the final component, or a member of a replayed tree) and a host\n * with no descriptor-relative executor or isolation attestation both refuse\n * with {@link UnsupportedBoundary}, which the caller journals as\n * `replay_failed` before executing the step for real.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layer: Layer.Layer<\n Service,\n never,\n FileSystem.FileSystem | Path.Path | ArtifactStore.ArtifactStore\n> = Layer.effect(\n StepBoundary,\n Effect.gen(function*() {\n const fs = yield* FileSystem.FileSystem\n const platformPath = yield* Path.Path\n const artifacts = yield* ArtifactStore.ArtifactStore\n const workspace = yield* Effect.serviceOption(KernelWorkspace)\n return makeFileSystem(fs, platformPath, artifacts, workspace._tag === \"Some\" ? { root: workspace.value.root } : {})\n })\n)\n\n/**\n * What the deterministic test boundary should pretend the host observed.\n *\n * Every field is a fixture, not a classification rule: a test supplies settlement\n * evidence or failure, the read snapshot, and whether the host claims\n * to support the boundary at all — then asserts on the resulting evidence or\n * refusal. Defaults describe a well-behaved, fully-supported host.\n *\n * @since 0.1.0\n * @category models\n */\nexport interface TestOptions {\n /** A settlement failure supplied verbatim by an integration fixture. */\n readonly failure?: UndeclaredWrite | MissingDeclaredOutput | SurvivingDeclaredRemoval | undefined\n /** Settlement evidence supplied verbatim; classification belongs to the real layer. */\n readonly deviation?: BoundaryDeviation | undefined\n /**\n * What `prepare` reports as measured for the declared read set. Defaults\n * to the declaration itself; a test supplies a different snapshot to stand\n * for a file whose content moved out from under a stale declaration\n * (issue #90).\n */\n readonly readSnapshot?: ReadonlyArray<FileInput> | undefined\n /** The opaque replay payload recorded in the evidence. */\n readonly declaredOutputs?: unknown\n /** The post-state identity the evidence names. Defaults to a fixed string. */\n readonly diffIdentity?: string | undefined\n /** When false, every call fails with {@link UnsupportedBoundary}. Defaults to true. */\n readonly supported?: boolean | undefined\n /** Whether the fixture attests a whole-tree observation. Defaults to true. */\n readonly wholeTreeWriteDetection?: boolean | undefined\n /** Whether the fixture models an isolated read surface. Defaults to true. */\n readonly hermeticReadDetection?: boolean | undefined\n /** Observes each `replayOutputs` call, so a test can assert replay happened. */\n readonly onReplay?: (evidence: BoundaryEvidence) => void\n}\n\nconst unsupported = (): UnsupportedBoundary =>\n new UnsupportedBoundary({\n code: \"unsupported_boundary\",\n message: \"the host cannot enforce the declared step boundary\"\n })\n\n/**\n * Deterministic in-memory boundary suitable only for tests. Production\n * wiring uses {@link layer}, the filesystem-backed implementation.\n *\n * Whole-tree change detection is supplied by sandboxed settlement, not by any\n * boundary layer: an isolated execution's transaction IS the tree, so\n * `ActionPersistence` compares its diff against the declared sets and sets\n * `wholeTreeWritesVerified` structurally (the retired piece-6 limitation).\n * {@link layer} still detects mutations within the declared read set only,\n * which is why unsandboxed evidence stays run-local.\n *\n * @since 0.1.0\n * @category layers\n */\nexport const layerTest = (options: TestOptions = {}): Layer.Layer<Service> => {\n const diffIdentity = options.diffIdentity ?? \"test-diff\"\n const service = make({\n prepare: Effect.fn(\"StepBoundary.prepare\")(function*(descriptor) {\n if (options.supported === false) return yield* Effect.fail(unsupported())\n return {\n descriptor,\n readSnapshot: options.readSnapshot ?? exactReads(descriptor)\n }\n }),\n settle: Effect.fn(\"StepBoundary.settle\")(function*(prepared) {\n if (options.supported === false) return yield* Effect.fail(unsupported())\n if (options.failure !== undefined) return yield* Effect.fail(options.failure)\n return {\n declaredOutputs: options.declaredOutputs ?? { paths: prepared.descriptor.writeSet },\n diffIdentity,\n ...(options.wholeTreeWriteDetection === false ? {} : { wholeTreeWritesVerified: true as const }),\n ...(options.hermeticReadDetection === false ? {} : { hermeticReadsVerified: true as const }),\n ...(options.deviation === undefined ? {} : { deviation: options.deviation })\n }\n }),\n replayOutputs: Effect.fn(\"StepBoundary.replayOutputs\")(function*(evidence) {\n if (options.supported === false) return yield* Effect.fail(unsupported())\n yield* Effect.sync(() => {\n options.onReplay?.(evidence)\n })\n })\n })\n return Layer.succeed(StepBoundary, service)\n}\n"]}
|
|
@@ -41,7 +41,7 @@ import { CacheStore } from "@smthrs/step-cache";
|
|
|
41
41
|
import * as Effect from "effect/Effect";
|
|
42
42
|
import * as HashMap from "effect/HashMap";
|
|
43
43
|
import * as HashSet from "effect/HashSet";
|
|
44
|
-
import * as SqlClient from "effect/
|
|
44
|
+
import * as SqlClient from "effect/sql/SqlClient";
|
|
45
45
|
/**
|
|
46
46
|
* The journal event type the fold reads.
|
|
47
47
|
*
|
|
@@ -144,5 +144,5 @@ export declare const rebuild: () => Effect.Effect<{
|
|
|
144
144
|
admitted: number;
|
|
145
145
|
retired: number;
|
|
146
146
|
heads: number;
|
|
147
|
-
}, import("effect/
|
|
147
|
+
}, import("effect/sql/SqlError").SqlError | CacheStore.CacheStoreError | Journal.JournalError, SqlClient.SqlClient | import("@smthrs/database/DurableWriter").DurableWriter | Journal.Journal>;
|
|
148
148
|
//# sourceMappingURL=StepCacheFold.d.ts.map
|