Files
ThothII/docs/adr/0040-use-postgres-metadata-for-all-core-consumers.md
T
CodexandClaude Opus 5.5 8bd1f3e793
Publish documentation / publish (push) Successful in 29s
docs: retrofit domain docs to GLOSSARY.md and chronological ADRs
Align domain documentation with the mattpocock-skills v1.3.1 format.

- GLOSSARY.md (Italian) replaces CONTEXT.md and describes the implemented
  system (Phase F1–F8, Gate, Reviewer widget). The unimplemented 2026-08-23
  modular-workflow vocabulary (Workflow Kernel, Stage, Module outcome,
  Extension point, Question Admission, ...) is removed.
- docs/adr/ renumbered chronologically, in English, with status/date
  frontmatter. Retroactive decisions recovered from deleted specs and the
  Evidence ADRs deleted in a54d4769 are restored.
- docs/agents/domain.md regenerated; references updated across docs.

New ADRs:
  0001–0016  retroactive decisions, 2026-06-25 → 2026-08-20
  0017–0024  Evidence ADRs of 2026-08-24 (old 0001–0008, deleted in a54d4769)

Renumbered ADRs (old → new):
  0001 → 0025  postgres-metadata-catalog
  0002 → 0026  workspace-database-secret-references
  0003 → 0027  installation-local-database-bindings
  0004 → 0028  fastify-kysely-metadata-catalog
  0005 → 0029  hard-delete-catalog-tables-during-synchronization
  0006 → 0030  separate-physical-and-logical-relationships
  0007 → 0031  durable-authoritative-schema-synchronization
  0008 → 0032  allow-manual-catalog-metadata-cleanup
  0009 → 0033  use-one-sequential-description-generation-run
  0010 → 0034  allow-bounded-real-source-samples-for-description-generation
  0011 → 0035  gate-source-samples-with-a-sensitive-data-flag
  0012 → 0036  use-the-catalog-as-the-logical-relationship-authority
  0013 → 0037  use-one-installation-model-catalog-with-runtime-projections
  0014 → 0038  assess-sensitive-columns-locally-from-source-content
  0015 → 0039  use-progressive-sampling-for-sensitive-columns
  0016 → 0040  use-postgres-metadata-for-all-core-consumers
  0017 → 0041  separate-reference-vectors-from-runtime-memory
  0018 → 0042  use-postgres-for-memory-and-qdrant-for-retrieval
  0019 → 0043  author-evidence-in-app... → maintain-local-evidence-with-external-editors
  0020 → 0044  unify-administration-pages-and-use-namespaced-routes
  0021 → 0045  separate-shell-modes-and-replaceable-portal-adapter
  0022 → 0046  separate-ui-locale-from-session-interaction-language
  0023 → 0047  separate-delivery-operations-from-finalized-sessions

Commits and Gitea issues before this commit cite the old numbers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-17 22:23:25 +02:00

4.3 KiB

status, date
status date
accepted 2026-09-06

Use PostgreSQL metadata for all core consumers

The Metadata Catalog in PostgreSQL is the sole authority for every fact about a Workspace Database used by the core. This completes the cutover anticipated by ADR-0025 and ADR-0027 and supersedes the ADR-0036 statements that kept workspace annotations authoritative for descriptions and materialized a relationship-only snapshot per session. The Workspace Descriptor retains workspace identity and Evidence scope, but contains no database identity, binding, structure, description, or relationship data.

Decision

All downstream consumers receive one deterministic, versioned Catalog Metadata Snapshot produced from PostgreSQL. It contains the complete cataloged table and column structure, sensitivity metadata, publishable descriptions, and the active Effective Relationship Map. Description precedence is Description, then Generated Description, then the observed source comment; generated text is therefore publishable without prior consolidation. Qdrant stores first-class table, column, and relationship records, and a relationship hit contributes to both endpoint tables.

The native host CLI exposes one mutating preprocessing operation. The Node workspace-maintenance process acquires a PostgreSQL lock shared with catalog synchronization, description generation, and administrative catalog writes; it refuses to run while one of those operations is active. It reads the catalog once, writes the snapshot to a temporary immutable JSON file, and passes only that file to the Python harness. Catalog credentials are excluded from the child environment. The harness never reads the Metadata Catalog directly.

Preprocessing is deliberately offline: no session uses the core while it is running, nobody starts the core until it completes, and concurrent catalog modification is forbidden. PostgreSQL owns a minimal running | succeeded | failed Preprocessing State, the input fingerprint, the Metadata Content Revision, and the last successfully processed revision. Every relevant catalog mutation increments the revision and makes the prior success stale in the same transaction. Core admission requires a current succeeded state, but the system does not implement session draining, per-session schema pinning, coexisting preprocessing generations, retention, or rollback.

Each run may overwrite the previous derived state. It replaces the Qdrant schema and evidence slices while preserving memory and solved_question, rebuilds the current LSH and other required artifacts, verifies the result, and marks success only at the end. A failure leaves the workspace unready; rerunning starts from a clean derived state. Existing internal DWH or Evidence staging may remain an implementation detail with minimum retention, but it is not an application-level generation contract. A workspace without Evidence is valid and publishes an explicit absent state.

physical.yaml, annotations.yaml, the YAML FK review flow, and public partial preprocessing commands are removed from the runtime contract. No legacy metadata is imported. Concepts, synonyms, notes, annotation evidence, and the manual eligible override are retired; eligibility is computed deterministically. The DWH is queried during preprocessing only for derived samples and LSH values, not as an alternative metadata authority. The existing Catalog Schema Snapshot name remains reserved for the DWH-to-catalog synchronization RPC.

Considered Options

  • Direct PostgreSQL access from every consumer would duplicate catalog queries and expose storage details and credentials to the harness.
  • Immutable application-level generations and an atomic composite release would permit concurrent core use and rollback, but those capabilities are unnecessary under the accepted offline operating constraints.
  • Retaining or importing workspace annotations would preserve legacy semantic fields but would keep an obsolete second authority despite there being no production data to migrate.

Consequences

Every runtime metadata consumer uses the Catalog snapshot, not only Qdrant indexing. Read-only inspection may remain, but only the complete preprocessing command can mutate derived state. The workspace-preprocessing contract and tests describe this cutover directly; superseded partial command designs remain available only in Git history.