Kho-tam SSOT rewrite — 04 Live readonly survey
04 — KHẢO SÁT HỆ THỐNG SỐNG (READ-ONLY)
Ngày: 2026-06-24 · DB: directus (container postgres, postgres:16) · Cách: query_pg (READ ONLY transaction, read-only role, statement_timeout 5s, LIMIT 500) + pg_class/information_schema + list_docker. 0 write, 0 DDL, 0 dry-run.
1. Docker (list_docker)
11 container. Liên quan: postgres (postgres:16, official, 5432→5432), incomex-directus (directus 11.5), incomex-agent-data, incomex-claude-kb, incomex-qdrant, pg-restore-test-20260520T031054Z (postgres:16, restore test).
2. Schemas (pg_namespace, không phải info_schema)
cutter_governance, iu_core, public, sandbox_tac. (Lưu ý: sandbox_tac bị info_schema.tables lọc mất do read-only role không có USAGE; phải dùng pg_class để thấy.)
3. Substrate staging — CÓ THẬT, ĐANG DÙNG
3.1 iu_core.iu_staging_record — 15 dòng
Cột (23): staging_record_id(uuid), staging_kind, payload_type, purpose, lifecycle_status, owner_actor, source_kind, source_ref, idempotency_key, content_hash, byte_len, part_count, metadata(jsonb), referenced_iu_ids(array), created_at, approved_at/approved_by/approval_doc_id (light approval), consumed_at/consumed_by_run_id (promote), expires_at (TTL), cleaned_at (cleanup), vector_excluded.
- distinct
lifecycle_status: rejected(5), pending(4), consumed(4), approved(1), pending_review(1). - distinct
staging_kind/purpose:mark_manifest/cut_manifest_for_review(8),agent_intermediate/cut_pipeline_source_copy(4),sql_snapshot/"D36 Macro A proof — SQL snapshot of iu_core counts (bounded test)"(1),nosql_payload/"D36 Macro A proof… Will be rejected"(1),mark_manifest/"D36 Macro A proof"(1). - → Đây là kho tạm cấp record đang vận hành thật (cut-pipeline + Điều 36 macro bounded test). Cấu trúc khớp gần hết nhu cầu kho tạm.
3.2 iu_core.iu_staging_payload — 32 dòng
Cột (11): staging_payload_id(uuid), staging_record_id(uuid FK), part_index, part_name, payload_kind, payload_json(jsonb), payload_text, blob_ref, byte_len, content_hash, created_at. = bảng con multi-part của record.
- view:
v_iu_staging_record,v_iu_staging_payload_observability.
3.3 sandbox_tac (schema) ↔ cutter_governance (canonical)
sandbox_tac (~9 bảng): logical_unit, unit_version, change_set, change_set_member, publication, publication_member, publication_type_vocab, section_type_vocab + index idx_sbx_uv_lifecycle.
cutter_governance (canonical, lớn): verify_result, review_decision, cut_change_set(có idempotency_key+rollback_key), manifest_envelope, source_document_registry, … (tổng 2 schema = 95 relations).
→ Mẫu canonical↔sandbox đã chứng minh trong production cho domain cutter. Mẫu R2 (schema sandbox) thật.
3.4 governance_candidate_state + governance_candidate_object — 0 dòng
Bảng tồn tại (DDL có) nhưng rỗng. Khớp SSOT "design-only / BUILD NO-GO". Lớp candidacy chưa đưa vào dùng.
4. composition_level — enum đúng, live-confirmed
distinct (src, composition_level, n):
meta_catalog: atom(77), molecule(51), compound(34), material(2), product(1), building(1), meta(3) → đủ 7 giá trị.birth_registry: atom(1,213,045), molecule(1024), compound(173), meta(45).entity_species: atom(21), molecule(11), compound(8), meta(1) [+1 dòng giá trị "1" = data nit]. → KHÔNG cócell/organ/systemở bất kỳ bảng nào. Cộtcomposition_levelxuất hiện ở birth_registry, design_templates, entity_species, law_registry, meta_catalog, normative_registry, pivot_definitions, taxonomy_matrix + nhiều view.
5. Stamp / cell_id materialize?
Cột khớp stamp/candidate_id/cell_id (information_schema.columns): chỉ có birth_registry.inspect_stamp và composition_level/layer rải rác. KHÔNG có cột cell_id, temp_id_stamp, validation_stamp, io_stamp, candidate_id. → Hệ stamp + cell_id chưa materialize (đúng SSOT). meta_catalog có cả composition_level lẫn layer.
6. DOT factory cho kho tạm?
SELECT code FROM dot_tools WHERE code ILIKE '%sandbox%' OR '%staging%' OR '%lego%' OR '%promote%' → 0 rows. Không có DOT chính thức nào cho kho tạm/sandbox/promote. (Incumbent dot-staging-sandbox-* nằm trong staging registry JSONL của C1, KHÔNG trong official dot_tools.)
7. NOT FOUND / giới hạn khảo sát
/opt/incomex/dot/bin/và/opt/incomex/staging/c1/: KHÔNG đọc được qua MCPread_file(allowlist chỉ/opt/incomex/docs,/opt/incomex/dot/specs,/var/log/nginx). Dữ kiện C1 lấy từ KB report (đã ghi rõ nguồn KB). SSH tới VPS không dùng trong phiên (giữ read-only tối thiểu). → KHÔNG bịa nội dung filesystem C1; mọi mô tả C1 truy nguồn KB report.- Danh sách miền (Miền/jurisdiction) đóng: NOT FOUND enum đóng — là content per-law (Đ37), không phải enum cố định. Query đã thử: biến thể "jurisdiction/Điều 37/domain values".
- CHECK constraint composition_level trên birth_registry: 0 rows (constraint tên khác hoặc enforce-by-convention) — không ảnh hưởng, distinct values đã chứng minh enum.
8. Trạng thái không đổi
Khảo sát hoàn toàn read-only. Không tạo/sửa/xóa bất kỳ object nào. Không có before/after để so vì không có write.