Skip to content

D155 slice 3: corpus publication - #607

Merged
fazpu merged 13 commits into
mainfrom
feat/corpus-publish
Nov 13, 2026
Merged

fazpu merged 13 commits into
mainfrom
feat/corpus-publish

Conversation

@fazpu

@fazpu fazpu commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Summary

Implements D155 slice 3's document-folder publication capability and the design owner's accepted lock-loss and scaling decisions. Ordinary publication uses the existing work ledger; profile activation stays in slice 4.

The P1 scaling finding is fixed: publish_corpus no longer discovers the whole store or renders/HEAD-checks the whole navigation tree. Migration p9_51_0072 adds nullable documents.corpus_paths text[], the small set of possibly written document folders. The publisher commits the old-plus-desired path set on its advisory-lock session before object IO, lists only recorded document prefixes, writes the desired folder, removes old folders, and repairs only their ancestor indexes/radix pages plus root llms.txt. Old paths survive until navigation succeeds, including a crash after the last old-folder object deletion, then collapse to the desired path (or null after removal). Navigation membership/counts stream from current DB selections; unrelated branches are not rendered. A fresh tree initializes the fixed eleven type indexes once.

Radix pages now occupy a reserved ~/ subtree beneath their index, allowing bounded cleanup of obsolete pages without listing sibling document folders. The P3 builder policy advances to p3-reader-2026.11c:d155; this rekeys P3 exports only. No converter, extraction, Claimify, embedding, summary, or text-origin reuse boundary changes (Rule 4).

Full reconcile retains one full-store scan, unions discovered and recorded paths, repairs corpus_paths for served/unselected documents, and rebuilds all navigation. The deterministic suffix remains the repair/forget/restore and human lookup mechanism. D155, E0 §§5–7, the schema design, analysis and delivery plan state this contract; the former all-navigation implementation exception is removed.

Every provider mutation still checks the deployment advisory lock on its original PostgreSQL session and the live work claim. Finite S3 connect/read timeouts, disabled automatic SDK retries, bounded multipart units, streamed input verification and expected SHA-256 metadata remain. An already-issued request can still land after session loss and a newer publication: the marker means current inputs were published once. Digest-verifying reconcile repairs missing/mismatching metadata even behind a matching marker. This accepted rare transient staleness is unchanged; no fencing, receipt, journal or membership table was added.

Implementation

  • Streams selected originals and allowlisted reader derivatives, marks updating folders, writes inventory/readiness metadata, removes obsolete files/folders, regenerates DB-derived navigation, and marks success only when current inputs still match. Concurrent changes retain fresh durable work; equal digests avoid original/media recopy.
  • Uses unlaned publish_corpus work and fresh corpus_publication event targets with doc_id-only payloads. Served reading/structure and canonical title/MIME changes invalidate and enqueue in authoritative transactions. Current-policy seeding, stale-policy rejection, class claims and pushed run_task use existing leases/retries/DLQ/announcements.
  • Reconcile also removes orphan objects/navigation and abandoned multipart uploads where supported. No detached IO survives a handler. Delete/forget/restore profile integration and periodic verification remain slice 4.
  • Added counting-wrapper tests rejecting root/unrelated listings and unrelated navigation HEAD/write/delete operations across replay/title/topic/type/removal; asserts committed paths before IO, move-crash state and retry cleanup, and full-reconcile repair of missing DB path state. Existing slice 3 tests remain passing.
  • Companion draft ultimate-memory-cloud#1017 covers the existing generic pushed map; engine tests do not depend on the cloud repo.

Verification

All requested local checks passed on Python 3.13, with no hosted model calls:

  • Full unit inventory: 3,464 passed, 11 skipped. Includes 86 pure reader-renderer tests and the asset split/merge/link-resolution checks.
  • Affected PostgreSQL suites: 123 passed, 2 xfailed across migrations, work ledger, self-host queue, document metadata chain, processing layers, reuse lifecycle, D140 text origin and reader export. The 14 reader tests pass with a round-trip schema assertion requiring exactly the nullable marker and text[] cleanup paths. Both expected failures are the existing D122 previous-eight-Selection Claimify-window gap, for ordinary ingestion and backfill; paid-work reuse identities are unchanged.
  • Final storage invocation: 128 passed = 82 real-MinIO object/publication/late-write tests plus 46 S3 adapter tests. Includes all 50 publication cases: no ordinary root/unrelated listings, ancestor-only navigation touches, committed state before IO, ready-new-folder crash before cleanup, last-old-key crash before navigation, path-state repair, split/merge, moves/removal, source/claim/session failures and actual late-request digest repair.
  • Ruff check and format (749 files), Pyright (zero errors), all 5 import contracts, test inventory (174 unit / 94 integration files) and git diff --check passed.
  • Generator-only freshness passed: offline OpenAPI (36 routes, byte-identical), TypeScript contracts/client/surface/parity, docs llms exports and generated diagrams. Documentation truth checks passed; no generated artifacts changed.

Only this job used the configured shared test database, and all DB suites ran sequentially. Real MinIO was started with .github/ci/start-minio.sh.

Scope

Profiles remain unactivated. Delete/forget/restore integration, marker-based serving/readiness, periodic digest verification and provider qualification beyond MinIO remain in their planned slices. The full-store scan remains mandatory for forget/restore repair of independently restored objects. PR #607 stays draft and must not be merged as profile activation. Remote CI for the latest pushed commit is still running; the local checks above are complete.

Contributor agreement

Signing on behalf of a legal entity (leave blank if accepting individually):

@fazpu
fazpu marked this pull request as ready for review November 13, 2026 17:26
@fazpu
fazpu merged commit 846a792 into main Nov 13, 2026
20 checks passed
@fazpu
fazpu deleted the feat/corpus-publish branch November 13, 2026 17:26
@fazpu fazpu mentioned this pull request Nov 14, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant