Skip to content

Historical replay and forward effects

Historical replay reconstructs a fact that already happened. It must preserve the entities, relationships and evidence implied by that fact while suppressing operations that would announce or perform it again. Import mode is a specific transaction context, not a general permission bypass.

The accepted import ADR explains the rule; the current runbook and active guards own the executable procedure. A historical receipt or a new handbook article does not authorize running a backfill against shared data.

Mechanism Intended effect Limit
Transaction-local toolora.import_mode Mark the current transaction as replaying history Does not persist as a browser permission or general session-wide exemption
Specific immutability guard branches Permit the named legitimate historical repair Other frozen fields and relationships retain their constraints
Quote-acceptance notification guard Suppress new customer-notification intent for historical acceptance Every new replay path must preserve that suppression
Historical evidence marker Independent historical signal checked by notification logic A marker is not proof that the acceptance itself was valid
Append-only acceptance evidence Retain recorded historical snapshots UPDATE/DELETE are not opened merely by import mode
Imported time origin Prevent historical approvals entering native automatic payroll Status text alone does not become fresh attestation
Import job state Track queued/running/succeeded/failed execution Succeeded is not complete identity/value reconciliation

The flag is raised by an authorized direct-connection transaction or an owning RPC that sets it locally for itself. It is not a PostgREST request option that a browser may attach to arbitrary writes. Its exact effect is the set of guard branches that read it, not whatever an importer hopes it means.

Reconstruct before recording irreversible evidence

Section titled “Reconstruct before recording irreversible evidence”

The operating contract orders dependent work: version lines and project/source links must be established before historical acceptance. Otherwise the system can record an immutable snapshot of incomplete rows or create a duplicate project for work already represented.

A source response value and a send-state label are also different facts. The inspected legacy tender path refuses acceptance-like input before mutation. The supported version-aware path plans and checks source/project evidence rather than promoting any old accepted string into a native agreement. Source identities explains which version must survive.

A sent quote’s description has only a narrow historical empty-field repair path. That exception does not authorize rewriting a nonempty customer’s accepted text. Similarly, retaining an issued invoice snapshot under import rules must not manufacture a current customer or payment fact.

A newly accepted quote can legitimately create notification intent. Replaying an old acceptance must create none. Background outcomes separates intent, processing and receipt; a worker draining a wrongly created outbox would turn an import error into a real message.

The payroll path makes the same distinction. Imported time can carry historical status, but an external source ID or import origin excludes it from native automatic handoff. A genuine backoffice attestation can autoqueue when the gate and mappings pass. Disabling a scheduler is not a substitute for correct origin rules, because queued work may run later.

The generic dispatcher can process records across several transactions and store progress/errors. It is not an all-or-nothing transaction for an entire source corpus. Partial failure needs source-level reconciliation before deciding what to replay.

A synthetic job from 2022 has a sent quote version, accepted rows and an existing project. A controlled reconstruction preserves those IDs and snapshot relationships. It does not email the customer in 2026, allocate a new project merely because a link was missing, or queue payroll from imported approved time.

If version rows are missing, the correction is to establish the source evidence through the owning procedure before recording irreversible acceptance. It is not to bypass the guard or fill the snapshot from current working-copy text.

Deterministic tests assert legacy refusal and imported-time no-autoqueue using substitutes. Database tests establish actual guard/append-only behaviour when executed. A real import change additionally requires authorized before/after reconciliation. This documentation pass runs no source replay or customer notification.