00 · Record
One command, one atomic transaction.
Dana’s placement records who acted, a command ID that makes retries safe, a correlation ID, and the release that governed the write. The constraints come from that same release and are checked in the same transaction.
Nothing is overwritten. The auditor’s correction retracts the old belief and asserts the new one, and the journal keeps both.
Transactions and the journal// One application command is one atomic transaction that records who acted,
// which command it was, and the release whose rules it was checked against.
export const placeWorker = (release: InMemoryConfigStore.ConfigSnapshot) =>
Effect.gen(function* () {
const triples = yield* Triples;
const rules = yield* GraphConstraint.collect(release.root);
return yield* triples.transact(
[
{
op: "assert",
entityId: placement,
entityType: "Placement",
...Placement.attributes.worker.assertion(maria, { validFrom: MAR_2 }),
},
{
op: "assert",
entityId: placement,
entityType: "Placement",
...Placement.attributes.site.assertion(harbor, { validFrom: MAR_2 }),
},
],
{
actor: "user:dana",
commandId: "placement:create:maria-harbor", // unique: a retry can never apply twice
correlationId: "request:7f3a",
configSnapshot: release.id, // the rules this write was governed by
enforce: GraphConstraint.enforcement(rules), // required/unique/ref checks, atomically
},
);
});