oficina / memoria Public

Clone
git clone https://amadan.net/oficina/memoria

Plain git — no account needed to clone.

Download

Download this file

Delegated note retry and authority hardening

Status: implementation design approved by GPT-6 Astra on 2026-10-25 after reviewing the existing Memoria, Calendar and Calls adapters. Source review, CI and deployed canary verification remain separate requirements.

Persist a keyed receipt-authority marker binding the content fingerprint key, exact Home issuer, delegation issuer and selected team. Initialize under the SQLite writer reservation only if receipt and attribution state is empty. Check on enablement and every mutation before receipt lookup. Existing receipt state without the marker requires explicit migration; do not bless, erase or reset it. Include both issuers in new receipt coordinates.

The HTTP adapter supplies a private context callback using only the original credential's underlying verifier. Compare subject, client, grant and required team/scope. Never invoke local-DB/rate-limit middleware from inside the writer transaction. Check delegation and the existing local Home link/admission using the reserved transaction, then repeat before every successful commit, including retry exits. An absent callback fails closed on agent mutations. Reject malformed Unicode before lossy decoding.

Memoria's current Ingest is an upsert. A guard alone cannot make pending receipt recovery safe: after body commit but before receipt completion, retrying that upsert can overwrite intervening edits or recreate a deleted note. The delegated creation path must commit the document/chunks and receipt document ID together. Keep public Ingest behavior; factor its transaction body into an inner function surrounded by private required agent hooks. All early successes pass the final hook. The before hook reserves the writer, validates marker and authority, claims and rereads the receipt. Completed receipts skip ingestion entirely, check the referenced document still exists, and preserve current edits/revision. Deletion returns not_found. For an incomplete receipt, refuse if source/key already exists; agent creation must never upsert even matching content.

Indexing remains derived postcommit work. Preserve committed IDs on index failure. A skipped ingestion does not prove indexing succeeded. Any repair uses current stored content, never the old request body. Keep indexed false until indexing actually succeeds; no success-looking result for a deleted document.

Test crash/reopen at receipt/body/index boundaries, independent concurrent requests, deletion and edits before retry, orphan source/key refusal, changed key/authority refusal, and revocation while waiting for the writer and just before commit. Adverse mutations must fail meaningful behavior tests. Source approval and checks do not claim a deployed canary.

The same immutable-marker and writer-boundary pattern applies to Calendar and Calls in their own adapters. Existing direct Registry.HTTP read emission remains a separate response-revalidation gap; this write-hardening slice does not claim Docs-equivalent response guards or full suite completion.