diff --git a/.github/ci/integration-paths.txt b/.github/ci/integration-paths.txt index 6390cffc1..10b2c0685 100644 --- a/.github/ci/integration-paths.txt +++ b/.github/ci/integration-paths.txt @@ -93,3 +93,4 @@ src/tests/adapters/test_minio_corpus_lock_loss.py src/tests/adapters/test_minio_corpus_publication.py src/tests/adapters/test_minio_corpus_forget.py src/tests/adapters/test_minio_corpus_consumption.py +src/tests/adapters/test_minio_storage_capture.py diff --git a/.github/ci/unit-paths.txt b/.github/ci/unit-paths.txt index ce015d291..4850068c2 100644 --- a/.github/ci/unit-paths.txt +++ b/.github/ci/unit-paths.txt @@ -176,3 +176,4 @@ src/tests/adapters/test_object_operations.py src/tests/surfaces/test_pagination_documentation.py src/tests/adapters/test_mount_provisioning.py src/tests/benchmarks/test_locomo_corpus_attestation.py +src/tests/spine/test_storage_capture_profile.py diff --git a/docs/development/storage-capture-managed-assembly.md b/docs/development/storage-capture-managed-assembly.md index 3f43b61a2..b394d99a1 100644 --- a/docs/development/storage-capture-managed-assembly.md +++ b/docs/development/storage-capture-managed-assembly.md @@ -108,18 +108,70 @@ The typed current profile/source mapping is in source-rule technical approval is recorded in [the implementation analysis](../../plan/analysis/managed_storage_profile_20261111.md). It is not production scope/clock/cost qualification. The assembler matches -native references, hash-bound conversion artifacts, immutable P3 manifests and +native references, hash-bound conversion artifacts, D155 live corpus folders and all provider items in both directions, preserving actual zero, failed raw originals, excluded exposure and committed terminal members. Unknown ownership, unsupported K/link/legacy projection state or missing evidence refuses. +Corpus classification requires the served reading's publication marker to equal +its current DB-input/default-policy digest and `corpus_paths` to contain exactly +that desired folder. Known original copies and reader derivatives count in +`p3_origin`, separately from canonical raw originals. Shared navigation counts +there too; incomplete/orphan folders are excluded staging. Unknown corpus keys +refuse completion. Corpus originals, derivatives and navigation have separate +native classes using the existing `projection_origin` purpose. Capture reads no +snapshot registry or mutable corpus manifest. The native guard and reader require +exact schema head `p9_52_0073`. The historical snapshot relation remains because +`/operations.latest_projections` still reads it; no migration or public API change +is part of this classification update. + +Regenerate the synthetic regression documents with +`PYTHONPATH=src:. python scripts/generate_storage_capture_fixture.py` and check +them with the same command plus `--check`. The fixture contains the current +catalog/record schemas, source/schema/native profile digests, class rules, +classification digest and operator mapping. It makes no deployment qualification +claim and does not replace the dated receipts below. The real PostgreSQL/MinIO +classification suite is `src/tests/adapters/test_minio_storage_capture.py`. + +When `writeitai/ultimate-memory-cloud` pins this engine: + +- Rebuild the pinned engine/runtime artifacts and update `runtime/engine.lock`. + Regenerate the native source, expected schema definition/profile and native + qualification/profile preimages for `p9_52_0073`, including the new corpus + page and `spine/corpus_export.py`'s served selector, plus + `core/corpus_export.py`'s builder policy, reader-kind registry, original naming + and revision function and `model/conversion.py`'s asset-name contract. The + source artifact pin must cover their dependency closure. Regenerate the managed + runtime source digest and producer identity at that actual engine/image pin. +- Feed the resulting `NativeCaptureProfile` and existing provider/clock/run + bounds into `runtime/src/umc_runtime/storage_capture_profile.py`'s + `managed_capture_profile`. Let the engine builder regenerate each deployment's + classification, operator mapping and request identities; register/accept those + exact new profiles in the receiver. Existing completed captures retain their + original bytes and identities. This engine fixture's synthetic hashes are + test inputs and must never be installed as deployment pins. +- Reinstall **both** `install_native_relation_guard` and + `install_native_capture_catalog` on each migrated Project DB under the existing + restricted roles. The fixed catalog now pins `documents`, versions, metadata + and sections in addition to its previous E0 relations, reads the same served + selection as publication, and ignores historical projection rows. Requalify + installed function bytes/owners/search paths/ACLs, original-view timing and + nonempty live-tree quantities before accepting new chargeable evidence. +- Keep the existing `raw`, `artifacts`, `corpus`, `forget` store bindings and + `capture_storage_batch` call. No new store role, runtime callback, corpus + manifest reader, scheduler or wire purpose/component is required. The three + new included native classes use `projection_origin`/`p3_origin`; the incomplete + class maps to excluded `staging`. Provider, clock and resource bounds require + renewed acceptance only according to their actual qualification evidence, + never merely because source hashes were regenerated. + Completed results expose `manifest`, `native_witness`, `provider_manifest` and `iter_page_bytes()` from the required durable store. Lost delivery replays those exact completed bytes without reopening a native/provider cut. The final manifest is written only after all pages and original evidence are durable. ACK checking and financial settlement remain independent existing contracts. -The checked implementation source is `52d6c2767`. Its actual composed native +The historical 2026-11-11 validation used source `52d6c2767`. Its composed native run and exact quantities are recorded in the [dated validation receipt](storage-capture-managed-assembly-validation-20261111.json). The run recorded two scopes at one cut, one provider invocation and the same actual S3 provider. Canonical-object quantities were 0 and 18 bytes. It recorded diff --git a/docs/development/storage-capture-original-view.md b/docs/development/storage-capture-original-view.md index 99e25e868..b4b3b1d84 100644 --- a/docs/development/storage-capture-original-view.md +++ b/docs/development/storage-capture-original-view.md @@ -68,13 +68,13 @@ private schema must be pinned by the qualified native profile. `iter_store_references` reads actual catalog locator seeds without live/current or success-only filters: raw objects; all five representation URI fields; -structure sidecars; supplied reference artifacts; projection trees; K page and +structure sidecars; supplied reference artifacts; K page and curation paths; K planner/compiler transcripts; and every native forget intent, including `preparing`. A forget seed carries its actual UUID with `locator_kind=journal_intent`; the qualified journal adapter derives its concrete key and proves stored presence. PostgreSQL alone cannot assert the ObjectStore or LocalFS journal layout. Native content identities and locators use private fields with -suppressed repr/validation inputs. Trees, manifests, K origin/history and +suppressed repr/validation inputs. Manifests, K origin/history and unmatched store resources still require the engine's qualified store profile and complete provider evidence. A locator seed is neither a provider item nor a publishable storage member. Missing lengths remain unknown; reference @@ -88,6 +88,14 @@ receipt digest. Post-cut rows and ACK changes cannot alter this original view. Both iterators use fixed keyset pages of at most 1,024 rows, with no later pool or caller-supplied SQL. +`iter_corpus_documents` uses the same original view and page bound. It returns +each document's recorded cleanup folders, including deleted/unselected rows, +and its nullable served-reading inputs. The classifier recomputes the current +D155 publication revision before expanding reader-file references. Paths alone +do not prove publication; no snapshot registry is consulted. All selector joins +are pinned with AccessShare during acquisition. Both helpers require exact +schema head `p9_52_0073`. + The first native run exposed a real integration boundary: the guard's native index exclusions hold AccessExclusive on `deployments_pkey`. Reading public deployment/configuration rows under that guard tried to read the locked index diff --git a/plan/analysis/live_corpus_storage_capture_20261114.md b/plan/analysis/live_corpus_storage_capture_20261114.md new file mode 100644 index 000000000..bffe3c35f --- /dev/null +++ b/plan/analysis/live_corpus_storage_capture_20261114.md @@ -0,0 +1,47 @@ +# D155 live corpus capture classification + +D152 capture still expanded retired immutable projection manifests after D155 +replaced that writer with a mutable document tree. A folder's presence in +`documents.corpus_paths` proves only that publication might have written it: +the set is committed before IO and retained across failed moves and cleanup. +Treating every recorded prefix as published would count incomplete copies. + +The existing served-reading selector supplies all DB inputs to +`desired_export_revision`. Read those inputs and every document's recorded paths +through the original bounded native capture view. Require the current marker +to match that revision and the recorded set to contain exactly the desired +folder. Expand its known reader files from the hash-bound immutable conversion +inventory. Do not read mutable corpus `document.json` as publication authority. +Missing required files refuse completion. Other files beneath a valid D155 +suffix folder are staging, including unrecorded paths, deleted/forgotten +documents and interrupted publication. Unknown keys outside the writer grammar +refuse capture instead of inheriting an inclusion rule. + +Limit the document page before joining served inputs and seek using the native +UUID index, so advancing a page does not rescan all earlier UUID text values. +The first page includes UUID zero; subsequent pages exclude their cursor row. + +Retain D152's purpose/component vocabulary: separate native classes identify +corpus original copies, derivatives and navigation, all `projection_origin` in +`p3_origin`. Raw originals remain `canonical_raw` in `canonical_object`. Thus +equal payloads at different physical keys remain different resources and +corpus copies never inflate canonical-original quantities. Shared navigation +uses the current type/topic/radix grammar; an incomplete document's own index +is staging with the rest of that folder. + +Alternatives rejected: snapshot-manifest support would preserve a second +classifier without a writer; prefix-only attribution would bill partial writes; +trusting a non-null marker without recomputing its input identity would accept +stale metadata or policy; introducing a publication table or counter duplicates +D155's existing inputs and marker. D155's accepted late-request repair race +remains: the marker proves a successful publication of these inputs, not an +atomic or byte-immutable tree. Provider evidence owns existence, version and +quantity at the requested cut; current listings supply private names only. + +`projection_snapshots` is still read by `OperationalCatalog.inspect` for the +historical `/operations.latest_projections` field. Retain that relation and its +PostgreSQL allocation rule; remove it from the capture reader's extraction +locks and locator reads. No migration or API export change is needed. Pin both +native capture helpers to the actual `p9_52_0073` head, without an old-head +fallback. Generated regression profiles are synthetic inputs, never operator +clock, provider, image or cost qualification. No paid-work identity changes. diff --git a/plan/analysis/managed_storage_profile_20261111.md b/plan/analysis/managed_storage_profile_20261111.md index 51032566a..b871e4682 100644 --- a/plan/analysis/managed_storage_profile_20261111.md +++ b/plan/analysis/managed_storage_profile_20261111.md @@ -83,6 +83,10 @@ non-null native repository URI. A zero K component still requires that closed runtime source/configuration and the complete original native inventory; loading `knowledge_repository=unconfigured` is no absence proof. +The snapshot classification in the next paragraph is historical and superseded +by [D155 live-tree classification](live_corpus_storage_capture_20261114.md). +The PostgreSQL snapshot relation remains only for the historical operations API. + P3 cannot be blanket-declared absent: managed `umc_runtime/setup.py:run_setup` calls `SelfHostProfile.setup`, whose facts-layer reconciliation can call `run_projection(p3)` (`profiles/selfhost.py`, around lines 1241–1244). The diff --git a/plan/designs/storage_capture_consumer_design.md b/plan/designs/storage_capture_consumer_design.md index b1450e64e..20de034cf 100644 --- a/plan/designs/storage_capture_consumer_design.md +++ b/plan/designs/storage_capture_consumer_design.md @@ -214,6 +214,21 @@ excluded operator resources or suppress their cost. A mixed physical root without an accepted exact mapping yields no chargeable component result. The captured allocation/purpose remains evidence; it is not zero. +Under D155, corpus capture reads `documents.corpus_paths` and the served +reading's publication inputs in the original native view. A recorded folder is +only a cleanup target until its nullable marker matches the current export +revision and its recorded set is exactly the desired folder. Expand known +original/derivative files through the hash-bound immutable E0 inventory; never +use mutable corpus metadata as publication authority. Separate native classes +identify corpus original copies, derivatives and navigation (`projection_origin`, +`p3_origin`), while canonical raw originals remain `canonical_raw` in +`canonical_object`. Shared type/topic/radix `_index.md` and root `llms.txt` are +navigation. Other objects beneath D155 document folders, including stale, +updating, deleted/forgotten and unrecorded folders, are excluded `staging`. +Unknown keys outside that writer grammar refuse completion. The marker retains +D155's once-published meaning and accepted late-request repair race, rather +than asserting a whole-tree snapshot. [Classification rationale](../analysis/live_corpus_storage_capture_20261114.md). + Serving a durable P3 origin in place does not create another physical copy. An additional staging/served tree is a distinct operator replica. Distinct raw/artifact and P3 objects stay distinct resources even when their payloads diff --git a/scripts/generate_storage_capture_fixture.py b/scripts/generate_storage_capture_fixture.py new file mode 100644 index 000000000..f2e988002 --- /dev/null +++ b/scripts/generate_storage_capture_fixture.py @@ -0,0 +1,143 @@ +"""Generate synthetic D152 regression pins; never deployed qualification. + +Run with the engine environment and PYTHONPATH=src:. --check compares exact +bytes. Operator source/image/clock/cost acceptance remains separate. Historical +dated production/functional receipts are evidence and are never regenerated. +""" + +from __future__ import annotations + +import argparse +import base64 +import hashlib +import json +from pathlib import Path + +from alembic.config import Config +from alembic.script import ScriptDirectory + +from rememberstack.profiles.storage_capture_profile import build_managed_storage_profile +from rememberstack.profiles.storage_capture_profile import current_class_rules +from rememberstack.profiles.storage_capture_profile import ManagedFilesystemBinding +from rememberstack.profiles.storage_capture_profile import ManagedStoreBindings +from rememberstack.spine import catalog_contract +from rememberstack.spine.storage_capture_catalog import NativeCatalogAcquisition +from rememberstack.spine.storage_capture_catalog import NativeCorpusPage +from rememberstack.spine.storage_capture_catalog import NativeReferencePage +from rememberstack.spine.storage_capture_catalog import NativeTerminalPage +from rememberstack.spine.storage_capture_guard import _EXTENSIONS +from rememberstack.spine.storage_capture_guard import _ROOTS +from rememberstack.spine.storage_capture_guard import NativeRelationGuardSample +from rememberstack.spine.storage_capture_view import NativeCaptureProfile + +ROOT = Path(__file__).resolve().parents[1] +FIXTURE = ROOT / "src/tests/fixtures/storage_capture/live_corpus_profile.json" + + +def _digest(domain: str, document: object) -> str: + body = json.dumps( + document, sort_keys=True, ensure_ascii=True, separators=(",", ":") + ).encode() + return hashlib.sha256(domain.encode() + b"\0" + body).hexdigest() + + +def capture() -> dict[str, object]: + """Derive schema, source, classification, mapping and native test pins.""" + source = { + str(path.relative_to(ROOT)): hashlib.sha256(path.read_bytes()).hexdigest() + for path in sorted((ROOT / "src/rememberstack").rglob("*.py")) + } + schema = { + "head": ScriptDirectory.from_config( + Config(str(ROOT / "alembic.ini")) + ).get_current_head(), + "catalog": { + name: getattr(catalog_contract, name) + for name in sorted(vars(catalog_contract)) + if name.startswith("EXPECTED_") + }, + "guard_roots": _ROOTS, + "extensions": _EXTENSIONS, + "migrations": { + path.name: hashlib.sha256(path.read_bytes()).hexdigest() + for path in sorted( + (ROOT / "src/rememberstack/spine/migrations/versions").glob("*.py") + ) + }, + "records": { + model.__name__: model.model_json_schema() + for model in ( + NativeRelationGuardSample, + NativeCatalogAcquisition, + NativeReferencePage, + NativeCorpusPage, + NativeTerminalPage, + ) + }, + } + schema_digest = _digest("rememberstack.test_schema.v1", schema) + native_inputs = { + "source_digest": _digest("rememberstack.test_engine_source.v1", source), + "schema_digest": schema_digest, + "schema_profile_digest": _digest( + "rememberstack.test_schema_profile.v1", schema + ), + "clock_profile_digest": "5" * 64, + "clock_error_us": "1000", + "view_lifetime_ms": 30_000, + "release_margin_us": 500_000, + } + native = NativeCaptureProfile( + profile_digest=_digest("rememberstack.test_native_profile.v1", native_inputs), + **native_inputs, # type: ignore[arg-type] + ) + bindings = ManagedStoreBindings( + deployment_id="0" * 31 + "1", + postgres_database_name="rememberstack", + provider_organisation_id="1" * 32, + provider_cell_id="synthetic-cell", + filesystems=tuple( + ManagedFilesystemBinding( + role=role, + filesystem_id=base64.b32encode(bytes([number]) * 16) + .decode() + .rstrip("=") + .lower(), + ) + for number, role in enumerate(("artifacts", "corpus", "forget", "raw")) + ), + ) + profile = build_managed_storage_profile( + native=native, + bindings=bindings, + managed_runtime_source_digest="6" * 64, + provider_profile_digest="a" * 64, + provider_clock_profile_digest="b" * 64, + ) + return { + "kind": "synthetic_live_corpus_regression_not_deployment_qualification", + "schema": schema, + "profile": profile.model_dump(mode="json"), + "request": profile.request(cut_at_unix_us="1800000000000000").model_dump( + mode="json" + ), + "source_rules": current_class_rules(), + } + + +def render() -> str: + return json.dumps(capture(), indent=2, sort_keys=True, ensure_ascii=True) + "\n" + + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--check", action="store_true") + args = parser.parse_args() + body = render() + if args.check: + if FIXTURE.read_text() != body: + raise SystemExit( + "storage capture regression fixture is stale; run its generator" + ) + else: + FIXTURE.write_text(body) diff --git a/src/rememberstack/core/corpus_export.py b/src/rememberstack/core/corpus_export.py index 2b82b73c3..3e4a7157c 100644 --- a/src/rememberstack/core/corpus_export.py +++ b/src/rememberstack/core/corpus_export.py @@ -421,25 +421,6 @@ def render_document( "files": inventory, **disclosure, } - entries = [ - _Member( - key="a:" + hashlib.sha256(file.path.encode()).hexdigest(), - title=file.path, - target=file.path, - count=1, - details=(file.kind, file.sha256), - ) - for file in copies - ] - entries.append( - _Member( - key="a:metadata", - title="document.json", - target="document.json", - count=1, - details=("reader inventory", ""), - ) - ) intro = [ f"# {_cell(document.display_title)}", "", @@ -459,8 +440,10 @@ def render_document( "[Parent](../_index.md)", "", ] - indexes = _render_pages( - "", entries, ("File", "Kind", "SHA-256"), policy.member_limit, intro=intro + indexes = render_document_indexes( + ((file.path, file.kind, file.sha256) for file in copies), + intro=intro, + policy=policy, ) generated = ( GeneratedFile("document.json", json_bytes(metadata)), @@ -469,6 +452,37 @@ def render_document( return DocumentExport(document, revision, (*copies, *generated)) +def render_document_indexes( + files: Iterable[tuple[str, str, str]], + *, + intro: Iterable[str] = (), + policy: CorpusPolicy = DEFAULT_CORPUS_POLICY, +) -> dict[str, bytes]: + """Page (path, kind, SHA-256) rows; paths alone determine page membership.""" + entries = [ + _Member( + key="a:" + hashlib.sha256(path.encode()).hexdigest(), + title=path, + target=path, + count=1, + details=(kind, sha256), + ) + for path, kind, sha256 in files + ] + entries.append( + _Member( + key="a:metadata", + title="document.json", + target="document.json", + count=1, + details=("reader inventory", ""), + ) + ) + return _render_pages( + "", entries, ("File", "Kind", "SHA-256"), policy.member_limit, intro=list(intro) + ) + + @dataclass(frozen=True) class _Member: key: str diff --git a/src/rememberstack/profiles/managed_storage_capture.py b/src/rememberstack/profiles/managed_storage_capture.py index b0c8a2d3a..7483c0b40 100644 --- a/src/rememberstack/profiles/managed_storage_capture.py +++ b/src/rememberstack/profiles/managed_storage_capture.py @@ -36,6 +36,13 @@ from rememberstack.adapters.fsit_storage_capture import ProviderManifest from rememberstack.adapters.fsit_storage_capture import ProviderPage from rememberstack.adapters.fsit_storage_capture import ProviderRequest +from rememberstack.core.corpus_export import corpus_suffix +from rememberstack.core.corpus_export import CORPUS_TYPES +from rememberstack.core.corpus_export import desired_export_revision +from rememberstack.core.corpus_export import original_name +from rememberstack.core.corpus_export import PIPELINE_ASSET_KINDS +from rememberstack.core.corpus_export import READER_ASSET_KINDS +from rememberstack.core.corpus_export import render_document_indexes from rememberstack.core.storage_capture import capture_request_id from rememberstack.core.storage_capture import check_capture_encoding from rememberstack.core.storage_capture import iter_capture_pages @@ -44,6 +51,7 @@ from rememberstack.core.storage_capture import membership_set_digest from rememberstack.core.storage_capture import native_witness_digest from rememberstack.core.storage_capture import page_payload_digest +from rememberstack.model.conversion import AssetName from rememberstack.model.object_store import ObjectKey from rememberstack.model.storage_capture import StorageCaptureManifest from rememberstack.model.storage_capture import StorageCapturePage @@ -64,6 +72,7 @@ from rememberstack.profiles.storage_capture_profile import ( STORAGE_CAPTURE_PAGE_MEMBER_LIMIT, ) +from rememberstack.spine.storage_capture_catalog import NativeCorpusDocument from rememberstack.spine.storage_capture_catalog import NativeStoreReference from rememberstack.spine.storage_capture_view import NativeCapturedStorageView from rememberstack.spine.storage_capture_view import NativeStorageCaptureCatalog @@ -85,6 +94,12 @@ rf"{_UUID}/{_SHA}/{_UUID}/(?:document\.md|blocks\.json|conversion\.json|meta\.json|source_map\.json|media/.+)" ) _UPLOAD = re.compile(r"uploads/[A-Za-z0-9_-]{32}") +_SLUG = r"[a-z0-9]+(?:-[a-z0-9]+)*" +_CORPUS_PARENT = rf"(?:{'|'.join(CORPUS_TYPES)})(?:/{_SLUG}){{0,4}}" +_CORPUS_FOLDER = re.compile(rf"{_CORPUS_PARENT}/{_SLUG}--[0-9a-f]{{24}}") +_CORPUS_KEY = re.compile(rf"(?P{_CORPUS_FOLDER.pattern})/(?P.+)") +_CORPUS_NAVIGATION = re.compile(rf"(?:{_CORPUS_PARENT}/)?(?:~/[a-z2-7]+/)*_index\.md") +_ASSET_NAME = TypeAdapter(AssetName) class ManagedStorageCaptureUnavailable(RuntimeError): @@ -149,7 +164,6 @@ def __init__(self, *, path: Path) -> None: CREATE TABLE names(role TEXT,path TEXT,name TEXT,PRIMARY KEY(role,path)); CREATE TABLE refs(role TEXT,path TEXT,class TEXT,native_id TEXT,bytes TEXT, required INTEGER,matched INTEGER DEFAULT 0,PRIMARY KEY(role,path,class,native_id)); - CREATE TABLE p3(prefix TEXT,state TEXT,PRIMARY KEY(prefix)); CREATE TABLE resources(component TEXT,store TEXT,id TEXT,version TEXT,evidence TEXT,bytes TEXT, PRIMARY KEY(store,id,version)); CREATE TABLE members(kind TEXT,id TEXT,body TEXT,PRIMARY KEY(kind,id)); @@ -270,6 +284,10 @@ def capture_once( self._check_native_bindings(native=native) for seed in native.iter_store_references(): self._stage_seed(spool=spool, seed=seed, provider=provider) + for document in native.iter_corpus_documents(): + self._stage_corpus_document( + spool=spool, seed=document, provider=provider + ) for terminal in native.iter_terminal_members(): spool.member(member=terminal) self._stage_native_allocations( @@ -451,48 +469,6 @@ def _stage_seed( ) if seed.locator_kind == "journal_intent": key = "forget-manifests/" + key + ".json" - if seed.locator_kind == "tree": - spool.db.execute("INSERT INTO p3 VALUES(?,?)", (key, seed.native_state)) - if seed.native_state not in {"published", "superseded"}: - return - body = self._read_manifest( - spool=spool, - provider=provider, - role=role, - key=key + "/MANIFEST.json", - expected_digest=None, - ) - payload = json.loads(body) - if ( - set(payload) != {"version", "files"} - or payload["version"] != key.rsplit("/", 1)[-1] - or not isinstance(payload["files"], dict) - ): - raise ManagedStorageCaptureUnavailable("capture_p3_manifest_schema") - for name, digest in payload["files"].items(): - if not isinstance(name, str) or not _is_digest(value=digest): - raise ManagedStorageCaptureUnavailable("capture_p3_manifest_entry") - self._reference( - spool=spool, - provider=provider, - role=role, - key=key + "/" + name, - native_class=seed.native_class, - native_id=identifier + ":" + name, - recorded_bytes=None, - required=True, - ) - self._reference( - spool=spool, - provider=provider, - role=role, - key=key + "/MANIFEST.json", - native_class=seed.native_class, - native_id=identifier + ":manifest", - recorded_bytes=str(len(body)), - required=True, - ) - return self._reference( spool=spool, provider=provider, @@ -557,6 +533,74 @@ def _stage_seed( required=True, ) + def _stage_corpus_document( + self, *, spool: _Spool, seed: NativeCorpusDocument, provider: ProviderManifest + ) -> None: + """Bind completed copies to recorded paths AND current publication inputs. + + Cleanup paths alone never imply publication. An old folder, a cleared + or stale marker, or a deleted/unselected document leaves only staging. + Read the hash-bound immutable E0 inventory, never mutable document.json. + """ + document = seed.document + published = ( + document is not None + and document.doc_id == seed.doc_id + and seed.paths == (document.path,) + and document.corpus_published_revision == desired_export_revision(document) + ) + for path in seed.paths: + if not _CORPUS_FOLDER.fullmatch(path) or not path.endswith( + "--" + corpus_suffix(seed.doc_id) + ): + raise ManagedStorageCaptureUnavailable("capture_corpus_path_invalid") + if not published or document is None: + return + payload = json.loads( + self._read_manifest( + spool=spool, + provider=provider, + role="artifacts", + key=document.conversion_uri, + expected_digest=document.manifest_hash, + ) + ) + files = { + original_name(document.mime): "documents.corpus_original", + "document.md": "documents.corpus_derivative", + "pageindex.json": "documents.corpus_derivative", + "document.json": "documents.corpus_derivative", + } + if payload.get("source_map") is not None: + files["source_map.json"] = "documents.corpus_derivative" + for asset in payload["derived_assets"]: + name = _ASSET_NAME.validate_python(asset["name"]) + if asset["kind"] in PIPELINE_ASSET_KINDS: + continue + if asset["kind"] not in READER_ASSET_KINDS: + raise ManagedStorageCaptureUnavailable( + "capture_corpus_asset_kind_unknown" + ) + key = "media/" + name + if key in files: + raise ManagedStorageCaptureUnavailable("capture_corpus_asset_duplicate") + files[key] = "documents.corpus_derivative" + indexes = render_document_indexes( + (name, "", "") for name in files if name != "document.json" + ) + files.update({name: "corpus.navigation" for name in indexes}) + for name, native_class in files.items(): + self._reference( + spool=spool, + provider=provider, + role="corpus", + key=document.path + "/" + name, + native_class=native_class, + native_id=f"{seed.doc_id}:{document.corpus_published_revision}:{name}", + recorded_bytes=None, + required=True, + ) + def _read_manifest( self, *, @@ -725,9 +769,7 @@ def _classify_items( raise ManagedStorageCaptureUnavailable( "capture_original_item_unmatched" ) - native_class = self._unreferenced_class( - spool=spool, role=role, key=row[0] - ) + native_class = self._unreferenced_class(role=role, key=row[0]) _, purpose, component = self._rules[native_class] self._observation( spool=spool, @@ -753,7 +795,7 @@ def _classify_items( ): raise ManagedStorageCaptureUnavailable("capture_native_reference_unmatched") - def _unreferenced_class(self, *, spool: _Spool, role: str, key: str) -> str: + def _unreferenced_class(self, *, role: str, key: str) -> str: """Classify only explicit current writer grammars, never an unknown file.""" if role == "raw" and _UPLOAD.fullmatch(key): return "raw.unregistered_upload" @@ -764,12 +806,12 @@ def _unreferenced_class(self, *, spool: _Spool, role: str, key: str) -> str: if role == "artifacts" and _REP_ATTEMPT.fullmatch(key): return "artifacts.unregistered_representation" if role == "corpus": - prefix = "/".join(key.split("/")[:4]) - row = spool.db.execute( - "SELECT state FROM p3 WHERE prefix=?", (prefix,) - ).fetchone() - if row is not None and row[0] in {"building", "validating", "failed"}: - return "corpus.unpublished_snapshot" + # Match a document folder before shared navigation: its _index.md + # is staging too until that document's publication is complete. + if _CORPUS_KEY.fullmatch(key): + return "corpus.incomplete_or_orphan" + if key == "llms.txt" or _CORPUS_NAVIGATION.fullmatch(key): + return "corpus.navigation" raise ManagedStorageCaptureUnavailable("capture_writer_class_unknown") def _native_opaque(self, *, native_class: str, native_id: str) -> str: diff --git a/src/rememberstack/profiles/storage_capture_profile.py b/src/rememberstack/profiles/storage_capture_profile.py index 43c2cd08e..721dea730 100644 --- a/src/rememberstack/profiles/storage_capture_profile.py +++ b/src/rememberstack/profiles/storage_capture_profile.py @@ -211,14 +211,16 @@ "audit_operations", None, ), - ("projection_snapshots.gcs_uri", "corpus", "projection_origin", "p3_origin"), + ("documents.corpus_original", "corpus", "projection_origin", "p3_origin"), + ("documents.corpus_derivative", "corpus", "projection_origin", "p3_origin"), + ("corpus.navigation", "corpus", "projection_origin", "p3_origin"), ("forget_manifests.portable_intent", "forget", "privacy_control", None), ("raw.unregistered_upload", "raw", "staging", None), ("raw.unregistered_original", "raw", "staging", None), ("artifacts.unregistered_representation", "artifacts", "staging", None), ("artifacts.conversion_checkpoint", "artifacts", "paid_checkpoint", None), ("artifacts.session_transcript", "artifacts", "audit_operations", None), - ("corpus.unpublished_snapshot", "corpus", "staging", None), + ("corpus.incomplete_or_orphan", "corpus", "staging", None), ) diff --git a/src/rememberstack/spine/corpus_export.py b/src/rememberstack/spine/corpus_export.py index 75e963de6..9e9642fcd 100644 --- a/src/rememberstack/spine/corpus_export.py +++ b/src/rememberstack/spine/corpus_export.py @@ -70,22 +70,22 @@ def documents( g.structure_generation_id, g.pageindex_uri, c.raw_uri, c.mime, m.family, m.title, m.file_name, s.summary AS root_summary, s.placement_path -FROM documents d -JOIN document_versions v +FROM public.documents d +JOIN public.document_versions v ON v.deployment_id = d.deployment_id AND v.doc_id = d.doc_id AND v.version_id = d.current_version_id AND v.deleted_at IS NULL -JOIN document_representations r +JOIN public.document_representations r ON r.deployment_id = v.deployment_id AND r.version_id = v.version_id AND r.representation_id = v.current_representation_id -JOIN document_structure_generations g +JOIN public.document_structure_generations g ON g.deployment_id = r.deployment_id AND g.representation_id = r.representation_id AND g.structure_generation_id = r.current_structure_generation_id -JOIN content_objects c +JOIN public.content_objects c ON c.deployment_id = v.deployment_id AND c.content_hash = v.content_hash AND c.purged_at IS NULL -JOIN document_metadata m +JOIN public.document_metadata m ON m.deployment_id = v.deployment_id AND m.version_id = v.version_id -JOIN document_sections s +JOIN public.document_sections s ON s.deployment_id = g.deployment_id AND s.representation_id = g.representation_id AND s.structure_generation_id = g.structure_generation_id AND s.node_path = '0' WHERE d.deployment_id = :deployment_id AND d.deleted_at IS NULL diff --git a/src/rememberstack/spine/storage_capture_catalog.py b/src/rememberstack/spine/storage_capture_catalog.py index 5ac612a05..46012aa50 100644 --- a/src/rememberstack/spine/storage_capture_catalog.py +++ b/src/rememberstack/spine/storage_capture_catalog.py @@ -19,8 +19,10 @@ from pydantic import Field from pydantic import SecretStr +from rememberstack.core.corpus_export import CorpusDocument from rememberstack.model.metering import ManagedDocumentVersionOutcome from rememberstack.model.storage_capture import UnsignedDecimal +from rememberstack.spine.corpus_export import _DOCUMENTS from rememberstack.spine.storage_capture_guard import NativeRelationGuardRefused CATALOG_FUNCTION = "rememberstack_capture_internal.read_capture_catalog" @@ -68,7 +70,7 @@ class NativeCatalogAcquisition(_NativeRecord): class NativeStoreReference(_NativeRecord): """One native store locator or journal intent, including unfinished state. - A tree/repository locator is a root to expand through qualified store + A repository locator is a root to expand through qualified store evidence, never a fabricated object or a row-byte estimate. Only raw objects record a native length; missing length remains explicit. A journal intent carries the actual forget UUID, not an invented store path. Its @@ -79,7 +81,7 @@ class NativeStoreReference(_NativeRecord): native_id: SecretStr = Field(repr=False) store_role: Literal["raw", "artifacts", "corpus", "forget", "knowledge"] locator: SecretStr = Field(repr=False) - locator_kind: Literal["object", "tree", "repository_path", "journal_intent"] + locator_kind: Literal["object", "repository_path", "journal_intent"] recorded_bytes: UnsignedDecimal | None native_state: str | None recorded_digest: SecretStr | None = Field(repr=False) @@ -101,6 +103,27 @@ class NativeTerminalPage(_NativeRecord): rows: tuple[ManagedDocumentVersionOutcome, ...] +class NativeCorpusDocument(_NativeRecord): + """Recorded cleanup folders and current served inputs from the same cut. + + A path is only a possibly written folder. The consumer must compare the + nullable publication marker with the current input/policy identity before + treating any of its files as a completed document copy. + """ + + doc_id: UUID + paths: tuple[str, ...] = Field(repr=False) + document: CorpusDocument | None = Field(repr=False) + + +class NativeCorpusPage(_NativeRecord): + """A bounded page including deleted/unselected documents' cleanup paths.""" + + identity: NativeCatalogIdentity + deployment_id: UUID + rows: tuple[NativeCorpusDocument, ...] + + _BODY = r""" DECLARE native_scope uuid; @@ -125,14 +148,15 @@ class NativeTerminalPage(_NativeRecord): LOCK TABLE public.deployments, public.alembic_version, public.content_objects, public.document_representations, public.document_structure_generations, public.document_reference_generations, - public.projection_snapshots, public.knowledge_artifacts, + public.documents, public.document_versions, public.document_metadata, + public.document_sections, public.knowledge_artifacts, public.knowledge_compilations, public.knowledge_plan_runs, public.forget_manifests, public.managed_ingest_measurements, public.managed_ingest_outcomes IN ACCESS SHARE MODE NOWAIT; ELSE IF (SELECT count(*) FROM public.deployments) <> 1 OR (SELECT count(*) FROM public.alembic_version) <> 1 - OR (SELECT version_num FROM public.alembic_version) <> 'p9_49_0070' THEN + OR (SELECT version_num FROM public.alembic_version) <> 'p9_52_0073' THEN RAISE EXCEPTION USING ERRCODE='55000', MESSAGE='native_catalog_scope'; END IF; SELECT deployment_id INTO STRICT native_scope FROM public.deployments; @@ -192,12 +216,6 @@ class NativeTerminalPage(_NativeRecord): FROM public.document_reference_generations WHERE deployment_id=native_scope AND artifact_uri IS NOT NULL UNION ALL - SELECT CASE WHEN plane::text='P3_corpusfs' THEN 'projection_snapshots.gcs_uri' - ELSE 'projection_snapshots.unsupported_origin' END, - snapshot_id::text,'corpus',gcs_uri, - 'tree',NULL,status::text,NULL FROM public.projection_snapshots - WHERE deployment_id=native_scope - UNION ALL SELECT 'knowledge_artifacts.'||u.field,k.artifact_id::text,'knowledge', u.locator,'repository_path',NULL,k.status::text,NULL FROM public.knowledge_artifacts k @@ -226,6 +244,26 @@ class NativeTerminalPage(_NativeRecord): ) SELECT COALESCE(jsonb_agg(to_jsonb(bounded) ORDER BY native_class COLLATE "C",native_id COLLATE "C"),'[]'::jsonb) INTO page FROM bounded; + ELSIF section = 'corpus' THEN + IF after_class <> '' THEN + RAISE EXCEPTION USING ERRCODE='22023', MESSAGE='native_catalog_cursor'; + END IF; + WITH bounded_documents AS MATERIALIZED ( + SELECT doc_id, corpus_paths FROM public.documents + WHERE deployment_id=native_scope + -- Keep the seek on the native UUID index, including UUID zero on page one. + AND doc_id >= COALESCE(NULLIF(after_id,'')::uuid, + '00000000-0000-0000-0000-000000000000'::uuid) + AND doc_id IS DISTINCT FROM NULLIF(after_id,'')::uuid + ORDER BY doc_id LIMIT page_limit + ) + SELECT COALESCE(jsonb_agg(to_jsonb(bounded) ORDER BY doc_id),'[]'::jsonb) + INTO page FROM ( + SELECT owner.doc_id, COALESCE(owner.corpus_paths, ARRAY[]::text[]) AS paths, + to_jsonb(served) AS document + FROM bounded_documents owner + LEFT JOIN LATERAL (__CORPUS_DOCUMENTS__ AND d.doc_id=owner.doc_id) served ON true + ) bounded; ELSIF section = 'terminals' THEN IF after_class <> '' THEN RAISE EXCEPTION USING ERRCODE='22023', MESSAGE='native_catalog_cursor'; @@ -272,6 +310,8 @@ def install_native_capture_catalog( raise NativeRelationGuardRefused("native_catalog_installer_boundary") body = _BODY.replace( "__COLLECTOR__", sql.Literal(collector_role).as_string(connection) + ).replace( + "__CORPUS_DOCUMENTS__", _DOCUMENTS.replace(":deployment_id", "native_scope") ) function = sql.Identifier( "rememberstack_capture_internal", "read_capture_catalog" diff --git a/src/rememberstack/spine/storage_capture_guard.py b/src/rememberstack/spine/storage_capture_guard.py index 55a92107e..2c5e45141 100644 --- a/src/rememberstack/spine/storage_capture_guard.py +++ b/src/rememberstack/spine/storage_capture_guard.py @@ -1,6 +1,6 @@ """Fixed native relation exclusion and in-guard allocation sampling for D152. -This is a PG19 / p9_49_0070 primitive, not a complete capture, clock witness, +This is a PG19 / p9_52_0073 primitive, not a complete capture, clock witness, classification or billable quantity. Installation uses trusted operator authority; the existing collector LOGIN receives only the fixed operation. The caller retains this original transaction and rolls it back after its @@ -79,7 +79,7 @@ class NativeRelationGuardSample(_NativeRecord): contract: Literal["rememberstack.native_relation_guard.v1"] deployment_id: str - schema_head: Literal["p9_49_0070"] + schema_head: Literal["p9_52_0073"] session_login: str definer_role: str backend_pid: _POSITIVE @@ -142,7 +142,7 @@ class NativeRelationGuardRefused(RuntimeError): LOCK TABLE pg_catalog.pg_class, pg_catalog.pg_namespace, pg_catalog.pg_proc, pg_catalog.pg_extension IN SHARE MODE NOWAIT; IF (SELECT count(*) FROM public.alembic_version) <> 1 - OR (SELECT version_num FROM public.alembic_version) <> 'p9_49_0070' THEN + OR (SELECT version_num FROM public.alembic_version) <> 'p9_52_0073' THEN RAISE EXCEPTION USING ERRCODE='55000', MESSAGE='native_guard_schema'; END IF; SELECT array_agg(extname||'='||extversion ORDER BY extname COLLATE "C") @@ -270,7 +270,7 @@ class NativeRelationGuardRefused(RuntimeError): RAISE EXCEPTION USING ERRCODE='57014', MESSAGE='native_guard_deadline'; END IF; RETURN jsonb_build_object('contract','rememberstack.native_relation_guard.v1', - 'deployment_id',native_scope::text,'schema_head','p9_49_0070', + 'deployment_id',native_scope::text,'schema_head','p9_52_0073', 'session_login',session_user,'definer_role',current_user, 'backend_pid',pg_backend_pid(),'transaction_id',pg_current_xact_id()::text, 'guard_started_unix_us',started_us::text,'sample_before_unix_us',before_us::text, diff --git a/src/rememberstack/spine/storage_capture_view.py b/src/rememberstack/spine/storage_capture_view.py index 10c42b314..09c263973 100644 --- a/src/rememberstack/spine/storage_capture_view.py +++ b/src/rememberstack/spine/storage_capture_view.py @@ -37,6 +37,8 @@ from rememberstack.spine.storage_capture_catalog import CATALOG_PAGE_LIMIT from rememberstack.spine.storage_capture_catalog import NativeCatalogAcquisition from rememberstack.spine.storage_capture_catalog import NativeCatalogIdentity +from rememberstack.spine.storage_capture_catalog import NativeCorpusDocument +from rememberstack.spine.storage_capture_catalog import NativeCorpusPage from rememberstack.spine.storage_capture_catalog import NativeReferencePage from rememberstack.spine.storage_capture_catalog import NativeStorageConfiguration from rememberstack.spine.storage_capture_catalog import NativeStoreReference @@ -117,7 +119,7 @@ def iter_store_references(self) -> Iterator[NativeStoreReference]: """Read all native locator seeds, including failed/superseded rows. This is not the complete classified member set: immutable artifact - manifests, store trees, K history and unmatched provider resources still + manifests, K history and unmatched provider resources still require the engine's qualified store/profile classifier. """ after = ("", "") @@ -165,6 +167,25 @@ def iter_terminal_members(self) -> Iterator[StorageTerminalMember]: update={"payload_digest": member_payload_digest(member=member)} ) + def iter_corpus_documents(self) -> Iterator[NativeCorpusDocument]: + """Read live selections and all recorded cleanup folders in this view.""" + after = "" + while True: + page = NativeCorpusPage.model_validate_json( + self._page(section="corpus", after=("", after)) + ) + self._check_identity( + identity=page.identity, deployment_id=page.deployment_id + ) + if not page.rows: + return + for row in page.rows: + key = str(row.doc_id) + if key <= after: + raise NativeStorageCaptureRefused("native_corpus_order") + after = key + yield row + def close(self) -> None: """End the original view; cleanup never reconnects or reconstructs it.""" self._closed = True diff --git a/src/tests/adapters/test_minio_storage_capture.py b/src/tests/adapters/test_minio_storage_capture.py new file mode 100644 index 000000000..9dae50317 --- /dev/null +++ b/src/tests/adapters/test_minio_storage_capture.py @@ -0,0 +1,690 @@ +"""Real PostgreSQL native cuts and MinIO live-tree capture classification. + +Only the explicitly configured integration DB is used, sequentially. Provider +wire is synthetic: these tests do not qualify MinIO as a provider-at-T source. +""" + +import base64 +from collections.abc import Iterator +from dataclasses import dataclass +from dataclasses import replace +import json +from pathlib import Path +from typing import Any +from typing import cast +from uuid import UUID +from uuid import uuid4 + +import psycopg +from psycopg import sql +from pydantic import SecretStr +from pydantic import TypeAdapter +import pytest +from sqlalchemy import text +from sqlalchemy.engine import Engine + +from rememberstack.adapters.fsit_storage_capture import ProviderRequest +from rememberstack.adapters.selfhost import MinIOObjectStore +from rememberstack.adapters.selfhost import MinIOSettings +from rememberstack.core.corpus_export import corpus_suffix +from rememberstack.core.corpus_export import CorpusDocument +from rememberstack.core.corpus_export import CorpusPolicy +from rememberstack.core.corpus_export import DEFAULT_CORPUS_POLICY +from rememberstack.core.corpus_export import desired_export_revision +from rememberstack.core.corpus_export import json_bytes +from rememberstack.core.storage_capture import capture_request_id +from rememberstack.model import DeploymentBootstrapInput +from rememberstack.model import ObjectKey +from rememberstack.model.storage_capture import StorageMember +from rememberstack.profiles.managed_storage_capture import _digest +from rememberstack.profiles.managed_storage_capture import ( + ManagedStorageCaptureUnavailable, +) +from rememberstack.profiles.managed_storage_capture import StorageCaptureCatalog +from rememberstack.profiles.storage_capture_profile import build_managed_storage_profile +from rememberstack.profiles.storage_capture_profile import ManagedFilesystemBinding +from rememberstack.profiles.storage_capture_profile import ManagedStorageCaptureProfile +from rememberstack.profiles.storage_capture_profile import ManagedStoreBindings +from rememberstack.spine import DeploymentBootstrapper +from rememberstack.spine.corpus_export import CorpusReaderCatalog +from rememberstack.spine.corpus_publication import CorpusPublicationCatalog +from rememberstack.spine.storage_capture_catalog import install_native_capture_catalog +from rememberstack.spine.storage_capture_guard import install_native_relation_guard +from rememberstack.spine.storage_capture_view import NativeStorageCaptureCatalog +from rememberstack.workers.corpus_publication import CorpusPublisher +from tests.adapters.test_minio_object_operations import minio_settings as minio_settings +from tests.corpus_export_support import authority +from tests.corpus_export_support import digest +from tests.storage_capture_support import CaptureStore +from tests.storage_capture_support import DiskEvidence +from tests.storage_capture_support import FIXTURES +from tests.storage_capture_support import SyntheticProvider +from tests.workers.test_corpus_reader_export_pg import _seed +from tests.workers.test_corpus_reader_export_pg import engine as engine + + +@dataclass +class NativeRoles: + engine: Engine + collector: str + + def connect(self) -> psycopg.Connection: + return psycopg.connect( + self.engine.url.set( + drivername="postgresql", username=self.collector + ).render_as_string(hide_password=False), + autocommit=True, + options="-c transaction_timeout=10s -c statement_timeout=10s -c lock_timeout=250ms", + ) + + +@pytest.fixture(scope="module") +def native_roles(engine: Engine) -> Iterator[NativeRoles]: + """Install actual restricted LOGIN helpers in the one shared test database.""" + suffix = uuid4().hex[:12] + definer, collector = f"capture_definer_{suffix}", f"capture_collector_{suffix}" + conninfo = engine.url.set(drivername="postgresql").render_as_string( + hide_password=False + ) + with psycopg.connect(conninfo, autocommit=True) as admin: + admin.execute("DROP SCHEMA IF EXISTS rememberstack_capture_internal CASCADE") + admin.execute( + sql.SQL("CREATE ROLE {} NOLOGIN NOSUPERUSER INHERIT").format( + sql.Identifier(definer) + ) + ) + admin.execute( + sql.SQL("CREATE ROLE {} LOGIN NOSUPERUSER NOINHERIT PASSWORD {}").format( + sql.Identifier(collector), sql.Literal(engine.url.password) + ) + ) + owner = admin.execute( + "SELECT pg_get_userbyid(relowner) FROM pg_class WHERE oid='public.deployments'::regclass" + ).fetchone() + assert owner is not None + admin.execute( + sql.SQL("GRANT {} TO {} WITH INHERIT TRUE, SET FALSE").format( + sql.Identifier(owner[0]), sql.Identifier(definer) + ) + ) + admin.execute( + sql.SQL( + "GRANT pg_read_all_settings TO {} WITH INHERIT TRUE, SET FALSE" + ).format(sql.Identifier(definer)) + ) + install_native_relation_guard( + connection=admin, definer_role=definer, collector_role=collector + ) + install_native_capture_catalog( + connection=admin, definer_role=definer, collector_role=collector + ) + admin.execute( + sql.SQL("GRANT CONNECT ON DATABASE {} TO {}").format( + sql.Identifier(str(engine.url.database)), sql.Identifier(collector) + ) + ) + # Repeated migration resets leave catalog churn for autovacuum. Finish + # it before arming cuts: the real NOWAIT guard must refuse overlapping + # maintenance, and a success-path fixture must not depend on its timing. + admin.execute( + "VACUUM (ANALYZE) pg_catalog.pg_class, pg_catalog.pg_namespace, " + "pg_catalog.pg_proc, pg_catalog.pg_extension" + ) + try: + yield NativeRoles(engine, collector) + finally: + with psycopg.connect(conninfo, autocommit=True) as admin: + admin.execute("DROP SCHEMA rememberstack_capture_internal CASCADE") + for role in (collector, definer): + admin.execute(sql.SQL("DROP OWNED BY {}").format(sql.Identifier(role))) + admin.execute(sql.SQL("DROP ROLE {}").format(sql.Identifier(role))) + + +@dataclass +class LiveTree: + roles: NativeRoles + stores: dict[str, CaptureStore] + documents: tuple[CorpusDocument, ...] + profile: ManagedStorageCaptureProfile + evidence: DiskEvidence + + def request(self): + with self.roles.engine.connect() as connection: + now = connection.execute( + text("SELECT floor(extract(epoch FROM clock_timestamp()))::bigint") + ).scalar_one() + return self.profile.request(cut_at_unix_us=str((now + 4) * 1_000_000)) + + def capture(self): + request = self.request() + provider = SyntheticProvider( + request=ProviderRequest( + cell_id=self.profile.bindings.provider_cell_id, + cut_at_unix_us=request.cut_at_unix_us, + filesystem_ids=tuple( + sorted(store.filesystem for store in self.stores.values()) + ), + organisation_id=self.profile.bindings.provider_organisation_id, + protocol="fsit-capture-v1", + ), + stores=self.stores, + ) + catalog = StorageCaptureCatalog( + collector_connect=self.roles.connect, + provider=provider, + stores=self.stores, + evidence_store=self.evidence, + profile=self.profile, + identity_key=SecretStr("fixture-only"), + ) + return catalog, request, provider + + +@pytest.fixture +def live_tree( + native_roles: NativeRoles, + minio_settings: MinIOSettings, + tmp_path: Path, + request: pytest.FixtureRequest, +) -> Iterator[LiveTree]: + """Publish four real document folders sharing immutable originals/artifacts.""" + roles = native_roles + stores: dict[str, CaptureStore] = {} + for role in ("artifacts", "corpus", "forget", "raw"): + filesystem = base64.b32encode(uuid4().bytes).decode().rstrip("=").lower() + store = MinIOObjectStore(bucket=filesystem, settings=minio_settings) + store.ensure_bucket() + stores[role] = CaptureStore(store, filesystem) + source, artifacts, raw = authority() + inventory = json.loads(artifacts.objects[source.conversion_uri]) + base = source.conversion_uri.rsplit("/", 1)[0] + for entry in [inventory["source_map"], *inventory["derived_assets"]]: + old = entry["uri"] + entry["uri"] = base + ( + "/media/" + entry["name"] if "name" in entry else "/source_map.json" + ) + artifacts.objects[entry["uri"]] = artifacts.objects.pop(old) + for number in range(getattr(request, "param", 0)): + name = f"pages/page-{number:04d}.png" + content = f"page {number}".encode() + uri = base + "/media/" + name + inventory["derived_assets"].append( + { + "name": name, + "kind": "page_image", + "media_type": "image/png", + "uri": uri, + "sha256": digest(content), + } + ) + artifacts.objects[uri] = content + artifacts.objects[source.conversion_uri] = json_bytes(inventory) + source = replace( + source, manifest_hash=digest(artifacts.objects[source.conversion_uri]) + ) + for name in ( + "private/blocks.json", + "private/meta.json", + "legacy/stale-pageindex.json", + ): + artifacts.objects[name] = b"{}" + # Only referenced objects: arbitrary nearby E0 fixture keys are not part of + # this complete store. Unknown unrelated keys have their own refusal test. + names = { + source.markdown_uri, + source.conversion_uri, + source.pageindex_uri, + inventory["source_map"]["uri"], + *(entry["uri"] for entry in inventory["derived_assets"]), + "private/blocks.json", + "private/meta.json", + "legacy/stale-pageindex.json", + } + for name in names: + stores["artifacts"].store.write_bytes( + key=ObjectKey(name), content=artifacts.objects[name], storage_class="cold" + ) + stores["raw"].store.write_bytes( + key=ObjectKey(source.raw_uri), + content=raw.objects[source.raw_uri], + storage_class="cold", + ) + engine = roles.engine + with engine.begin() as connection: + connection.execute(text("TRUNCATE deployments CASCADE")) + DeploymentBootstrapper(engine=engine).bootstrap_deployment( + deployment_input=DeploymentBootstrapInput( + deployment_id=source.deployment_id, + slug="live-capture", + name="Live capture", + default_language="en", + raw_bucket="s3://" + stores["raw"].filesystem, + artifacts_bucket="s3://" + stores["artifacts"].filesystem, + corpusfs_bucket="s3://" + stores["corpus"].filesystem, + ), + sole_deployment=True, + ) + for number in range(4): + _seed( + engine, + replace( + source, + doc_id=UUID(int=number), + version_id=UUID(int=2000 + number), + representation_id=UUID(int=3000 + number), + structure_generation_id=UUID(int=4000 + number), + title=("Published", "Updating", "Forgotten", "Stale")[number], + placement_path=None if number == 0 else "Finance/Reports", + ), + ) + with engine.begin() as connection: + connection.execute( + text("UPDATE content_objects SET byte_size=:bytes"), + {"bytes": len(raw.objects[source.raw_uri])}, + ) + # This historical operations row must never become a corpus locator. + connection.execute( + text("""INSERT INTO projection_snapshots + (snapshot_id, deployment_id, plane, version, gcs_uri, status, is_latest) + VALUES (:snapshot, :deployment, 'P3_corpusfs', 'retired', + 'snapshots/P3/retired', 'published', true)"""), + {"snapshot": uuid4(), "deployment": source.deployment_id}, + ) + readers = CorpusReaderCatalog(engine=engine) + publisher = CorpusPublisher( + catalog=CorpusPublicationCatalog(engine=engine), + readers=readers, + raw_store=stores["raw"].store, + artifact_store=stores["artifacts"].store, + corpus_store=stores["corpus"].store, + ) + with readers.documents(deployment_id=source.deployment_id) as rows: + documents = tuple(rows) + for document in documents: + assert publisher.publish_corpus( + deployment_id=source.deployment_id, doc_id=document.doc_id + ) + with readers.documents(deployment_id=source.deployment_id) as rows: + documents = tuple(rows) + native = ManagedStorageCaptureProfile.model_validate_json( + json.dumps( + json.loads((FIXTURES / "live_corpus_profile.json").read_bytes())["profile"] + ) + ).native + profile = build_managed_storage_profile( + native=native, + bindings=ManagedStoreBindings( + deployment_id=source.deployment_id.hex, + postgres_database_name=str(engine.url.database), + provider_organisation_id="1" * 32, + provider_cell_id="cell-1", + filesystems=tuple( + ManagedFilesystemBinding( + role=role, filesystem_id=stores[role].filesystem + ) + for role in ("artifacts", "corpus", "forget", "raw") + ), + ), + managed_runtime_source_digest="6" * 64, + provider_profile_digest="a" * 64, + provider_clock_profile_digest="b" * 64, + ) + try: + yield LiveTree( + roles, stores, documents, profile, DiskEvidence(tmp_path / "evidence") + ) + finally: + for store in stores.values(): + store.store.purge_objects( + keys=tuple(store.store.iter_keys(prefix="")), prefixes=() + ) + client = cast(Any, store.store._client) + client.delete_bucket(Bucket=store.filesystem) + client.close() + + +def _put(state: LiveTree, name: str) -> None: + state.stores["corpus"].store.replace_stream( + key=ObjectKey(name), chunks=(b"retained copy",), storage_class="hot" + ) + + +def test_live_tree_classes_and_separate_original_quantities( + live_tree: LiveTree, +) -> None: + state = live_tree + published, updating, forgotten, stale = state.documents + with state.roles.engine.begin() as connection: + connection.execute( + text( + "UPDATE documents SET corpus_published_revision=NULL WHERE doc_id=:id" + ), + {"id": updating.doc_id}, + ) + # Simulate retained provider copies after a forget/restore: no live + # served reading or friendly cleanup path survives in DB authority. + connection.execute( + text( + "UPDATE documents SET deleted_at=now(), current_version_id=NULL, corpus_paths=NULL WHERE doc_id=:id" + ), + {"id": forgotten.doc_id}, + ) + # A non-null old marker must fail even if invalidation was omitted. + connection.execute( + text( + "UPDATE document_metadata SET title='Changed inputs' WHERE version_id=:id" + ), + {"id": stale.version_id}, + ) + orphan = "pdf/unrecorded--" + corpus_suffix(uuid4()) + "/original.pdf" + _put(state, orphan) + extra = published.path + "/unrecognized.bin" + _put(state, extra) + _put(state, "pdf/~/ab/~/abc/_index.md") + catalog, request, provider = state.capture() + result = catalog.capture_once(request=request) + assert provider.completed + members = [ + member + for body in result.iter_page_bytes() + for member in json.loads(body)["members"] + ] + typed = [TypeAdapter(StorageMember).validate_python(member) for member in members] + observations = { + member.resource_evidence_digest: member.purpose + for member in typed + if member.kind == "resource_observation" + } + expected_p3 = 0 + for page in provider.pages: + for item in page.items: + role, name = next( + key for key, path in provider.keys.items() if path == item.path_id + ) + purpose = observations[ + _digest(domain="rememberstack.storage_provider_item.v1", record=item) + ] + if role == "corpus": + excluded = ( + name == orphan + or name == extra + or any( + name.startswith(document.path + "/") + for document in (updating, forgotten, stale) + ) + ) + assert purpose == ("staging" if excluded else "projection_origin"), name + if not excluded: + expected_p3 += int(item.logical_bytes) + assert ( + state.stores[role].store.storage_class_of(key=ObjectKey(name)) + == "hot" + ) + else: + assert purpose == ( + "canonical_raw" if role == "raw" else "referenced_artifact" + ) + totals = { + record.component: int(record.measured_bytes) + for record in result.manifest.component_records + } + assert totals["p3_origin"] == expected_p3 + expected_canonical = sum( + int(item.logical_bytes) + for page in provider.pages + for item in page.items + if item.filesystem_id != state.stores["corpus"].filesystem + ) + assert totals["canonical_object"] == expected_canonical + raw = [ + member + for member in typed + if member.kind == "reference" and member.purpose == "canonical_raw" + ] + assert len(raw) == 1 # four lineages share one actual canonical original + original_path = provider.keys[("corpus", published.path + "/original.pdf")] + copies = [ + member + for member in typed + if member.kind == "reference" and member.resource_identity == original_path + ] + assert len(copies) == 1 and copies[0].component == "p3_origin" + assert ( + copies[0].purpose == "projection_origin" + and copies[0].logical_bytes == raw[0].logical_bytes + ) + assert copies[0].opaque_id == catalog._native_opaque( + native_class="documents.corpus_original", + native_id=f"{published.doc_id}:{published.corpus_published_revision}:original.pdf", + ) + for name, native_class in ( + ("document.md", "documents.corpus_derivative"), + ("_index.md", "corpus.navigation"), + ): + path = provider.keys[("corpus", published.path + "/" + name)] + reference = next( + member + for member in typed + if member.kind == "reference" and member.resource_identity == path + ) + assert reference.opaque_id == catalog._native_opaque( + native_class=native_class, + native_id=f"{published.doc_id}:{published.corpus_published_revision}:{name}", + ) + + +@pytest.mark.parametrize( + "live_tree", [DEFAULT_CORPUS_POLICY.member_limit], indirect=True +) +def test_published_document_subindexes_are_navigation(live_tree: LiveTree) -> None: + state = live_tree + document = state.documents[0] + catalog, request, provider = state.capture() + result = catalog.capture_once(request=request) + members = [ + TypeAdapter(StorageMember).validate_python(member) + for body in result.iter_page_bytes() + for member in json.loads(body)["members"] + ] + references = { + member.resource_identity: member + for member in members + if member.kind == "reference" and member.store_binding_id == "corpus" + } + observations = { + member.resource_evidence_digest: member.purpose + for member in members + if member.kind == "resource_observation" + } + paths = { + name: path + for (role, name), path in provider.keys.items() + if role == "corpus" and name.startswith(document.path + "/") + } + assert len(paths) > DEFAULT_CORPUS_POLICY.member_limit + indexes = { + name.removeprefix(document.path + "/"): path + for name, path in paths.items() + if name.endswith("/_index.md") + } + assert "_index.md" in indexes and len(indexes) > 1 + assert any(name.startswith("~/") for name in indexes) + for name, path in indexes.items(): + reference = references[path] + assert reference.opaque_id == catalog._native_opaque( + native_class="corpus.navigation", + native_id=f"{document.doc_id}:{document.corpus_published_revision}:{name}", + ) + assert reference.purpose == "projection_origin" + assert reference.component == "p3_origin" + for page in provider.pages: + for item in page.items: + if item.path_id in paths.values(): + assert ( + observations[ + _digest( + domain="rememberstack.storage_provider_item.v1", record=item + ) + ] + == "projection_origin" + ) + + +@pytest.mark.parametrize( + "key", + [ + "unknown", + "llms.txt.bak", + "_paths/doc.json", + "pdf/not-a-document/document.md", + "snapshots/P3/latest/MANIFEST.json", + ], +) +def test_unknown_corpus_keys_fail_closed(live_tree: LiveTree, key: str) -> None: + _put(live_tree, key) + catalog, request, _ = live_tree.capture() + with pytest.raises( + ManagedStorageCaptureUnavailable, match="capture_writer_class_unknown" + ): + catalog.capture_once(request=request) + assert ( + live_tree.evidence.read_manifest(capture_id=capture_request_id(request=request)) + is None + ) + + +def test_missing_published_copy_never_completes(live_tree: LiveTree) -> None: + state = live_tree + state.stores["corpus"].store.delete( + key=ObjectKey(state.documents[0].path + "/original.pdf") + ) + catalog, request, _ = state.capture() + with pytest.raises( + ManagedStorageCaptureUnavailable, match="capture_native_reference_unmatched" + ): + catalog.capture_once(request=request) + assert ( + state.evidence.read_manifest(capture_id=capture_request_id(request=request)) + is None + ) + + +@pytest.mark.parametrize("case", ["unrecorded", "cleanup_incomplete", "old_policy"]) +def test_marker_and_recorded_folder_must_both_match( + live_tree: LiveTree, case: str +) -> None: + state = live_tree + document = state.documents[0] + with state.roles.engine.begin() as connection: + if case == "old_policy": + connection.execute( + text( + "UPDATE documents SET corpus_published_revision=:revision WHERE doc_id=:id" + ), + { + "id": document.doc_id, + "revision": desired_export_revision( + document, policy=CorpusPolicy(builder_version="retired-policy") + ), + }, + ) + else: + paths = ( + None + if case == "unrecorded" + else [document.path, "pdf/old--" + corpus_suffix(document.doc_id)] + ) + connection.execute( + text("UPDATE documents SET corpus_paths=:paths WHERE doc_id=:id"), + {"id": document.doc_id, "paths": paths}, + ) + catalog, request, provider = state.capture() + result = catalog.capture_once(request=request) + observations = { + member["resource_evidence_digest"]: member["purpose"] + for body in result.iter_page_bytes() + for member in json.loads(body)["members"] + if member["kind"] == "resource_observation" + } + paths = { + path + for (role, key), path in provider.keys.items() + if role == "corpus" and key.startswith(document.path + "/") + } + assert paths + for page in provider.pages: + for item in page.items: + if item.path_id in paths: + assert ( + observations[ + _digest( + domain="rememberstack.storage_provider_item.v1", record=item + ) + ] + == "staging" + ) + + +def test_capture_helpers_refuse_any_other_schema_head(live_tree: LiveTree) -> None: + state = live_tree + with state.roles.engine.begin() as connection: + connection.execute(text("UPDATE alembic_version SET version_num='p9_51_0072'")) + try: + with state.roles.connect() as collector: + collector.execute("BEGIN") + with pytest.raises( + psycopg.errors.ObjectNotInPrerequisiteState, match="native_guard_schema" + ): + collector.execute( + "SELECT rememberstack_capture_internal.guard_relation_allocation(floor(extract(epoch FROM clock_timestamp())*1000000)::bigint+9000000)" + ) + collector.execute("ROLLBACK") + collector.execute("BEGIN ISOLATION LEVEL REPEATABLE READ READ ONLY") + with pytest.raises( + psycopg.errors.ObjectNotInPrerequisiteState, + match="native_catalog_scope", + ): + collector.execute( + "SELECT rememberstack_capture_internal.read_capture_catalog('bind','','',1)" + ) + collector.execute("ROLLBACK") + finally: + with state.roles.engine.begin() as connection: + connection.execute( + text("UPDATE alembic_version SET version_num='p9_52_0073'") + ) + + +def test_corpus_catalog_keeps_original_view_across_pages( + live_tree: LiveTree, monkeypatch: pytest.MonkeyPatch +) -> None: + state = live_tree + # Small pages exercise real SQL keyset cursors, not just the first page. + monkeypatch.setattr( + "rememberstack.spine.storage_capture_view.CATALOG_PAGE_LIMIT", 1 + ) + with NativeStorageCaptureCatalog( + connect=state.roles.connect, profile=state.profile.native + ).open_view(request=state.request()) as native: + rows = native.iter_corpus_documents() + first = next(rows) + with state.roles.engine.begin() as connection: + connection.execute( + text( + "UPDATE documents SET corpus_published_revision=NULL, corpus_paths=NULL" + ) + ) + captured = (first, *rows) + assert tuple(row.doc_id for row in captured) == tuple( + document.doc_id for document in state.documents + ) + assert all( + row.paths == (document.path,) + and row.document + and row.document.corpus_published_revision + == document.corpus_published_revision + for row, document in zip(captured, state.documents, strict=True) + ) + assert all( + seed.store_role != "corpus" for seed in native.iter_store_references() + ) diff --git a/src/tests/fixtures/storage_capture/live_corpus_profile.json b/src/tests/fixtures/storage_capture/live_corpus_profile.json new file mode 100644 index 000000000..4257d3730 --- /dev/null +++ b/src/tests/fixtures/storage_capture/live_corpus_profile.json @@ -0,0 +1,3358 @@ +{ + "kind": "synthetic_live_corpus_regression_not_deployment_qualification", + "profile": { + "bindings": { + "contract": "rememberstack.storage_bindings.v1", + "deployment_id": "00000000000000000000000000000001", + "filesystems": [ + { + "filesystem_id": "aaaaaaaaaaaaaaaaaaaaaaaaaa", + "role": "artifacts" + }, + { + "filesystem_id": "aeaqcaibaeaqcaibaeaqcaibae", + "role": "corpus" + }, + { + "filesystem_id": "aibaeaqcaibaeaqcaibaeaqcai", + "role": "forget" + }, + { + "filesystem_id": "ambqgaydambqgaydambqgaydam", + "role": "raw" + } + ], + "knowledge_repository": "unconfigured", + "postgres_database_name": "rememberstack", + "provider_cell_id": "synthetic-cell", + "provider_organisation_id": "11111111111111111111111111111111" + }, + "classification": { + "contract": "rememberstack.storage_classification.v1", + "rules": [ + { + "native_class_id": "007d68f4820d727d19e154bfd5172468513c2222ca61b2476a1deb363a75c520", + "purpose": "projection_origin" + }, + { + "native_class_id": "044ec9dcaf142fb30a298d1ab81870e928891e35995364943a1aed639128e615", + "purpose": "paid_checkpoint" + }, + { + "native_class_id": "08fa711cd73b924722a4d038f5249345bc7abe996bc0a416db18383ebee3e5bb", + "purpose": "truth_provenance" + }, + { + "native_class_id": "0cee34b41111b4ce11e944d4510dccb5e97edb2e56a838749371bdeb7939b29c", + "purpose": "staging" + }, + { + "native_class_id": "0d65a6d0aa9398e59c8b371f96f5d96553df4cade5d5ca597d4b2e4e9a11aa48", + "purpose": "truth_provenance" + }, + { + "native_class_id": "0eec45f5745b8309f3d2a3e843f35995bd7ccf29729f01d25866bf450e98d3a7", + "purpose": "truth_provenance" + }, + { + "native_class_id": "0f84fea08613372902cf3a55121793c23ac6134945b2f7e92343fcbe9fa545bd", + "purpose": "truth_provenance" + }, + { + "native_class_id": "0fb3ae827a975bf9278f3bed7066b4e976999cf6e92d9362e56dd351d8bc7039", + "purpose": "truth_provenance" + }, + { + "native_class_id": "101a094a68e531d95f2942f4d2b79db1648dd916324bd654fed7d0b29fed22b8", + "purpose": "truth_provenance" + }, + { + "native_class_id": "18f5abc52e6326573821085782bcf289518e66761b590414771d19f0cee58ace", + "purpose": "truth_provenance" + }, + { + "native_class_id": "19ca460a0b58bf873c77199ee43157903fa692056b0877125b7ddc2c4fe77901", + "purpose": "privacy_control" + }, + { + "native_class_id": "1a9686dddb81706f19a92dcd0622c56444dfe1d15e9b521cbbf3d3330a59c615", + "purpose": "truth_provenance" + }, + { + "native_class_id": "1d473a6a5b8f89c6fa5631cf532eb23969379cd1af44b0a2dc3b7412b760337a", + "purpose": "paid_checkpoint" + }, + { + "native_class_id": "1eb995d00ec01bb580b0fd40a0a28231d9e09d849a3110ed9fdf33ee04177c90", + "purpose": "canonical_raw" + }, + { + "native_class_id": "1f1eddd4ddc69d66a73cb740ac52c086eb1fb570835d48c594bdaa2ef29e8259", + "purpose": "truth_provenance" + }, + { + "native_class_id": "23152804509f328bcd63ecf80640d716b816b3138d9d9163c4eed44a8d49b860", + "purpose": "truth_provenance" + }, + { + "native_class_id": "2382bf468dd9b2593f64394fbed2cbda824bf3fb524f7c388862156e081893f2", + "purpose": "truth_provenance" + }, + { + "native_class_id": "24d9c28c173b6f7d1406feb1129dc7a7c7ba9b74c4faf25dcabe9889f8017ffa", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "25bf7d36538251a34023a8951b96296c68d3b2b30248716db1df4acb1ac4eb6c", + "purpose": "referenced_artifact" + }, + { + "native_class_id": "2755471d8a8015e5fa023414b77dcfa1aa0d06c02f8d2bd624f5a56e4e56cc66", + "purpose": "truth_provenance" + }, + { + "native_class_id": "287e680499ec94e25dd7f32cc62cb7cc58ca2c5218440a0e4fff60b84ad8065a", + "purpose": "paid_checkpoint" + }, + { + "native_class_id": "29e311f3c2b2faf0325ea57c053a1bdab6e0307a39972d9379851545558851bf", + "purpose": "truth_provenance" + }, + { + "native_class_id": "2ba362a5cfc80a67053fe9c6aeda58159423d411006982ce9b887a622d7bda30", + "purpose": "truth_provenance" + }, + { + "native_class_id": "2bcfe26b2e2d6484290a3634e3f3b9864033a70dc8160897734df7b12843b442", + "purpose": "truth_provenance" + }, + { + "native_class_id": "2f87062786cf1ebfe2cfd968ffa5d917890ffaa53a51160da0e3447400e522b9", + "purpose": "projection_origin" + }, + { + "native_class_id": "30ae07477f98239736e89e86e498908d9ef3d177b3f7e1812a917cf33cd3c022", + "purpose": "truth_provenance" + }, + { + "native_class_id": "37d6a61ae54b960a76baf4b2daf620f7dcafaa7b3ce41d3a3738901451ca97d9", + "purpose": "projection_origin" + }, + { + "native_class_id": "39f7f9778a16e938565bc178aebb769cd49682fdb53757c21a6fc6c97bbb53a7", + "purpose": "audit_operations" + }, + { + "native_class_id": "3a4368afbfa3bb62db58adb2fb0cdb3c050226aff1ef63f172813850dbf1207a", + "purpose": "truth_provenance" + }, + { + "native_class_id": "3aa2dc29e9fc59b1fbb16fc3a2c7bae8503f0a2238342596378a5bbd4aacae58", + "purpose": "truth_provenance" + }, + { + "native_class_id": "3d0253695555bd13842ed85b2e3ff1018be88a955b97ea3d4c5536dde148e95a", + "purpose": "truth_provenance" + }, + { + "native_class_id": "3f9882bd5a51113017a54698652c0547627ac325253d2be7eced60827d1383f5", + "purpose": "truth_provenance" + }, + { + "native_class_id": "41a62a23bd3fe7b0b1a3fbd1e2cc858d73831c9834574225ef5880298fbe66f1", + "purpose": "audit_operations" + }, + { + "native_class_id": "41bd895213e7ee727253199ebc3e4c8a4c31bda89862bc8b6013ecc719d205db", + "purpose": "truth_provenance" + }, + { + "native_class_id": "4adc529939ddf48377baf0d6d28c1cbf52be8c1df205f2af1ec8351aef489a87", + "purpose": "referenced_artifact" + }, + { + "native_class_id": "4d631843d1a72ddabad103cd830fd5dc1e9dc98ced6c2b31b197cfb0ac5ac180", + "purpose": "truth_provenance" + }, + { + "native_class_id": "4e513fe30b801eb61a6abacc5949e4f2b2cdf84284926299236a14bc54da7279", + "purpose": "truth_provenance" + }, + { + "native_class_id": "50d724d739dbf4b3ae1102e29f9f8991427b835d9438c9b7cf1c283408e6ecc9", + "purpose": "truth_provenance" + }, + { + "native_class_id": "5364a616d40eef3d07b3df3086a78c81e254bfb880f9f2c6934e0afe82b153d8", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "53cd353573a08f42a416f690138d60e9df7c59420438413d53c8b63e92ee8467", + "purpose": "truth_provenance" + }, + { + "native_class_id": "53d8f885f9d6fae8add0bf9028908395975e79f842099717d7139a73e41c86d1", + "purpose": "truth_provenance" + }, + { + "native_class_id": "5728869e8ed1782b67f743410a7b2ec7ed2d9b480013851e2259a7b06fd8da09", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "58af645de336dd16dbb319df951f4a1bd2b1c9edc2f136633c33e954d126b811", + "purpose": "truth_provenance" + }, + { + "native_class_id": "5996eea739695b314ecd11e770aa10e858c30ddf21ac5f0df7bb2e62ac21278d", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "5aa953c006b43063843841929c47ccfdac1d5dc6d7a139c3f25c0b373679170d", + "purpose": "staging" + }, + { + "native_class_id": "5bc0631494b204494721ca77702ada8b7e45c4bdd30e5ead95554d1fd4a4d32b", + "purpose": "audit_operations" + }, + { + "native_class_id": "5eb16c636d4ff6183bf6b038e3b4534fd8d08dec8901b043698bb39de3829401", + "purpose": "truth_provenance" + }, + { + "native_class_id": "66b6d79937604ad52686bb06cbe19c0666887a17d2a6e2f73571d225438d3d58", + "purpose": "truth_provenance" + }, + { + "native_class_id": "68c9b5aad31690d6ed30b86338ecac0556b0acfe8bb3e2dff17158a94bcd9dba", + "purpose": "audit_operations" + }, + { + "native_class_id": "6e1bcde34cf72176006d16c3606d154954ad9b95f49d63203203f35e95df74ab", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "6e99bf7061da62a8721c9f6a49e54f3058639b977765a4df67bf639ae2b290b3", + "purpose": "paid_checkpoint" + }, + { + "native_class_id": "702a8c1251f9b9c6212b8174342a6c74bd2970943d0148d91f7de0f64def5d58", + "purpose": "truth_provenance" + }, + { + "native_class_id": "70ca039e090a69f321a79ce28d3e58fa161210f4cf57ba736e00c65cd35b05bb", + "purpose": "truth_provenance" + }, + { + "native_class_id": "718eec380d0490821560f7aa16e4c4aee1b819f59c0e901085ded8da74e2bcbe", + "purpose": "truth_provenance" + }, + { + "native_class_id": "71efcd1f3527740b64508b32e0b10616d4fa8307a220098ecaddbb4797a3a823", + "purpose": "audit_operations" + }, + { + "native_class_id": "72120945bb7e8fb1875e8d81cd4d721fd8d84165c42c27ad343f2af6d3d9bf9c", + "purpose": "truth_provenance" + }, + { + "native_class_id": "756d6ca2a7cc1be2b98abf05aae2350f5180df70a5288f5ba4de4623d36f3369", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "7d52c29ff2e88329e30374dcca2d18093f5460023c2570b3066d17ac3f1a651e", + "purpose": "truth_provenance" + }, + { + "native_class_id": "7d69f40e929c419fbb3b3f6cc3a49daf511dd90358b5ca4d1da5905d7dba3e95", + "purpose": "audit_operations" + }, + { + "native_class_id": "7e18c1cbf0a09a697207b77ec971101c9299ea4d208d0f600c0d0e61d043870c", + "purpose": "truth_provenance" + }, + { + "native_class_id": "7e2e94aeda6dcce0f19dd40be74aa1f81f550b0380e95570d312c1fa6763bb32", + "purpose": "projection_origin" + }, + { + "native_class_id": "7f1bf2ae90a7e4cadc0f2ac4fe595ebc3250e291a334309c3ef25d5d1aaa6836", + "purpose": "paid_checkpoint" + }, + { + "native_class_id": "80ef68961b8cc8044b597b4c4ec04abc0d327979151e41ce335e6e45140de98c", + "purpose": "paid_checkpoint" + }, + { + "native_class_id": "81ac981ba0c8d93c89cf4e3ceed44748a3fd230f573b333a92aa7bbd859e5072", + "purpose": "truth_provenance" + }, + { + "native_class_id": "85241cbfb2089c18a02f465a423444433a6e78e047db07cbb53af57f7cb73674", + "purpose": "referenced_artifact" + }, + { + "native_class_id": "86305cced2ed68ee65399ffeb490009c86d11db6ce41015487e65bf2f0916ef0", + "purpose": "truth_provenance" + }, + { + "native_class_id": "89b56815c8a21f484cb4dcbd5ae35605f1ebe879875bfee12f1b8f70f30a33f1", + "purpose": "referenced_artifact" + }, + { + "native_class_id": "8ed87ade6387efd0f4c58f6934d990512d4cdd6f893137130f9a74b2de57e6cb", + "purpose": "projection_origin" + }, + { + "native_class_id": "8f1c9de220f26cfa48b14bc08749cd495e3d8bb930d2adcc072fffe266b630ed", + "purpose": "truth_provenance" + }, + { + "native_class_id": "92b0cc803816c4985c4ddea87165192e2facf463af56b5463a65514737c903c3", + "purpose": "privacy_control" + }, + { + "native_class_id": "94dbbf109e06061786430bc767111f0ceb499717bfe1a428346bf3a33a0de6a1", + "purpose": "audit_operations" + }, + { + "native_class_id": "9808d804724f7aa9aab6072306cb35c7f5061091d095f654f2aa9db64590829a", + "purpose": "paid_checkpoint" + }, + { + "native_class_id": "9a338a4086d8bb2cfa0f6719f0016c5c8dc23081f7b6d5a9c7516d279ff61bf7", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "9b7902a64a49b222b5cf5d9a4167c710f2374395fc698aaa4688841f0f4700f9", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "9edb8f7fa0f1babe298706a35f53427cfab7ece8f89ad04b9c5fd1afe5494b76", + "purpose": "truth_provenance" + }, + { + "native_class_id": "a1814ab88563a5452e9cc59a57993ea94d4a8d5146d3f50ce532dd7027ff178c", + "purpose": "truth_provenance" + }, + { + "native_class_id": "a1ab9f23ec27e55685185f26a6a7dc87def133070c6d5d55c6b67ebdf630d767", + "purpose": "truth_provenance" + }, + { + "native_class_id": "a4a2de29eb70c0461fe71f6408468ae8bd2a734e59afaf8799f88f950d4bc4b0", + "purpose": "truth_provenance" + }, + { + "native_class_id": "a74b2b9c8562f560d5ed2d1159f801c01778137abfc8b509f6dfbebf8d10d868", + "purpose": "truth_provenance" + }, + { + "native_class_id": "b0e90e177c457000d60b8b535c1d4690d51f52a79c64785ffa9dfe347a12943a", + "purpose": "staging" + }, + { + "native_class_id": "b467512e185449766c693aa13f27f56626c9d08f06e50850c15218d98dfb0bb9", + "purpose": "truth_provenance" + }, + { + "native_class_id": "b929de99c5233a6051bfc535316753915ea6b13ee67a2ca7616f7ec3e899b7a6", + "purpose": "truth_provenance" + }, + { + "native_class_id": "ba761847100ae259cea49d9f781e1f4b043bd69494e54df7cf0229ef9903d9a0", + "purpose": "truth_provenance" + }, + { + "native_class_id": "bb4013371712004ebaabfb6fedfef19c5752114f510da2ac01e478d353f79379", + "purpose": "truth_provenance" + }, + { + "native_class_id": "bd243e6625453916fbe7ce391f6d7cab377858d5cc8d8abf1ec6e3efa6ac0ad6", + "purpose": "audit_operations" + }, + { + "native_class_id": "bd2ab2ec0f386d451e57df2f8d20b158ac9beb17274c4605e51720ad6e25d8de", + "purpose": "projection_origin" + }, + { + "native_class_id": "be08185e503972f1b82786d3412cfd82770dfe4aef0c17a1ebac29b65c9a65fa", + "purpose": "truth_provenance" + }, + { + "native_class_id": "c3a16d749378891eb43acf0f599be95a33a3d7b4e0c617e7a77c4cb80bfdb29f", + "purpose": "truth_provenance" + }, + { + "native_class_id": "c3d9a531e7c23233549a319a6be47eb9e5a18a35eecdcfa9e352498a09a8e2c3", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "c47416508fe973f327d5927f300362bcb7341e1c08a7fa337c64dd1d6d948785", + "purpose": "audit_operations" + }, + { + "native_class_id": "c8e57437f11507ef7b9ff57d1364693db9a5e290bf57be992d20ffffe6a4465f", + "purpose": "truth_provenance" + }, + { + "native_class_id": "c9316ba8454850f22cb27c644a6f5e33dcae8b5978c17371b528c1b97abc5027", + "purpose": "truth_provenance" + }, + { + "native_class_id": "cc31aa38366188f51d9a834cf209282ad3dda58f6bd083bd42bcee04891825a9", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "cd04faab508e2dba4e2a06f59fe8869bb82133f76a581331716fc51418b02e93", + "purpose": "truth_provenance" + }, + { + "native_class_id": "d19837767c5600c50941b7f7685fc311c4e1563e531baeafe619c5d41799252f", + "purpose": "truth_provenance" + }, + { + "native_class_id": "d2cc380917b04d1410a88bc2e92f129c6f4300b56c06cab6433e3eee5c12f246", + "purpose": "audit_operations" + }, + { + "native_class_id": "d466a968005e8b81c1b2873cb2f172ca0f034394f76ae0fdf95007cd800546b4", + "purpose": "staging" + }, + { + "native_class_id": "d9bf90520d9634013604e977e9a3155e5a94ec3f7d846124ce9b771e2f3bd8cb", + "purpose": "truth_provenance" + }, + { + "native_class_id": "d9f659ca21ed73e385d63b5c1599ba40d9d98e2267d2f85c194a817f2ad38cee", + "purpose": "truth_provenance" + }, + { + "native_class_id": "db2af848348091fe1d7c40b579016b2a0362fe7533ec98804fa98fcf60dff8f6", + "purpose": "audit_operations" + }, + { + "native_class_id": "db58b6c3a463ad4870fcb0ec6b9fac4b00cd1be4a80d579bc9ca46d619cbcb8a", + "purpose": "referenced_artifact" + }, + { + "native_class_id": "ddb53fbed6e150360165192484e3c820d0f176ca13d71b9c85d513f36958903b", + "purpose": "audit_operations" + }, + { + "native_class_id": "e6d618a8985f73270532ca9773bfbac6461dda6ddd98341f85c57d9c0d19dbd7", + "purpose": "truth_provenance" + }, + { + "native_class_id": "e6fe63a7aec064a276e8480b38e45b37fd689bf5dc21d31514fbf1c699343d29", + "purpose": "adapter_metadata" + }, + { + "native_class_id": "ea8c357e4b0c3e4af47f524bfaffc94a7231ac08ac347bdd6dd0d80fb38f2ec6", + "purpose": "truth_provenance" + }, + { + "native_class_id": "ec252df44880bcf4d3e0b0d6f99b061aa60ed0310631a5130d22fe82e7959d82", + "purpose": "truth_provenance" + }, + { + "native_class_id": "ec851e95d52aa61f2a58e24334ed164b512350e102907c5c6f64b418e974cccf", + "purpose": "referenced_artifact" + }, + { + "native_class_id": "ed313ab1dd45fdc2e129d51c3a824b50bbc8facf3608c10a007a6bd1f9452946", + "purpose": "truth_provenance" + }, + { + "native_class_id": "ed60972fbdbc27ba6952dbd918d4aeada2609d53c474c6515697339c0d2e205c", + "purpose": "truth_provenance" + }, + { + "native_class_id": "ef8ab17e6d87fab0819cf4620754fc706212ebca5287ed79a76b900b48184fdb", + "purpose": "referenced_artifact" + }, + { + "native_class_id": "f088e395a0bfb900e127f2aba2f537154491334b7e0eba85c7edb1364d280b1e", + "purpose": "truth_provenance" + }, + { + "native_class_id": "f09679510c97fb182b3a09744c1d33c1d428ff3e34499bddb0f218cacc68c2ef", + "purpose": "audit_operations" + }, + { + "native_class_id": "f1239dd4bd65df68f95aade59e220e394f409b748e00f568dfd97acfbf2e764b", + "purpose": "referenced_artifact" + }, + { + "native_class_id": "f36c5b4c98d2af8d14c6b8b843fd18d4132e382d9d0cc6513b7e42ad377d47e9", + "purpose": "truth_provenance" + }, + { + "native_class_id": "f92fc20e161eb1dc9d2bbc0886fcbcbf38d3a22f902ee1450fdf66f634fef139", + "purpose": "audit_operations" + }, + { + "native_class_id": "f9b4e6deeba99510dd8597893b61df057343cd46dff582eaa06413f1b596a54c", + "purpose": "projection_origin" + }, + { + "native_class_id": "fcfa3c8322023b8892e04a3ea0ac81a0e84ce3dbe728ff5dc12cfcc32cfb78d8", + "purpose": "privacy_control" + }, + { + "native_class_id": "fd1933d8c3eb23f10859179238b15d97d999d0ddf7528534d1918ed93a1f5f13", + "purpose": "audit_operations" + }, + { + "native_class_id": "fdca8028f368eb3ccb310d2a80c1f8dacb89794d5b9c5a78412dc52638372259", + "purpose": "staging" + }, + { + "native_class_id": "fe438b24446793b0d0380312cc54a593a0fcdcf84889a876fe7a17ba038b4268", + "purpose": "truth_provenance" + }, + { + "native_class_id": "ffb57a726d6964d00c9e26954cb4ef6c6564469e41926c92a738e01138ed3937", + "purpose": "truth_provenance" + } + ], + "schema_profile_digest": "5b7085fb0faaaac007bf652e420c88ca6925e8783ff0fa4e1ef550133c254257", + "source_digest": "aa2769616cc7db8b30e4225b465deb380895c931086b62f640d9aee4fc015814" + }, + "contract": "rememberstack.managed_storage_profile.v1", + "managed_runtime_source_digest": "6666666666666666666666666666666666666666666666666666666666666666", + "mapping": { + "classification_digest": "939a299ca76c6df21a44c13b9c384fa09ba24b233b3b8367947673a0c20ac881", + "contract": "rememberstack.storage_mapping.v1", + "rules": [ + { + "component": "postgres_allocated", + "native_class_id": "007d68f4820d727d19e154bfd5172468513c2222ca61b2476a1deb363a75c520", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "044ec9dcaf142fb30a298d1ab81870e928891e35995364943a1aed639128e615", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "08fa711cd73b924722a4d038f5249345bc7abe996bc0a416db18383ebee3e5bb", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "0cee34b41111b4ce11e944d4510dccb5e97edb2e56a838749371bdeb7939b29c", + "store_binding_id": "raw" + }, + { + "component": "postgres_allocated", + "native_class_id": "0d65a6d0aa9398e59c8b371f96f5d96553df4cade5d5ca597d4b2e4e9a11aa48", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "0eec45f5745b8309f3d2a3e843f35995bd7ccf29729f01d25866bf450e98d3a7", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "0f84fea08613372902cf3a55121793c23ac6134945b2f7e92343fcbe9fa545bd", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "0fb3ae827a975bf9278f3bed7066b4e976999cf6e92d9362e56dd351d8bc7039", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "101a094a68e531d95f2942f4d2b79db1648dd916324bd654fed7d0b29fed22b8", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "18f5abc52e6326573821085782bcf289518e66761b590414771d19f0cee58ace", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "19ca460a0b58bf873c77199ee43157903fa692056b0877125b7ddc2c4fe77901", + "store_binding_id": "forget" + }, + { + "component": "postgres_allocated", + "native_class_id": "1a9686dddb81706f19a92dcd0622c56444dfe1d15e9b521cbbf3d3330a59c615", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "1d473a6a5b8f89c6fa5631cf532eb23969379cd1af44b0a2dc3b7412b760337a", + "store_binding_id": "artifacts" + }, + { + "component": "canonical_object", + "native_class_id": "1eb995d00ec01bb580b0fd40a0a28231d9e09d849a3110ed9fdf33ee04177c90", + "store_binding_id": "raw" + }, + { + "component": "postgres_allocated", + "native_class_id": "1f1eddd4ddc69d66a73cb740ac52c086eb1fb570835d48c594bdaa2ef29e8259", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "23152804509f328bcd63ecf80640d716b816b3138d9d9163c4eed44a8d49b860", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "2382bf468dd9b2593f64394fbed2cbda824bf3fb524f7c388862156e081893f2", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "24d9c28c173b6f7d1406feb1129dc7a7c7ba9b74c4faf25dcabe9889f8017ffa", + "store_binding_id": "postgres" + }, + { + "component": "canonical_object", + "native_class_id": "25bf7d36538251a34023a8951b96296c68d3b2b30248716db1df4acb1ac4eb6c", + "store_binding_id": "artifacts" + }, + { + "component": "postgres_allocated", + "native_class_id": "2755471d8a8015e5fa023414b77dcfa1aa0d06c02f8d2bd624f5a56e4e56cc66", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "287e680499ec94e25dd7f32cc62cb7cc58ca2c5218440a0e4fff60b84ad8065a", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "29e311f3c2b2faf0325ea57c053a1bdab6e0307a39972d9379851545558851bf", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "2ba362a5cfc80a67053fe9c6aeda58159423d411006982ce9b887a622d7bda30", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "2bcfe26b2e2d6484290a3634e3f3b9864033a70dc8160897734df7b12843b442", + "store_binding_id": "postgres" + }, + { + "component": "p3_origin", + "native_class_id": "2f87062786cf1ebfe2cfd968ffa5d917890ffaa53a51160da0e3447400e522b9", + "store_binding_id": "corpus" + }, + { + "component": "postgres_allocated", + "native_class_id": "30ae07477f98239736e89e86e498908d9ef3d177b3f7e1812a917cf33cd3c022", + "store_binding_id": "postgres" + }, + { + "component": "p3_origin", + "native_class_id": "37d6a61ae54b960a76baf4b2daf620f7dcafaa7b3ce41d3a3738901451ca97d9", + "store_binding_id": "corpus" + }, + { + "component": null, + "native_class_id": "39f7f9778a16e938565bc178aebb769cd49682fdb53757c21a6fc6c97bbb53a7", + "store_binding_id": "artifacts" + }, + { + "component": "postgres_allocated", + "native_class_id": "3a4368afbfa3bb62db58adb2fb0cdb3c050226aff1ef63f172813850dbf1207a", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "3aa2dc29e9fc59b1fbb16fc3a2c7bae8503f0a2238342596378a5bbd4aacae58", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "3d0253695555bd13842ed85b2e3ff1018be88a955b97ea3d4c5536dde148e95a", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "3f9882bd5a51113017a54698652c0547627ac325253d2be7eced60827d1383f5", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "41a62a23bd3fe7b0b1a3fbd1e2cc858d73831c9834574225ef5880298fbe66f1", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "41bd895213e7ee727253199ebc3e4c8a4c31bda89862bc8b6013ecc719d205db", + "store_binding_id": "postgres" + }, + { + "component": "canonical_object", + "native_class_id": "4adc529939ddf48377baf0d6d28c1cbf52be8c1df205f2af1ec8351aef489a87", + "store_binding_id": "artifacts" + }, + { + "component": "postgres_allocated", + "native_class_id": "4d631843d1a72ddabad103cd830fd5dc1e9dc98ced6c2b31b197cfb0ac5ac180", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "4e513fe30b801eb61a6abacc5949e4f2b2cdf84284926299236a14bc54da7279", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "50d724d739dbf4b3ae1102e29f9f8991427b835d9438c9b7cf1c283408e6ecc9", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "5364a616d40eef3d07b3df3086a78c81e254bfb880f9f2c6934e0afe82b153d8", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "53cd353573a08f42a416f690138d60e9df7c59420438413d53c8b63e92ee8467", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "53d8f885f9d6fae8add0bf9028908395975e79f842099717d7139a73e41c86d1", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "5728869e8ed1782b67f743410a7b2ec7ed2d9b480013851e2259a7b06fd8da09", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "58af645de336dd16dbb319df951f4a1bd2b1c9edc2f136633c33e954d126b811", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "5996eea739695b314ecd11e770aa10e858c30ddf21ac5f0df7bb2e62ac21278d", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "5aa953c006b43063843841929c47ccfdac1d5dc6d7a139c3f25c0b373679170d", + "store_binding_id": "raw" + }, + { + "component": null, + "native_class_id": "5bc0631494b204494721ca77702ada8b7e45c4bdd30e5ead95554d1fd4a4d32b", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "5eb16c636d4ff6183bf6b038e3b4534fd8d08dec8901b043698bb39de3829401", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "66b6d79937604ad52686bb06cbe19c0666887a17d2a6e2f73571d225438d3d58", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "68c9b5aad31690d6ed30b86338ecac0556b0acfe8bb3e2dff17158a94bcd9dba", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "6e1bcde34cf72176006d16c3606d154954ad9b95f49d63203203f35e95df74ab", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "6e99bf7061da62a8721c9f6a49e54f3058639b977765a4df67bf639ae2b290b3", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "702a8c1251f9b9c6212b8174342a6c74bd2970943d0148d91f7de0f64def5d58", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "70ca039e090a69f321a79ce28d3e58fa161210f4cf57ba736e00c65cd35b05bb", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "718eec380d0490821560f7aa16e4c4aee1b819f59c0e901085ded8da74e2bcbe", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "71efcd1f3527740b64508b32e0b10616d4fa8307a220098ecaddbb4797a3a823", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "72120945bb7e8fb1875e8d81cd4d721fd8d84165c42c27ad343f2af6d3d9bf9c", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "756d6ca2a7cc1be2b98abf05aae2350f5180df70a5288f5ba4de4623d36f3369", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "7d52c29ff2e88329e30374dcca2d18093f5460023c2570b3066d17ac3f1a651e", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "7d69f40e929c419fbb3b3f6cc3a49daf511dd90358b5ca4d1da5905d7dba3e95", + "store_binding_id": "postgres" + }, + { + "component": "canonical_object", + "native_class_id": "7e18c1cbf0a09a697207b77ec971101c9299ea4d208d0f600c0d0e61d043870c", + "store_binding_id": "artifacts" + }, + { + "component": "postgres_allocated", + "native_class_id": "7e2e94aeda6dcce0f19dd40be74aa1f81f550b0380e95570d312c1fa6763bb32", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "7f1bf2ae90a7e4cadc0f2ac4fe595ebc3250e291a334309c3ef25d5d1aaa6836", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "80ef68961b8cc8044b597b4c4ec04abc0d327979151e41ce335e6e45140de98c", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "81ac981ba0c8d93c89cf4e3ceed44748a3fd230f573b333a92aa7bbd859e5072", + "store_binding_id": "postgres" + }, + { + "component": "canonical_object", + "native_class_id": "85241cbfb2089c18a02f465a423444433a6e78e047db07cbb53af57f7cb73674", + "store_binding_id": "artifacts" + }, + { + "component": "postgres_allocated", + "native_class_id": "86305cced2ed68ee65399ffeb490009c86d11db6ce41015487e65bf2f0916ef0", + "store_binding_id": "postgres" + }, + { + "component": "canonical_object", + "native_class_id": "89b56815c8a21f484cb4dcbd5ae35605f1ebe879875bfee12f1b8f70f30a33f1", + "store_binding_id": "artifacts" + }, + { + "component": "p3_origin", + "native_class_id": "8ed87ade6387efd0f4c58f6934d990512d4cdd6f893137130f9a74b2de57e6cb", + "store_binding_id": "corpus" + }, + { + "component": "postgres_allocated", + "native_class_id": "8f1c9de220f26cfa48b14bc08749cd495e3d8bb930d2adcc072fffe266b630ed", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "92b0cc803816c4985c4ddea87165192e2facf463af56b5463a65514737c903c3", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "94dbbf109e06061786430bc767111f0ceb499717bfe1a428346bf3a33a0de6a1", + "store_binding_id": "artifacts" + }, + { + "component": null, + "native_class_id": "9808d804724f7aa9aab6072306cb35c7f5061091d095f654f2aa9db64590829a", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "9a338a4086d8bb2cfa0f6719f0016c5c8dc23081f7b6d5a9c7516d279ff61bf7", + "store_binding_id": "artifacts" + }, + { + "component": null, + "native_class_id": "9a338a4086d8bb2cfa0f6719f0016c5c8dc23081f7b6d5a9c7516d279ff61bf7", + "store_binding_id": "corpus" + }, + { + "component": null, + "native_class_id": "9a338a4086d8bb2cfa0f6719f0016c5c8dc23081f7b6d5a9c7516d279ff61bf7", + "store_binding_id": "forget" + }, + { + "component": null, + "native_class_id": "9a338a4086d8bb2cfa0f6719f0016c5c8dc23081f7b6d5a9c7516d279ff61bf7", + "store_binding_id": "raw" + }, + { + "component": null, + "native_class_id": "9b7902a64a49b222b5cf5d9a4167c710f2374395fc698aaa4688841f0f4700f9", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "9edb8f7fa0f1babe298706a35f53427cfab7ece8f89ad04b9c5fd1afe5494b76", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "a1814ab88563a5452e9cc59a57993ea94d4a8d5146d3f50ce532dd7027ff178c", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "a1ab9f23ec27e55685185f26a6a7dc87def133070c6d5d55c6b67ebdf630d767", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "a4a2de29eb70c0461fe71f6408468ae8bd2a734e59afaf8799f88f950d4bc4b0", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "a74b2b9c8562f560d5ed2d1159f801c01778137abfc8b509f6dfbebf8d10d868", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "b0e90e177c457000d60b8b535c1d4690d51f52a79c64785ffa9dfe347a12943a", + "store_binding_id": "artifacts" + }, + { + "component": "postgres_allocated", + "native_class_id": "b467512e185449766c693aa13f27f56626c9d08f06e50850c15218d98dfb0bb9", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "b929de99c5233a6051bfc535316753915ea6b13ee67a2ca7616f7ec3e899b7a6", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "ba761847100ae259cea49d9f781e1f4b043bd69494e54df7cf0229ef9903d9a0", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "bb4013371712004ebaabfb6fedfef19c5752114f510da2ac01e478d353f79379", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "bd243e6625453916fbe7ce391f6d7cab377858d5cc8d8abf1ec6e3efa6ac0ad6", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "bd2ab2ec0f386d451e57df2f8d20b158ac9beb17274c4605e51720ad6e25d8de", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "be08185e503972f1b82786d3412cfd82770dfe4aef0c17a1ebac29b65c9a65fa", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "c3a16d749378891eb43acf0f599be95a33a3d7b4e0c617e7a77c4cb80bfdb29f", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "c3d9a531e7c23233549a319a6be47eb9e5a18a35eecdcfa9e352498a09a8e2c3", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "c47416508fe973f327d5927f300362bcb7341e1c08a7fa337c64dd1d6d948785", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "c8e57437f11507ef7b9ff57d1364693db9a5e290bf57be992d20ffffe6a4465f", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "c9316ba8454850f22cb27c644a6f5e33dcae8b5978c17371b528c1b97abc5027", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "cc31aa38366188f51d9a834cf209282ad3dda58f6bd083bd42bcee04891825a9", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "cd04faab508e2dba4e2a06f59fe8869bb82133f76a581331716fc51418b02e93", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "d19837767c5600c50941b7f7685fc311c4e1563e531baeafe619c5d41799252f", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "d2cc380917b04d1410a88bc2e92f129c6f4300b56c06cab6433e3eee5c12f246", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "d466a968005e8b81c1b2873cb2f172ca0f034394f76ae0fdf95007cd800546b4", + "store_binding_id": "corpus" + }, + { + "component": "postgres_allocated", + "native_class_id": "d9bf90520d9634013604e977e9a3155e5a94ec3f7d846124ce9b771e2f3bd8cb", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "d9f659ca21ed73e385d63b5c1599ba40d9d98e2267d2f85c194a817f2ad38cee", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "db2af848348091fe1d7c40b579016b2a0362fe7533ec98804fa98fcf60dff8f6", + "store_binding_id": "artifacts" + }, + { + "component": "canonical_object", + "native_class_id": "db58b6c3a463ad4870fcb0ec6b9fac4b00cd1be4a80d579bc9ca46d619cbcb8a", + "store_binding_id": "artifacts" + }, + { + "component": null, + "native_class_id": "ddb53fbed6e150360165192484e3c820d0f176ca13d71b9c85d513f36958903b", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "e6d618a8985f73270532ca9773bfbac6461dda6ddd98341f85c57d9c0d19dbd7", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "e6fe63a7aec064a276e8480b38e45b37fd689bf5dc21d31514fbf1c699343d29", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "ea8c357e4b0c3e4af47f524bfaffc94a7231ac08ac347bdd6dd0d80fb38f2ec6", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "ec252df44880bcf4d3e0b0d6f99b061aa60ed0310631a5130d22fe82e7959d82", + "store_binding_id": "postgres" + }, + { + "component": "canonical_object", + "native_class_id": "ec851e95d52aa61f2a58e24334ed164b512350e102907c5c6f64b418e974cccf", + "store_binding_id": "artifacts" + }, + { + "component": "postgres_allocated", + "native_class_id": "ed313ab1dd45fdc2e129d51c3a824b50bbc8facf3608c10a007a6bd1f9452946", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "ed60972fbdbc27ba6952dbd918d4aeada2609d53c474c6515697339c0d2e205c", + "store_binding_id": "postgres" + }, + { + "component": "canonical_object", + "native_class_id": "ef8ab17e6d87fab0819cf4620754fc706212ebca5287ed79a76b900b48184fdb", + "store_binding_id": "artifacts" + }, + { + "component": "postgres_allocated", + "native_class_id": "f088e395a0bfb900e127f2aba2f537154491334b7e0eba85c7edb1364d280b1e", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "f09679510c97fb182b3a09744c1d33c1d428ff3e34499bddb0f218cacc68c2ef", + "store_binding_id": "postgres" + }, + { + "component": "canonical_object", + "native_class_id": "f1239dd4bd65df68f95aade59e220e394f409b748e00f568dfd97acfbf2e764b", + "store_binding_id": "artifacts" + }, + { + "component": "postgres_allocated", + "native_class_id": "f36c5b4c98d2af8d14c6b8b843fd18d4132e382d9d0cc6513b7e42ad377d47e9", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "f92fc20e161eb1dc9d2bbc0886fcbcbf38d3a22f902ee1450fdf66f634fef139", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "f9b4e6deeba99510dd8597893b61df057343cd46dff582eaa06413f1b596a54c", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "fcfa3c8322023b8892e04a3ea0ac81a0e84ce3dbe728ff5dc12cfcc32cfb78d8", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "fd1933d8c3eb23f10859179238b15d97d999d0ddf7528534d1918ed93a1f5f13", + "store_binding_id": "postgres" + }, + { + "component": null, + "native_class_id": "fdca8028f368eb3ccb310d2a80c1f8dacb89794d5b9c5a78412dc52638372259", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "fe438b24446793b0d0380312cc54a593a0fcdcf84889a876fe7a17ba038b4268", + "store_binding_id": "postgres" + }, + { + "component": "postgres_allocated", + "native_class_id": "ffb57a726d6964d00c9e26954cb4ef6c6564469e41926c92a738e01138ed3937", + "store_binding_id": "postgres" + } + ], + "store_binding_digest": "e65a24fea35f132abbafaee8eb0f7421577234c011f86c911bcc1b0bf0c029ae" + }, + "native": { + "clock_error_us": "1000", + "clock_profile_digest": "5555555555555555555555555555555555555555555555555555555555555555", + "profile_digest": "da6ca69bfc642b63b03c5de24a21fbd5d3f950641d296d3305a70025b01a8158", + "release_margin_us": 500000, + "schema_digest": "8459dcb2974fdcb586e76dc36c19c3ce429b39e26a6cc42af89cbc034be56b27", + "schema_profile_digest": "5b7085fb0faaaac007bf652e420c88ca6925e8783ff0fa4e1ef550133c254257", + "source_digest": "aa2769616cc7db8b30e4225b465deb380895c931086b62f640d9aee4fc015814", + "view_lifetime_ms": 30000 + }, + "provider_clock_profile_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", + "provider_profile_digest": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" + }, + "request": { + "classification_digest": "939a299ca76c6df21a44c13b9c384fa09ba24b233b3b8367947673a0c20ac881", + "contract": "rememberstack.storage_capture_request.v1", + "cut_at_unix_us": "1800000000000000", + "deployment_id": "00000000000000000000000000000001", + "native_capture_profile_digest": "da6ca69bfc642b63b03c5de24a21fbd5d3f950641d296d3305a70025b01a8158", + "operator_mapping_digest": "f13802c3269b379c3e887e7df4dd8b104784ea745b44ec24dc22587ab8f83b5e", + "schema_profile_digest": "5b7085fb0faaaac007bf652e420c88ca6925e8783ff0fa4e1ef550133c254257", + "store_binding_digest": "e65a24fea35f132abbafaee8eb0f7421577234c011f86c911bcc1b0bf0c029ae" + }, + "schema": { + "catalog": { + "EXPECTED_CONSTRAINT_COUNTS": { + "c": 119, + "f": 148, + "n": 643, + "p": 85, + "t": 7, + "u": 41 + }, + "EXPECTED_ENUMS": [ + "adjudication_method", + "adjudication_outcome", + "alias_provenance", + "claim_temporal_class", + "claim_valid_kind", + "claim_valid_precision", + "crossref_binding", + "crossref_kind", + "crossref_origin", + "currency_reason", + "decision_actor", + "deployment_status", + "document_origin", + "document_status", + "entity_status", + "eval_suite", + "evidence_stance", + "extraction_decision_type", + "forget_manifest_status", + "golden_hardness", + "golden_label", + "grounding_audit_status", + "ingest_principal_kind", + "knowledge_artifact_status", + "knowledge_evidence_role", + "knowledge_layer", + "knowledge_page_kind", + "knowledge_rule_kind", + "knowledge_trigger", + "ontology_status", + "ontology_tier", + "pipeline_component", + "pipeline_stage", + "plan_action", + "plan_decision_status", + "plan_trigger", + "processing_defer_reason", + "processing_lane", + "processing_status", + "processing_target", + "projection_plane", + "assured_answer_intent", + "assured_operation_name", + "assured_output_grain", + "assured_result_contract", + "refresh_status", + "relation_status", + "saved_query_assurance", + "saved_query_origin", + "saved_query_status", + "resolution_exclusion_basis", + "resolution_tier", + "review_item_kind", + "review_status", + "review_verdict", + "rule_key_kind", + "scope_interest_kind", + "section_role", + "selection_drop_reason", + "selection_outcome", + "skeleton_check_outcome", + "snapshot_status", + "structure_route_tag", + "subscription_status", + "surface_cost_kind", + "surface_cost_outcome", + "versioning_mode" + ], + "EXPECTED_EXTENSIONS": [ + "btree_gist", + "fuzzystrmatch", + "pg_partman", + "pg_textsearch", + "pg_trgm", + "pgcrypto", + "unaccent", + "vector" + ], + "EXPECTED_HASH_PARENTS": [ + "document_entity_bindings", + "observation_evidence", + "relation_evidence" + ], + "EXPECTED_INDEXES": [ + "ix_adjud_live", + "ix_adjud_relation", + "ix_aliases_entity", + "ix_aliases_lemma_dm", + "ix_aliases_lemma_exact", + "ix_aliases_lemma_trgm", + "ix_application_context_entity", + "ix_chunkclaims_claim", + "ix_chunk_search_bm25", + "ix_chunk_search_embedding_hnsw", + "ix_chunks_doc", + "ix_chunks_reuse", + "ix_chunks_reuse_identity", + "ix_chunks_section", + "ix_chunks_version", + "ix_claims_audit", + "ix_claims_chunk", + "ix_claims_current", + "ix_claims_current_bm25", + "ix_claims_current_embedding_hnsw", + "ix_claims_doc", + "ix_claims_flagged", + "ix_claims_valid_window", + "ix_cost_budget_window", + "ix_cost_export", + "ix_crossrefs_from", + "ix_crossrefs_incoming", + "ix_crossrefs_pending", + "ix_currency_claim", + "ix_currency_doc", + "ix_cxd_chunk", + "ix_cxd_drops", + "ix_docreps_version", + "ix_document_metadata_family", + "ix_document_metadata_thread", + "ix_document_names_bm25", + "ix_document_names_trgm", + "ix_document_people_address", + "ix_document_people_name", + "ix_documents_entity", + "ix_documents_live", + "ix_docversions_doc", + "ix_docversions_hash", + "ix_docversions_status", + "ix_effective_periods_lineage", + "ix_entities_name_trgm", + "ix_entities_embedding_hnsw", + "ix_entities_redirect", + "ix_entity_types_parent", + "ix_eval_suite_ver", + "ix_forget_content_guard", + "ix_forget_source_guard", + "ix_grounding_claim", + "ix_kae_claim_coordinate", + "ix_kae_doc", + "ix_kae_relation", + "ix_kartifacts_parent", + "ix_kartifacts_scope", + "ix_kartifacts_stale", + "ix_kcompilations_artifact", + "ix_kdispatch_pending", + "ux_kdispatch_pending_subscription", + "ix_kplan_proposed", + "ix_kplan_runs_deployment", + "ix_krefresh_runnable", + "ux_krefresh_open_authored_review", + "ix_krule_keys_lookup", + "ix_kwatch_watched", + "ix_mentions_claim", + "ix_mentions_deployment_chunk", + "ix_mentions_doc", + "ix_merge_absorbed", + "ix_merge_survivor", + "ix_merge_trigger", + "ix_obsadjud_live", + "ix_obsadjud_observation", + "ix_observations_block", + "ix_observations_contradiction", + "ix_observations_entity", + "ix_observations_embedding_hnsw", + "ix_obsevidence_claim", + "ix_predicates_other", + "ix_procstate_dlq", + "ix_procstate_due", + "ix_procstate_running_lease", + "ix_procstate_target", + "ix_relations_block_obj", + "ix_relations_block_subj", + "ix_relations_contradiction", + "ix_relations_live", + "ix_relations_embedding_hnsw", + "ix_relations_predicate", + "ix_relevidence_claim", + "ix_resdec_entity", + "ix_resdec_entity_live", + "ix_resdec_live", + "ix_resdec_mention", + "ix_review_pending", + "ix_sections_doc", + "ix_sections_doc_key", + "ix_sections_parent", + "ix_sections_role", + "ix_selection_results_representation", + "ix_selection_results_reuse", + "ix_skeleton_checks_representation", + "ix_structure_generations_representation", + "ix_surface_cost_export", + "ix_version_scope_in_force", + "ix_version_scope_lineage", + "ux_docversions_version_key", + "ux_effective_periods_live_start", + "ux_kae_link", + "ux_kquarantine_open_artifact", + "ux_kwatch", + "ux_reference_generations_active", + "ux_sections_key", + "ux_snapshot_latest" + ], + "EXPECTED_RANGE_PARENTS": { + "chunk_claims": "created_at", + "chunks": "created_at", + "claim_extraction_decisions": "decided_at", + "mentions": "created_at", + "resolution_decisions": "decided_at", + "surface_cost_ledger": "occurred_at", + "testimony_currency_events": "occurred_at" + }, + "EXPECTED_TABLES": [ + "aliases", + "application_context_bindings", + "canary_cases", + "chunk_claims", + "chunk_search", + "chunks", + "claim_extraction_decisions", + "claims", + "connector_sync_cycles", + "content_objects", + "cost_ledger", + "deployment_extension_packs", + "deployment_processing_layers", + "deployments", + "document_crossrefs", + "document_effective_periods", + "document_effective_time_events", + "document_entity_bindings", + "document_metadata", + "document_names", + "document_people", + "document_reference_generations", + "document_representations", + "document_skeleton_checks", + "document_sections", + "document_structure_generations", + "document_version_scope", + "document_versions", + "documents", + "entities", + "entity_types", + "eval_runs", + "extension_packs", + "forget_manifests", + "fact_applications", + "fact_window_review_attempts", + "normalization_outputs", + "golden_claim_labels", + "golden_pairs", + "grounding_audits", + "knowledge_artifact_evidence", + "knowledge_artifacts", + "knowledge_compilations", + "knowledge_dispatches", + "knowledge_page_rules", + "knowledge_page_watches", + "knowledge_plan_decisions", + "knowledge_plan_runs", + "knowledge_quarantines", + "knowledge_refresh_queue", + "knowledge_rule_keys", + "knowledge_subscriptions", + "mentions", + "normalize_observation_staging", + "merge_events", + "obs_flush_entity_units", + "obs_flush_version_state", + "p1_search_channels", + "observation_adjudications", + "observation_evidence", + "observations", + "perimeter_state", + "pipeline_component_versions", + "predicates", + "processing_layer_gaps", + "processing_state", + "projection_snapshots", + "relation_adjudications", + "relation_evidence", + "relations", + "resolution_decisions", + "resolution_exclusions", + "resolver_versions", + "assured_operations", + "review_queue", + "saved_queries", + "saved_query_audit", + "saved_query_registry_state", + "saved_query_versions", + "scope_interests", + "scopes", + "selection_results", + "surface_cost_ledger", + "surface_cost_meter_state", + "testimony_currency_events" + ], + "EXPECTED_VIEWS": [ + "v_cost_receipts", + "v_graph_survivor", + "v_memory_entity_survivor", + "v_memory_evidence_lineage_live", + "v_memory_fact_claim_live", + "v_memory_claim_carried_periodised", + "v_memory_fact_source_qualified", + "v_memory_fact_visible", + "v_memory_mention_current_content", + "v_memory_page_citation_visible" + ] + }, + "extensions": [ + "btree_gist=1.9", + "fuzzystrmatch=1.2", + "pg_partman=5.5.0", + "pg_textsearch=1.5.1", + "pg_trgm=1.6", + "pgcrypto=1.4", + "plpgsql=1.0", + "unaccent=1.1", + "vector=0.8.6" + ], + "guard_roots": [ + "alembic_version", + "aliases", + "application_context_bindings", + "assured_operations", + "canary_cases", + "chunk_claims", + "chunk_search", + "chunks", + "claim_extraction_decisions", + "claims", + "connector_sync_cycles", + "content_objects", + "cost_ledger", + "deployment_extension_packs", + "deployment_processing_layers", + "deployments", + "document_crossrefs", + "document_effective_periods", + "document_effective_time_events", + "document_entity_bindings", + "document_metadata", + "document_names", + "document_people", + "document_reference_generations", + "document_representations", + "document_sections", + "document_skeleton_checks", + "document_structure_generations", + "document_version_scope", + "document_versions", + "documents", + "entities", + "entity_types", + "eval_runs", + "extension_packs", + "fact_applications", + "fact_window_review_attempts", + "forget_manifests", + "golden_claim_labels", + "golden_pairs", + "grounding_audits", + "ingest_principals", + "knowledge_artifact_evidence", + "knowledge_artifacts", + "knowledge_compilations", + "knowledge_dispatches", + "knowledge_page_rules", + "knowledge_page_watches", + "knowledge_plan_decisions", + "knowledge_plan_runs", + "knowledge_quarantines", + "knowledge_refresh_queue", + "knowledge_rule_keys", + "knowledge_subscriptions", + "managed_ingest_measurements", + "managed_ingest_outcomes", + "mentions", + "merge_events", + "normalization_outputs", + "normalize_observation_staging", + "obs_flush_entity_units", + "obs_flush_version_state", + "observation_adjudications", + "observation_evidence", + "observations", + "p1_search_channels", + "part_config", + "part_config_sub", + "perimeter_state", + "pipeline_component_versions", + "predicates", + "processing_layer_gaps", + "processing_state", + "projection_snapshots", + "relation_adjudications", + "relation_evidence", + "relations", + "resolution_decisions", + "resolution_exclusions", + "resolver_versions", + "review_queue", + "saved_queries", + "saved_query_audit", + "saved_query_registry_state", + "saved_query_versions", + "scope_interests", + "scopes", + "selection_results", + "surface_cost_ledger", + "surface_cost_meter_state", + "template_public_chunk_claims", + "template_public_chunks", + "template_public_claim_extraction_decisions", + "template_public_mentions", + "template_public_resolution_decisions", + "template_public_surface_cost_ledger", + "template_public_testimony_currency_events", + "testimony_currency_events" + ], + "head": "p9_52_0073", + "migrations": { + "__init__.py": "6c0a82ef11830b8d5cb49eac5ac1f0d2e967699377fab1cb34d751585c97366c", + "p0_02_0001_extensions_enums.py": "d52a438d07c205fe7645249f286f1d7a8edde1215b0298cadc69d34eb999747d", + "p0_02_0002_infrastructure_registries.py": "7b9929014065629100cedec18fee50049865619d72d06171d905d0bf1c6ddffe", + "p0_02_0003_entities_evaluation_e0_e1.py": "42cfb39ee1848ec7b248166d9d0d40fbd35efa71cd9f82c276d801107c70833c", + "p0_02_0004_claims_facts_evidence.py": "ad33c54c7e142f327d2ef46bd5eb811cce7bcd174b1b0a3e25ad03bf49795375", + "p0_02_0005_projection_knowledge_retrieval.py": "0b0d6acb1509076257dfb27ef16f4fc09c171120a4ad6671b2875b5fa1627584", + "p0_02_0006_partitions_views.py": "a553999fd0189879b56ba65205865d8cdbc7ffaddf7d79d6b54b5e17be5fb039", + "p1_03_0018_claimify_loss_ledger.py": "96af6b4af378f622b9c8ba5bbfdcb9f43f74eb80c2f258d72dd75e9dff7edeb8", + "p1_04_0019_d79_structure_generations.py": "d30ba3d4375d9588dcd2ae33847d8dddb717f9721af192bd290afb6daafd0512", + "p2_06_0007_invalidated_outcome.py": "044ff502cdba127b2167f55903de47ab263df811208cab617bebbe4b429adaf1", + "p3_01_0008_document_version_target.py": "4ae4e00526a7f38b44ef29ed690027762ee7959fb7ec1ebe88d20bd1e503e638", + "p3_05_0009_reconcile_stage.py": "6daf8f8104f296ad47a570ed91578209033491436b2431242bf931103c8fd9af", + "p3_07_0010_lifecycle_eval_suite.py": "d4ba2a8aaea1a37dde33b58690d6fbc7ce251c21a5e3396eb536484ea9c20855", + "p4_01_0011_survivor_view_rewrite.py": "f3c88efb53d61555ce50a2a7d861d49e57b78d1a2c57c713af5eff7f163ada6f", + "p5_07_0020_retrieval_batch_b_indexes.py": "009eb5c1206c2cd062ccfe7ee91699624d2ce2dec428178ea43e80fbd89ff378", + "p6_02_0012_knowledge_compile_recovery.py": "d19a9d414dfeba792f7dfadf7d54c716c3ffee9c1c03195abc708ce6360f24cb", + "p6_04_0013_knowledge_writer_ledger.py": "ecd8c3b12970d957aa1a8c5447fbec278824cd845d3a963b17671b4b35150969", + "p6_05_0014_knowledge_planner_runtime.py": "8cb851cb4e2471e827f466becb70b41332eda08147bfc56d02abcdf471f17c19", + "p6_06_0015_authored_dispatch_runtime.py": "431a9d6a8a2c1d141d68fe92b03524a4020db688101f3a6d35f0cdc7f84b4c9d", + "p7_02_0016_operational_eval_suite.py": "999dd6b77531371670e160d3f98531ccc098edea69171edac9c0a13002b3ffed", + "p7_05_0017_hard_forget.py": "6052c3be64afe6a282b4aec9edaebb8cf3ff3151ad54edcfb19057499c6f4530", + "p8_01_0021_d80_embedding_input.py": "02b0bc8350f780bc38a0313272e63356b90e2ada51a2504cf373796b0fae006f", + "p8_01_0022_d80_packaging_fields.py": "bc02fef4d16419f81acdcc55a88b66e1d49b206c24875f75c7a4545a081cae01", + "p9_01_0022_memory_v1_query_space.py": "6eb1f5d5dd7c453e19fd279d4ed56e3012038009aa418594dd2e66d7de39350e", + "p9_02_0023_query_space_roles.py": "e5da2a0970f88f8d74f2554ae56e955dbc9ef6fb36422694670e5912b097be0e", + "p9_03_0024_facts_as_of.py": "c5542144cf61185880965bc88c5070174364d6525a7513e5a953aa2e1b4c937f", + "p9_04_0025_coordinate_binding.py": "b992281ddfaecf8da75df370c3ff90ca2d82669369a2220fbda1932bc40e398e", + "p9_05_0026_graph_helpers.py": "fad7cfbba43b62a03db5b078dd8a2c074394074f32ca5853ac9cf9495c65cc58", + "p9_06_0027_saved_query_registry.py": "03fba3b4a2b4c08e21fe45e3cc3935687d058dafa2dff880002054a274f555c5", + "p9_07_0028_chunk_extract_indexes.py": "2bb23b9aaf3d3f35f7fa846bcc1b7534f10604b7f84c7eac3f577ad68bb83a46", + "p9_08_0029_normalize_claim_fanout.py": "e13cc30c99119f70bef9d04243349ad39c5b661a02f522e04de50ff6c7f2bfaa", + "p9_09_0030_fact_authority_performance.py": "3eb1bd95e54877e3a1e86cd704d40b93354074a81cb3af310c9748a313856613", + "p9_10_0031_entity_obs_flush_fanout.py": "e7335eb5e3701f1e7b4bba0e5f3704e23416cff5436599e4a7696f9e2e7367e9", + "p9_11_0032_surface_cost_ledger.py": "219620b27f9e9e4aca4666f5536515ad520d83358b84b7a8dd6e0579abc9a639", + "p9_13_0034_postgres_p1_search.py": "1c13f6881705c1aa4426ebbcf299227c3e6dad4ea75682a477a10601c06a7432", + "p9_14_0035_drop_entity_type.py": "b419e64cffd372fa8f1ac4cf8d0300c4d8764ae174d7301d52338e8e573c532a", + "p9_15_0036_global_resolution_eval.py": "f17ad5a8221c382f859de4b2ee7c8b37cf8aeb50d8dde5b21358a9ad9e9706c0", + "p9_16_0037_entity_profile_projection.py": "66cb76281aeb6525a77b5c2919acb566f9310a6bbd6ba2b53d6ad11d7062abcf", + "p9_17_0038_postgres19_live_graph.py": "34606b43a7a04a23b8ecda04aa6ab4572e33177014f4b212e3e09fac731650f3", + "p9_18_0039_graph_entity_provenance_plan.py": "9a15d3dc20738416cd568664f9e1787f51e9195a54a7b10a7d53306ce8ac7cb4", + "p9_19_0040_graph_tenant_planner_settings.py": "b0edb0d7e3242396feda06e5ab9111f1b168563409c837902420328df6ed9784", + "p9_20_0041_resolution_uncertainty.py": "0b851abd7b8eb4ae1c321ec30c114641c63674bbe5c1842c6d23e7d48827a533", + "p9_21_0042_ingest_principal.py": "b09b93758a6fbb7ae7d97703ccabf8345061f6df562ade3c42f18bf9be468826", + "p9_22_0043_document_entity_bindings.py": "76d23b26645f412a1a243c0c096c9dcf543e3ff5fa23ebb32ac78b09d4302576", + "p9_23_0044_drop_generic_identifier_guard.py": "474148f337353e834debba9e9723201e14906c99ff8acc2efb8ede4ba69bb672", + "p9_24_0045_managed_text_metering.py": "d1f29f87c1bfc85858fd8cd3a8debb84e5001c8b40f68a8aafd1bc4d990d0dd8", + "p9_25_0046_document_inventory_order.py": "e99c3ef3ba365d5e2378f315fd6dac46c0afc68a26c6abb57ed18ba5d3d124b6", + "p9_26_0047_canonical_bounds.py": "7f2a54a284b757a613af3a9ca0596faddddd9206fb83a5fbefdda6c6afea937a", + "p9_27_0048_query_space_canonical_bounds.py": "83960e3ee22723468a430efc598db5afb6569a947dbcbb7d153edd8e6906db0f", + "p9_28_0049_context_operation_names.py": "62bae9e7be45537693c94448ec6e9471f993059b817e2e1bcae51faa951ee4af", + "p9_29_0050_no_route_defer_reason.py": "6d4641d713bab02164015b0d38d5aee3ca75d7f5dac1f36d39e938d886cd71c7", + "p9_30_0051_mutable_fact_windows.py": "a1556055c60d67006e5498cd5bc15c4314ed307b61b6289680c2063bb748432f", + "p9_31_0052_multi_span_claim_evidence.py": "e93ca491aca4304e9bdb64afe63795fae46877fcf395b369f92556608ace50fa", + "p9_32_0053_source_reference_context.py": "0cbc0088d59990cd721589ae69e59aadcab5544c11b490ae09feea4e389d24fd", + "p9_33_0054_perimeter_state.py": "936e3f9998d6eec2e81d33e92e3a0cecc61ee22f536a83297b237c3e3b4be34a", + "p9_34_0055_embedding_model_indexes.py": "2bd330e868726babadd6006cf8e9c8213c26934366cd67a60a0158b182e64d2a", + "p9_35_0056_document_metadata.py": "1d848699e8fdc9f47dd75404f8df56ee3397d3f0b6b63955073c3c31661b83d2", + "p9_36_0057_own_document_name_span.py": "342a1050b7a01c8e42717310b841907c05388140f7f45ad6d9b676a3fba2cafc", + "p9_37_0058_extraction_eligibility.py": "fe8ea5cf632ebcd153fbe05698b4c364a839932eb336e731c74e9632a0959f46", + "p9_38_0059_d140_effective_time.py": "00dabcd91a8807240a2f6b2692d588a8675ba1cc624a5557343cce60be76354b", + "p9_39_0060_d140_period_window_review.py": "e2b7ebe89097aca3da748139da05e9b63ca497adfc88de544a0d5fc73b70eb6d", + "p9_40_0061_citation_path_projection.py": "1cc76784bf2ef1cc69a5bfe710b54c83beaae92cef61a70957a404b62e9ffc52", + "p9_41_0062_processing_layers.py": "d07fc0409b2a202b7e6c7ff293ac4802ac0f17dbb3eebf68332625e7fe008979", + "p9_42_0063_entity_counts_demand.py": "1e8a0dfb4dcc4018d0ca9f8d35fae0f1bb81957ee179126d3f6229ec23f78109", + "p9_43_0064_claim_leases.py": "921e84fd940b0050cfca6af71d6570f049a38a5beaed9ca93b7586113a3e7b88", + "p9_44_0065_drop_property_graphs.py": "b1e93ee583d1780f9b77752154d38495ac2402fb20cb0757c79e2a5b64c4b69b", + "p9_45_0066_fact_counts_demand.py": "34bc365f01b18f76fd061c48b53f40499f6a0c9b952f384272024f16059f2a71", + "p9_46_0067_generic_meter.py": "b04141b59c33d519ea7527bcb775d6b435507445c1fb4c0b3741804ecd2a2636", + "p9_47_0068_mention_chunk_lookup.py": "ff3bc78538b3cdb1b32b4136f2c9add72cb172302ef0c7ba3103aebecbbc19c1", + "p9_48_0069_shared_eligibility.py": "88361a8676a6d4103081dfc2e7a8fb360c2cc41ba08a3e2cdb04cfd3b20f4bec", + "p9_49_0070_corpus_publication_marker.py": "a3a976f504ba0f41f156989e4d347b7d42f8df6da07e54c1843ce8d3c411696e", + "p9_50_0071_corpus_publication_work.py": "2e44caec296f2e2437a0b7176b9850398fb30467b819cf17c1cbc7d1b74ceaeb", + "p9_51_0072_corpus_paths.py": "43840fe88f2a637bc48517174fadd273eb5eb88eeb51e60505824306a927d668", + "p9_52_0073_corpus_reconcile.py": "2c5593ed0f388f835f8c08da880ee15e7825aca44208db41ef881291739f7255" + }, + "records": { + "NativeCatalogAcquisition": { + "$defs": { + "NativeCatalogIdentity": { + "additionalProperties": false, + "description": "Actual session, virtual transaction and MVCC snapshot, without handoff.", + "properties": { + "backend_pid": { + "exclusiveMinimum": 0, + "title": "Backend Pid", + "type": "integer" + }, + "database_name": { + "title": "Database Name", + "type": "string" + }, + "database_oid": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Database Oid", + "type": "string" + }, + "postmaster_started_unix_us": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Postmaster Started Unix Us", + "type": "string" + }, + "session_login": { + "title": "Session Login", + "type": "string" + }, + "snapshot_identity": { + "title": "Snapshot Identity", + "type": "string" + }, + "virtual_transaction_id": { + "title": "Virtual Transaction Id", + "type": "string" + } + }, + "required": [ + "session_login", + "database_name", + "database_oid", + "postmaster_started_unix_us", + "backend_pid", + "virtual_transaction_id", + "snapshot_identity" + ], + "title": "NativeCatalogIdentity", + "type": "object" + }, + "NativeStorageConfiguration": { + "additionalProperties": false, + "description": "Private native store roots; these do not repair an incomplete binding.", + "properties": { + "artifacts_bucket": { + "format": "password", + "title": "Artifacts Bucket", + "type": "string", + "writeOnly": true + }, + "corpusfs_bucket": { + "format": "password", + "title": "Corpusfs Bucket", + "type": "string", + "writeOnly": true + }, + "knowledge_repo_uri": { + "anyOf": [ + { + "format": "password", + "type": "string", + "writeOnly": true + }, + { + "type": "null" + } + ], + "title": "Knowledge Repo Uri" + }, + "raw_bucket": { + "format": "password", + "title": "Raw Bucket", + "type": "string", + "writeOnly": true + } + }, + "required": [ + "raw_bucket", + "artifacts_bucket", + "corpusfs_bucket", + "knowledge_repo_uri" + ], + "title": "NativeStorageConfiguration", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Original session plus native scope materialised only after release.", + "properties": { + "deployment_id": { + "anyOf": [ + { + "format": "uuid", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Deployment Id" + }, + "identity": { + "$ref": "#/$defs/NativeCatalogIdentity" + }, + "storage": { + "anyOf": [ + { + "$ref": "#/$defs/NativeStorageConfiguration" + }, + { + "type": "null" + } + ] + } + }, + "required": [ + "identity", + "deployment_id", + "storage" + ], + "title": "NativeCatalogAcquisition", + "type": "object" + }, + "NativeCorpusPage": { + "$defs": { + "CorpusDocument": { + "description": "One served reading, selected within a consistent database read.", + "properties": { + "content_hash": { + "title": "Content Hash", + "type": "string" + }, + "conversion_uri": { + "title": "Conversion Uri", + "type": "string" + }, + "corpus_published_revision": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Corpus Published Revision" + }, + "deployment_id": { + "format": "uuid", + "title": "Deployment Id", + "type": "string" + }, + "doc_id": { + "format": "uuid", + "title": "Doc Id", + "type": "string" + }, + "family": { + "title": "Family", + "type": "string" + }, + "file_name": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "File Name" + }, + "lineage_title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Lineage Title" + }, + "manifest_hash": { + "title": "Manifest Hash", + "type": "string" + }, + "markdown_hash": { + "title": "Markdown Hash", + "type": "string" + }, + "markdown_uri": { + "title": "Markdown Uri", + "type": "string" + }, + "mime": { + "title": "Mime", + "type": "string" + }, + "pageindex_uri": { + "title": "Pageindex Uri", + "type": "string" + }, + "placement_path": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Placement Path" + }, + "raw_uri": { + "title": "Raw Uri", + "type": "string" + }, + "representation_id": { + "format": "uuid", + "title": "Representation Id", + "type": "string" + }, + "root_summary": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Root Summary" + }, + "route": { + "title": "Route", + "type": "string" + }, + "source_date": { + "anyOf": [ + { + "format": "date-time", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Source Date" + }, + "source_kind": { + "title": "Source Kind", + "type": "string" + }, + "source_ref": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Source Ref" + }, + "source_uri": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Source Uri" + }, + "structure_generation_id": { + "format": "uuid", + "title": "Structure Generation Id", + "type": "string" + }, + "title": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Title" + }, + "version_id": { + "format": "uuid", + "title": "Version Id", + "type": "string" + }, + "version_no": { + "title": "Version No", + "type": "integer" + } + }, + "required": [ + "deployment_id", + "doc_id", + "version_id", + "representation_id", + "structure_generation_id", + "version_no", + "source_kind", + "source_ref", + "source_uri", + "source_date", + "title", + "file_name", + "lineage_title", + "mime", + "family", + "route", + "content_hash", + "raw_uri", + "markdown_uri", + "markdown_hash", + "conversion_uri", + "manifest_hash", + "pageindex_uri", + "placement_path", + "root_summary" + ], + "title": "CorpusDocument", + "type": "object" + }, + "NativeCatalogIdentity": { + "additionalProperties": false, + "description": "Actual session, virtual transaction and MVCC snapshot, without handoff.", + "properties": { + "backend_pid": { + "exclusiveMinimum": 0, + "title": "Backend Pid", + "type": "integer" + }, + "database_name": { + "title": "Database Name", + "type": "string" + }, + "database_oid": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Database Oid", + "type": "string" + }, + "postmaster_started_unix_us": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Postmaster Started Unix Us", + "type": "string" + }, + "session_login": { + "title": "Session Login", + "type": "string" + }, + "snapshot_identity": { + "title": "Snapshot Identity", + "type": "string" + }, + "virtual_transaction_id": { + "title": "Virtual Transaction Id", + "type": "string" + } + }, + "required": [ + "session_login", + "database_name", + "database_oid", + "postmaster_started_unix_us", + "backend_pid", + "virtual_transaction_id", + "snapshot_identity" + ], + "title": "NativeCatalogIdentity", + "type": "object" + }, + "NativeCorpusDocument": { + "additionalProperties": false, + "description": "Recorded cleanup folders and current served inputs from the same cut.\n\nA path is only a possibly written folder. The consumer must compare the\nnullable publication marker with the current input/policy identity before\ntreating any of its files as a completed document copy.", + "properties": { + "doc_id": { + "format": "uuid", + "title": "Doc Id", + "type": "string" + }, + "document": { + "anyOf": [ + { + "$ref": "#/$defs/CorpusDocument" + }, + { + "type": "null" + } + ] + }, + "paths": { + "items": { + "type": "string" + }, + "title": "Paths", + "type": "array" + } + }, + "required": [ + "doc_id", + "paths", + "document" + ], + "title": "NativeCorpusDocument", + "type": "object" + } + }, + "additionalProperties": false, + "description": "A bounded page including deleted/unselected documents' cleanup paths.", + "properties": { + "deployment_id": { + "format": "uuid", + "title": "Deployment Id", + "type": "string" + }, + "identity": { + "$ref": "#/$defs/NativeCatalogIdentity" + }, + "rows": { + "items": { + "$ref": "#/$defs/NativeCorpusDocument" + }, + "title": "Rows", + "type": "array" + } + }, + "required": [ + "identity", + "deployment_id", + "rows" + ], + "title": "NativeCorpusPage", + "type": "object" + }, + "NativeReferencePage": { + "$defs": { + "NativeCatalogIdentity": { + "additionalProperties": false, + "description": "Actual session, virtual transaction and MVCC snapshot, without handoff.", + "properties": { + "backend_pid": { + "exclusiveMinimum": 0, + "title": "Backend Pid", + "type": "integer" + }, + "database_name": { + "title": "Database Name", + "type": "string" + }, + "database_oid": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Database Oid", + "type": "string" + }, + "postmaster_started_unix_us": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Postmaster Started Unix Us", + "type": "string" + }, + "session_login": { + "title": "Session Login", + "type": "string" + }, + "snapshot_identity": { + "title": "Snapshot Identity", + "type": "string" + }, + "virtual_transaction_id": { + "title": "Virtual Transaction Id", + "type": "string" + } + }, + "required": [ + "session_login", + "database_name", + "database_oid", + "postmaster_started_unix_us", + "backend_pid", + "virtual_transaction_id", + "snapshot_identity" + ], + "title": "NativeCatalogIdentity", + "type": "object" + }, + "NativeStoreReference": { + "additionalProperties": false, + "description": "One native store locator or journal intent, including unfinished state.\n\nA repository locator is a root to expand through qualified store\nevidence, never a fabricated object or a row-byte estimate. Only raw\nobjects record a native length; missing length remains explicit. A journal\nintent carries the actual forget UUID, not an invented store path. Its\nqualified adapter derives the concrete journal key and proves presence.", + "properties": { + "locator": { + "format": "password", + "title": "Locator", + "type": "string", + "writeOnly": true + }, + "locator_kind": { + "enum": [ + "object", + "repository_path", + "journal_intent" + ], + "title": "Locator Kind", + "type": "string" + }, + "native_class": { + "title": "Native Class", + "type": "string" + }, + "native_id": { + "format": "password", + "title": "Native Id", + "type": "string", + "writeOnly": true + }, + "native_state": { + "anyOf": [ + { + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Native State" + }, + "recorded_bytes": { + "anyOf": [ + { + "pattern": "^(0|[1-9][0-9]*)$", + "type": "string" + }, + { + "type": "null" + } + ], + "title": "Recorded Bytes" + }, + "recorded_digest": { + "anyOf": [ + { + "format": "password", + "type": "string", + "writeOnly": true + }, + { + "type": "null" + } + ], + "title": "Recorded Digest" + }, + "store_role": { + "enum": [ + "raw", + "artifacts", + "corpus", + "forget", + "knowledge" + ], + "title": "Store Role", + "type": "string" + } + }, + "required": [ + "native_class", + "native_id", + "store_role", + "locator", + "locator_kind", + "recorded_bytes", + "native_state", + "recorded_digest" + ], + "title": "NativeStoreReference", + "type": "object" + } + }, + "additionalProperties": false, + "description": "A bounded, strictly ordered page from the same retained view.", + "properties": { + "deployment_id": { + "format": "uuid", + "title": "Deployment Id", + "type": "string" + }, + "identity": { + "$ref": "#/$defs/NativeCatalogIdentity" + }, + "rows": { + "items": { + "$ref": "#/$defs/NativeStoreReference" + }, + "title": "Rows", + "type": "array" + } + }, + "required": [ + "identity", + "deployment_id", + "rows" + ], + "title": "NativeReferencePage", + "type": "object" + }, + "NativeRelationGuardSample": { + "$defs": { + "NativeRelationAllocation": { + "additionalProperties": false, + "description": "One actual relation/fork record, still requiring profile classification.", + "properties": { + "fsm_bytes": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Fsm Bytes", + "type": "string" + }, + "init_bytes": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Init Bytes", + "type": "string" + }, + "main_bytes": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Main Bytes", + "type": "string" + }, + "relation_oid": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Relation Oid", + "type": "string" + }, + "resource_kind": { + "enum": [ + "table", + "index", + "toast", + "toast_index" + ], + "title": "Resource Kind", + "type": "string" + }, + "root_relation": { + "title": "Root Relation", + "type": "string" + }, + "vm_bytes": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Vm Bytes", + "type": "string" + } + }, + "required": [ + "resource_kind", + "root_relation", + "relation_oid", + "main_bytes", + "fsm_bytes", + "vm_bytes", + "init_bytes" + ], + "title": "NativeRelationAllocation", + "type": "object" + } + }, + "additionalProperties": false, + "description": "A same-transaction sample, never a completed historic capture witness.", + "properties": { + "allocated_fork_bytes": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Allocated Fork Bytes", + "type": "string" + }, + "backend_pid": { + "exclusiveMinimum": 0, + "title": "Backend Pid", + "type": "integer" + }, + "contract": { + "const": "rememberstack.native_relation_guard.v1", + "title": "Contract", + "type": "string" + }, + "definer_role": { + "title": "Definer Role", + "type": "string" + }, + "deployment_id": { + "title": "Deployment Id", + "type": "string" + }, + "guard_started_unix_us": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Guard Started Unix Us", + "type": "string" + }, + "physical_table_total_bytes": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Physical Table Total Bytes", + "type": "string" + }, + "relations": { + "items": { + "$ref": "#/$defs/NativeRelationAllocation" + }, + "title": "Relations", + "type": "array" + }, + "sample_after_unix_us": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Sample After Unix Us", + "type": "string" + }, + "sample_before_unix_us": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Sample Before Unix Us", + "type": "string" + }, + "schema_head": { + "const": "p9_52_0073", + "title": "Schema Head", + "type": "string" + }, + "session_login": { + "title": "Session Login", + "type": "string" + }, + "transaction_id": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Transaction Id", + "type": "string" + } + }, + "required": [ + "contract", + "deployment_id", + "schema_head", + "session_login", + "definer_role", + "backend_pid", + "transaction_id", + "guard_started_unix_us", + "sample_before_unix_us", + "sample_after_unix_us", + "allocated_fork_bytes", + "physical_table_total_bytes", + "relations" + ], + "title": "NativeRelationGuardSample", + "type": "object" + }, + "NativeTerminalPage": { + "$defs": { + "ManagedDocumentVersionOutcome": { + "additionalProperties": false, + "description": "The v3 terminal receipt replayed until the control plane acknowledges it.", + "properties": { + "completed_at": { + "format": "date-time", + "title": "Completed At", + "type": "string" + }, + "contract_version": { + "const": "rememberstack.document_version_outcome.v3", + "default": "rememberstack.document_version_outcome.v3", + "title": "Contract Version", + "type": "string" + }, + "document_version_id": { + "anyOf": [ + { + "maxLength": 128, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Document Version Id" + }, + "measurement_id": { + "format": "uuid", + "title": "Measurement Id", + "type": "string" + }, + "outcome": { + "enum": [ + "succeeded", + "failed" + ], + "title": "Outcome", + "type": "string" + }, + "profile_complete": { + "title": "Profile Complete", + "type": "boolean" + }, + "reason_code": { + "anyOf": [ + { + "maxLength": 64, + "type": "string" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Reason Code" + }, + "version_commit_sequence": { + "anyOf": [ + { + "minimum": 0, + "type": "integer" + }, + { + "type": "null" + } + ], + "default": null, + "title": "Version Commit Sequence" + } + }, + "required": [ + "measurement_id", + "outcome", + "completed_at", + "profile_complete" + ], + "title": "ManagedDocumentVersionOutcome", + "type": "object" + }, + "NativeCatalogIdentity": { + "additionalProperties": false, + "description": "Actual session, virtual transaction and MVCC snapshot, without handoff.", + "properties": { + "backend_pid": { + "exclusiveMinimum": 0, + "title": "Backend Pid", + "type": "integer" + }, + "database_name": { + "title": "Database Name", + "type": "string" + }, + "database_oid": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Database Oid", + "type": "string" + }, + "postmaster_started_unix_us": { + "pattern": "^(0|[1-9][0-9]*)$", + "title": "Postmaster Started Unix Us", + "type": "string" + }, + "session_login": { + "title": "Session Login", + "type": "string" + }, + "snapshot_identity": { + "title": "Snapshot Identity", + "type": "string" + }, + "virtual_transaction_id": { + "title": "Virtual Transaction Id", + "type": "string" + } + }, + "required": [ + "session_login", + "database_name", + "database_oid", + "postmaster_started_unix_us", + "backend_pid", + "virtual_transaction_id", + "snapshot_identity" + ], + "title": "NativeCatalogIdentity", + "type": "object" + } + }, + "additionalProperties": false, + "description": "Existing v3 terminal bodies, with no processing-delivery filter.", + "properties": { + "deployment_id": { + "format": "uuid", + "title": "Deployment Id", + "type": "string" + }, + "identity": { + "$ref": "#/$defs/NativeCatalogIdentity" + }, + "rows": { + "items": { + "$ref": "#/$defs/ManagedDocumentVersionOutcome" + }, + "title": "Rows", + "type": "array" + } + }, + "required": [ + "identity", + "deployment_id", + "rows" + ], + "title": "NativeTerminalPage", + "type": "object" + } + } + }, + "source_rules": [ + [ + "postgres.public.aliases", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.application_context_bindings", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.assured_operations", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.chunk_claims", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.chunk_search", + "postgres", + "projection_origin", + "postgres_allocated" + ], + [ + "postgres.public.chunks", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.claim_extraction_decisions", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.claims", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.connector_sync_cycles", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.content_objects", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.deployment_extension_packs", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.deployment_processing_layers", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.deployments", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_crossrefs", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_effective_periods", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_effective_time_events", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_entity_bindings", + "postgres", + "projection_origin", + "postgres_allocated" + ], + [ + "postgres.public.document_metadata", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_names", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_people", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_reference_generations", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_representations", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_sections", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_skeleton_checks", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_structure_generations", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.document_version_scope", + "postgres", + "projection_origin", + "postgres_allocated" + ], + [ + "postgres.public.document_versions", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.documents", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.entities", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.entity_types", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.extension_packs", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.fact_applications", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.ingest_principals", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.knowledge_artifact_evidence", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.knowledge_artifacts", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.knowledge_compilations", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.knowledge_page_rules", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.knowledge_page_watches", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.knowledge_plan_decisions", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.knowledge_quarantines", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.knowledge_rule_keys", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.knowledge_subscriptions", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.mentions", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.merge_events", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.normalization_outputs", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.observation_adjudications", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.observation_evidence", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.observations", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.p1_search_channels", + "postgres", + "projection_origin", + "postgres_allocated" + ], + [ + "postgres.public.pipeline_component_versions", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.predicates", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.processing_layer_gaps", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.projection_snapshots", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.relation_adjudications", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.relation_evidence", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.relations", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.resolution_decisions", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.resolution_exclusions", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.resolver_versions", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.review_queue", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.saved_queries", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.saved_query_registry_state", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.saved_query_versions", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.scope_interests", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.scopes", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.selection_results", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.testimony_currency_events", + "postgres", + "truth_provenance", + "postgres_allocated" + ], + [ + "postgres.public.canary_cases", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.cost_ledger", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.eval_runs", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.golden_claim_labels", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.golden_pairs", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.grounding_audits", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.knowledge_plan_runs", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.managed_ingest_measurements", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.managed_ingest_outcomes", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.saved_query_audit", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.surface_cost_ledger", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.surface_cost_meter_state", + "postgres", + "audit_operations", + null + ], + [ + "postgres.public.fact_window_review_attempts", + "postgres", + "paid_checkpoint", + null + ], + [ + "postgres.public.knowledge_dispatches", + "postgres", + "paid_checkpoint", + null + ], + [ + "postgres.public.knowledge_refresh_queue", + "postgres", + "paid_checkpoint", + null + ], + [ + "postgres.public.obs_flush_entity_units", + "postgres", + "paid_checkpoint", + null + ], + [ + "postgres.public.obs_flush_version_state", + "postgres", + "paid_checkpoint", + null + ], + [ + "postgres.public.processing_state", + "postgres", + "paid_checkpoint", + null + ], + [ + "postgres.public.forget_manifests", + "postgres", + "privacy_control", + null + ], + [ + "postgres.public.perimeter_state", + "postgres", + "privacy_control", + null + ], + [ + "postgres.public.normalize_observation_staging", + "postgres", + "staging", + null + ], + [ + "postgres.public.alembic_version", + "postgres", + "adapter_metadata", + null + ], + [ + "postgres.public.part_config", + "postgres", + "adapter_metadata", + null + ], + [ + "postgres.public.part_config_sub", + "postgres", + "adapter_metadata", + null + ], + [ + "postgres.public.template_public_chunk_claims", + "postgres", + "adapter_metadata", + null + ], + [ + "postgres.public.template_public_chunks", + "postgres", + "adapter_metadata", + null + ], + [ + "postgres.public.template_public_claim_extraction_decisions", + "postgres", + "adapter_metadata", + null + ], + [ + "postgres.public.template_public_mentions", + "postgres", + "adapter_metadata", + null + ], + [ + "postgres.public.template_public_resolution_decisions", + "postgres", + "adapter_metadata", + null + ], + [ + "postgres.public.template_public_surface_cost_ledger", + "postgres", + "adapter_metadata", + null + ], + [ + "postgres.public.template_public_testimony_currency_events", + "postgres", + "adapter_metadata", + null + ], + [ + "content_objects.raw_uri", + "raw", + "canonical_raw", + "canonical_object" + ], + [ + "document_representations.markdown_uri", + "artifacts", + "referenced_artifact", + "canonical_object" + ], + [ + "document_representations.pageindex_uri", + "artifacts", + "referenced_artifact", + "canonical_object" + ], + [ + "document_representations.conversion_uri", + "artifacts", + "referenced_artifact", + "canonical_object" + ], + [ + "document_representations.blocks_uri", + "artifacts", + "referenced_artifact", + "canonical_object" + ], + [ + "document_representations.meta_uri", + "artifacts", + "referenced_artifact", + "canonical_object" + ], + [ + "document_representations.source_map", + "artifacts", + "referenced_artifact", + "canonical_object" + ], + [ + "document_representations.derived_asset", + "artifacts", + "referenced_artifact", + "canonical_object" + ], + [ + "document_structure_generations.pageindex_uri", + "artifacts", + "referenced_artifact", + "canonical_object" + ], + [ + "document_reference_generations.artifact_uri", + "artifacts", + "truth_provenance", + "canonical_object" + ], + [ + "knowledge_compilations.session_transcript_uri", + "artifacts", + "audit_operations", + null + ], + [ + "knowledge_plan_runs.session_transcript_uri", + "artifacts", + "audit_operations", + null + ], + [ + "documents.corpus_original", + "corpus", + "projection_origin", + "p3_origin" + ], + [ + "documents.corpus_derivative", + "corpus", + "projection_origin", + "p3_origin" + ], + [ + "corpus.navigation", + "corpus", + "projection_origin", + "p3_origin" + ], + [ + "forget_manifests.portable_intent", + "forget", + "privacy_control", + null + ], + [ + "raw.unregistered_upload", + "raw", + "staging", + null + ], + [ + "raw.unregistered_original", + "raw", + "staging", + null + ], + [ + "artifacts.unregistered_representation", + "artifacts", + "staging", + null + ], + [ + "artifacts.conversion_checkpoint", + "artifacts", + "paid_checkpoint", + null + ], + [ + "artifacts.session_transcript", + "artifacts", + "audit_operations", + null + ], + [ + "corpus.incomplete_or_orphan", + "corpus", + "staging", + null + ], + [ + "provider.directory", + "raw", + "adapter_metadata", + null + ], + [ + "provider.directory", + "artifacts", + "adapter_metadata", + null + ], + [ + "provider.directory", + "corpus", + "adapter_metadata", + null + ], + [ + "provider.directory", + "forget", + "adapter_metadata", + null + ] + ] +} diff --git a/src/tests/spine/test_storage_capture_profile.py b/src/tests/spine/test_storage_capture_profile.py new file mode 100644 index 000000000..5872d18e8 --- /dev/null +++ b/src/tests/spine/test_storage_capture_profile.py @@ -0,0 +1,35 @@ +"""Generated D152 profile pins and the explicit live-tree commercial bases.""" + +import json + +from scripts.generate_storage_capture_fixture import FIXTURE +from scripts.generate_storage_capture_fixture import render + +from rememberstack.profiles.storage_capture_profile import current_class_rules + + +def test_generated_live_profile_is_current() -> None: + assert FIXTURE.read_text() == render() + fixture = json.loads(FIXTURE.read_text()) + assert fixture["schema"]["head"] == "p9_52_0073" + + +def test_corpus_copies_never_count_as_canonical_raw() -> None: + rules = { + name: (store, purpose, component) + for name, store, purpose, component in current_class_rules() + } + assert rules["content_objects.raw_uri"] == ( + "raw", + "canonical_raw", + "canonical_object", + ) + for name in ( + "documents.corpus_original", + "documents.corpus_derivative", + "corpus.navigation", + ): + assert rules[name] == ("corpus", "projection_origin", "p3_origin") + assert rules["corpus.incomplete_or_orphan"] == ("corpus", "staging", None) + assert "projection_snapshots.gcs_uri" not in rules + assert "corpus.unpublished_snapshot" not in rules diff --git a/src/tests/storage_capture_support.py b/src/tests/storage_capture_support.py new file mode 100644 index 000000000..672e4efa9 --- /dev/null +++ b/src/tests/storage_capture_support.py @@ -0,0 +1,234 @@ +"""Synthetic provider wire and explicit disk evidence for real-store tests. + +MinIO supplies actual names/bodies; this builder supplies protocol vectors, not +provider-at-T, UTC, deployed-image or commercial qualification. +""" + +from collections.abc import Iterator +import hashlib +import json +from pathlib import Path +from typing import Any + +from rememberstack.adapters.fsit_storage_capture import check_provider_manifest +from rememberstack.adapters.fsit_storage_capture import provider_canonical_bytes +from rememberstack.adapters.fsit_storage_capture import provider_page_digest +from rememberstack.adapters.fsit_storage_capture import provider_path_identity +from rememberstack.adapters.fsit_storage_capture import provider_record_digest +from rememberstack.adapters.fsit_storage_capture import ProviderItem +from rememberstack.adapters.fsit_storage_capture import ProviderManifest +from rememberstack.adapters.fsit_storage_capture import ProviderPage +from rememberstack.adapters.fsit_storage_capture import ProviderRequest +from rememberstack.adapters.fsit_storage_capture import ProviderStorageFlags +from rememberstack.adapters.selfhost import MinIOObjectStore +from rememberstack.model import ObjectKey + +FIXTURES = Path(__file__).parent / "fixtures/storage_capture" + + +class CaptureStore: + """Use the actual MinIO bucket as its filesystem binding, without aliases.""" + + def __init__(self, store: MinIOObjectStore, filesystem: str) -> None: + self.store, self.filesystem = store, filesystem + + def capture_store_identity(self) -> str: + return self.filesystem + + def iter_capture_key_candidates(self) -> Iterator[str]: + return (key.root for key in self.store.iter_keys(prefix="")) + + def read_bytes(self, *, key: ObjectKey) -> bytes: + return self.store.read_bytes(key=key) + + +class DiskEvidence: + """Explicit immutable fixture files outside the measured stores.""" + + def __init__(self, root: Path) -> None: + self.root = root + + def _read(self, capture_id: str, key: str) -> bytes | None: + path = self.root / capture_id / key + return path.read_bytes() if path.exists() else None + + def _put(self, capture_id: str, key: str, body: bytes) -> None: + path = self.root / capture_id / key + path.parent.mkdir(parents=True, exist_ok=True) + if path.exists(): + assert path.read_bytes() == body + else: + path.write_bytes(body) + + def read_manifest(self, *, capture_id: str) -> bytes | None: + return self._read(capture_id, "manifest.json") + + def read_native_witness(self, *, capture_id: str) -> bytes | None: + return self._read(capture_id, "native-witness.json") + + def read_provider_manifest(self, *, capture_id: str) -> bytes | None: + return self._read(capture_id, "provider-manifest.json") + + def read_page(self, *, capture_id: str, page_ordinal: str) -> bytes | None: + return self._read(capture_id, f"pages/{page_ordinal}.json") + + def persist_native_evidence( + self, *, capture_id: str, witness: bytes, allocations: bytes, profile: bytes + ) -> None: + for key, body in ( + ("native-witness", witness), + ("native-allocations", allocations), + ("profile", profile), + ): + self._put(capture_id, key + ".json", body) + + def persist_provider_manifest(self, *, capture_id: str, body: bytes) -> None: + self._put(capture_id, "provider-manifest.json", body) + + def persist_provider_page( + self, *, capture_id: str, page_ordinal: str, body: bytes + ) -> None: + self._put(capture_id, f"provider-pages/{page_ordinal}.json", body) + + def persist_page(self, *, capture_id: str, page_ordinal: str, body: bytes) -> None: + self._put(capture_id, f"pages/{page_ordinal}.json", body) + + def complete(self, *, capture_id: str, manifest: bytes) -> None: + self._put(capture_id, "manifest.json", manifest) + + +class SyntheticProvider: + """One fixed vector built before the cut; no claim to provider qualification.""" + + def __init__( + self, *, request: ProviderRequest, stores: dict[str, CaptureStore] + ) -> None: + body = provider_canonical_bytes(record=request) + capture_id = hashlib.sha256(b"fsit-capture-v1\0" + body).hexdigest() + self.keys: dict[tuple[str, str], str] = {} + items: list[ProviderItem] = [] + for role, store in stores.items(): + for name in store.iter_capture_key_candidates(): + content = store.read_bytes(key=ObjectKey(name)) + path = provider_path_identity( + capture_id=capture_id, + filesystem_id=store.filesystem, + relative_path=name, + ) + self.keys[(role, name)] = path + items.append( + ProviderItem( + alias_group=None, + entry_kind="regular", + filesystem_id=store.filesystem, + inline_bytes=str(len(content)), + logical_bytes=str(len(content)), + path_id=path, + storage_flags=ProviderStorageFlags( + chunk_backed=False, + chunk_manifest=False, + inline_content=bool(content), + metadata_gzip=False, + remote_backed=False, + ), + version_id=hashlib.sha256(content).hexdigest(), + ) + ) + items.sort(key=lambda item: (item.filesystem_id, item.path_id)) + self.pages: list[ProviderPage] = [] + for index in range(0, len(items), 1024): + chunk = tuple(items[index : index + 1024]) + page = ProviderPage( + capture_id=capture_id, + item_count=str(len(chunk)), + items=chunk, + page_digest="0" * 64, + page_ordinal=str(len(self.pages)), + protocol="fsit-page-v1", + ) + self.pages.append( + page.model_copy(update={"page_digest": provider_page_digest(page=page)}) + ) + vector = json.loads((FIXTURES / "fsit_bc8482ab_manifest.json").read_bytes())[ + "manifest" + ] + delta = int(request.cut_at_unix_us) - int(vector["request"]["cut_at_unix_us"]) + + def shift(record: dict[str, Any]) -> None: + for key, value in record.items(): + if isinstance(value, dict): + shift(value) + elif key.endswith("_unix_us"): + record[key] = str(int(value) + delta) + + shift(vector["native_witness"]) + vector["native_witness"]["cell_id"] = request.cell_id + resource = vector["resources"][0] + scope = request.model_dump(mode="json", exclude={"cut_at_unix_us", "protocol"}) + vector.update( + capture_id=capture_id, + request=request.model_dump(mode="json"), + expires_at_unix_us=str(int(request.cut_at_unix_us) + 72 * 3600 * 1_000_000), + item_count=str(len(items)), + page_count=str(len(self.pages)), + pages=[ + { + key: page.model_dump()[key] + for key in ("item_count", "page_digest", "page_ordinal") + } + for page in self.pages + ], + scope_digest=hashlib.sha256( + b"fsit-scope-v1\0" + + json.dumps(scope, sort_keys=True, separators=(",", ":")).encode() + ).hexdigest(), + sets=[ + { + "filesystem_id": filesystem, + "entry_count": str( + sum(item.filesystem_id == filesystem for item in items) + ), + "root_materialized": any( + item.filesystem_id == filesystem for item in items + ), + } + for filesystem in request.filesystem_ids + ], + resources=[ + { + **resource, + "filesystem_id": filesystem, + "retained_bytes": "0", + "sealed_bytes": "0", + "pending_bytes": "0", + } + for filesystem in request.filesystem_ids + ], + ) + manifest = ProviderManifest.model_validate_json(json.dumps(vector)) + manifest = manifest.model_copy( + update={ + "native_witness_digest": provider_record_digest( + domain="fsit-witness-v1", record=manifest.native_witness + ) + } + ) + self.manifest = manifest.model_copy( + update={ + "manifest_digest": provider_record_digest( + domain="fsit-manifest-v1", record=manifest, omit="manifest_digest" + ) + } + ) + check_provider_manifest(manifest=self.manifest) + self.completed = False + + def complete(self) -> ProviderManifest: + return self.manifest + + def iter_pages(self, *, manifest: ProviderManifest) -> Iterator[ProviderPage]: + assert manifest == self.manifest + return iter(self.pages) + + def check_transport_complete(self) -> None: + self.completed = True