Repository navigation
Diagnostic reports read memory at the Postgres authority's barrier and cite only the heads it serves - #391
Merged
Conversation
zlareb1
force-pushed
the
feat/i160-pg-reports
branch
6 times, most recently
from
November 7, 2026 23:07
5c56be9 to
548743c
Compare
…d cite only the heads it serves namespace.audit, namespace.validate, namespace.tune, memory.inspect and knowledge.inspect's decision counts start once ClickHouse holds what the namespace committed. A wait that runs out, or a Postgres that does not answer, reads on and names `projection` in `skipped` and `coverage`. A finding cites a sampled row only while it is its key's live head at the version read. Related: #160 Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ings say they read on, and each report's skip path is tested Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ion hash reads the head it kept; a Postgres outage at the citation read is tested Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… projection wait Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
….inspect's docstring names the wait's side effect and parked writes Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…is main's again; the evidence and wait-setting comments name the reports Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… come from _row_key; the report_rules imports are one line again Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…flag's comment says what it means Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… with fenced_until set Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…amespace committed Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ry.inspect's complete Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ect's incomplete views Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…s is not cited Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
feat/i160-pg-reports
branch
from
November 7, 2026 23:52
548743c to
6cf2da1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: #160
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
Under the Postgres storage authority,
namespace.audit,namespace.validate,namespace.tune,memory.inspectandknowledge.inspect's decision counts and memory findings read memory once ClickHouse holds every write the namespace committed, and say so inskippedwhen it does not; a finding cites a row only while the authority still serves that version.Why
Under
LOOM_STORAGE_AUTHORITY=postgresthe diagnostic reports read ClickHouse alone. A write committed to Postgres and not yet published was missing from their counts, and a finding could cite a ClickHouse row that the authority had already rewritten, deleted or redacted. Before this change such a row was cited at the old version with an empty hash.docs/architecture/storage-authority.mdlistedmemory.inspect's counts and the cited revisions ofnamespace.auditandnamespace.validateas open against the isolation gate.namespace.inventoryalready waited at the search barrier.What changes
pg_validation.published_reads(org, namespaces, skip)waits for ClickHouse to hold every revision committed so far in the namespace, using the sameadmita search andnamespace.inventoryuse. If anything was behind, the reads that follow are sequential. A parked delivery is not waited for.namespace.inventorynow uses this helper and behaves as before: past the wait it answers 503PROJECTION_BEHIND.skipped. When the wait runs out (PROJECTION_BEHIND) or Postgres does not answer (POSTGRES_UNAVAILABLE), they read what ClickHouse holds and addprojection: <code>: <why>toskipped. Audit and validate also listprojectionincoverage.rules_skipped, socoverage.completeis false.memory.inspectthen reports both views withcomplete: false, since they may miss committed writes.knowledge.inspectwaits once, around its decision tally and the audit it runs for its memory findings, the sections that read memory rows; its documents are not part of the memory authority.knowledge.inspectrun the audit inside their own wait.reads.live_revisionskeeps a ClickHouse row only while the authority's head of its key has the same version and the same redaction state. The row is hashed from that head's value, which is whatmemory.getserves. A rewritten, deleted or redacted row is not cited._served_hashes.redacted_at IS NOT NULLas well (tests/analyzer/shapes.txtregenerated).docs/architecture/storage-authority.mddescribes the reports' barrier and citations, and drops them from the list of reads that are still open;docs/features/namespaces-and-sharing.mdnamesprojectionin coverage, inmemory.inspect'scomplete, and the Postgres rule for which rows are cited.On the ClickHouse authority (the default) nothing changes:
admitreturns at once, and the citation read takes the same path as onmainplus the one column.Scope and risk
LOOM_PG_PROJECTION_WAIT_MS(2 s by default). As with a search's wait, the report may publish another writer's lapsed deliveries while it waits (wait_searchablecallsdeliver_namespace), which inserts their ClickHouse rows and embeds their search documents.evidenceappears inskipped; the report still answers (test_a_postgres_down_at_the_citation_read_leaves_the_findings_uncited).skippedandcoveragecan nameprojection.Tests
tests/unit/test_pg_authority.py):skipgets the 503; a caller with one is told the code.projectioninskipped:coverageis then not complete (test_namespace_audit.py,test_namespace_validate.py);memory.inspectwith Postgres down (test_memory_inspect.py);knowledge.inspect, which reads its decisions and the audit's findings in one wait the audit does not repeat (test_knowledge_inspect.py);test_namespace_tune.py).tests/integration/test_pg_authority.py, which runs in CI'sintegration-postgresjob): after a newer version is committed with its delivery parked, the audit still raises ClickHouse's finding but cites no row for it,coveragestays complete, andmemory.getserves the newer version.tests/analyzer, doc links, public copy, settings reference and package contracts pass. The Postgres integration test was not run locally (the host had too little memory for ClickHouse, Postgres and a server); CI's Postgres 16 and 18 jobs run it and pass.🤖 Generated with Claude Code