feat(sharing): Postgres companion and verified link migration (PR 5/9) #661
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/sokar-sharing-postgres"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The Talos Sokar sharing companion currently stores mutable link authorization state only in a node-local SQLite file. This PR vendors that companion and its tests into
services/sokar-sharing/and adds an opt-in Postgres backend, retaining SQLite as the default and preserving the HTTP/security contract. It is PR 5/9, following merged #655; merging does not change production behavior.Implementation
e061ea36a85d1915072b26b9c8f7ae34f14a9147. Existing fragment capabilities, hashed token storage, expiry/revocation, content pinning, post-fetch recheck, CSP, isolated origin and credential boundary remain intact.LINK_STORE=postgresselects typed link rows in an explicit owned schema, with unique token hashes and expiry index.LINK_DATABASE_URL_FILEsupplies the ESO-delivered connection material. Production requiressslmode=verify-fulland an explicit network hostname; driver text/URLs/row values never reach responses or logs. Bounded DB operations fail closed with no SQLite fallback.main-<sha>image/OCI revision; it does not push or deploy. No startup dependency installation, bytecode cache rebuild or PG-mode local DB writes.Validation
python3 services/sokar-sharing/test-postgres.py: 57 tests passed, no skips, under each of umask 0002 and 0077. Includes the original HTTP/upstream suite on both SQLite and disposable Postgres, restart/URL continuity, outages, expiry/revocation races, strict import refusal, atomic rollback, concurrent import/write exclusion, lost-ack reconciliation, and reverse export after new writes. Fixture directories/files use explicit private modes. The container runs as UID/GID 10001 with read-only root and tmpfs; no fleet credentials.Python syntax, shell syntax and
git diff --checkpass. The follow-up CI fixture fix compiled only akh-service-store; no workspace-wide Cargo or unrelated Docker sweep. Dedicatedtest-sokar-sharingCI job runs the same harness. Observed latest resolution: Python 3.15.0, psycopg/binary 3.3.6, libpq 18.6, SQLite 3.46.1, disposable Postgres 18.6. These are recorded observations, not pins. Details:services/sokar-sharing/VALIDATION.md.Remaining operator gates
No Talos manifest/volume/backend change, production import, secret mutation, archive extraction, image publication or deployment. PR 6 must reuse houses #208/#212 CNPG/ESO/role artifacts and check the delivered TLS paths; this PR creates no competing store, role or registry/placement change. PR 9 still requires the disposition ledger and separate operator GO. The runbook documents preserved API limitations: create has no idempotency key, so a lost create response cannot recover plaintext capability from its hash; revocation is idempotent. Rollback after PG writes must use a fresh reverse export, never the stale archive/PVC.
Please review and merge; the agent will not merge.
Review fixes and CI diagnosis
uri=True; the regression test verifies URI opt-in, rejects a real write through that connection, and checks unchanged source bytes/directory contents.COLLATE "C".e0831dferun was not a sweep or sharing regression. Its broad platform suite passed. Original Solstice logs identifiedsqlite_independent_connections_serialize_admissionunwrappingstorage_error: database is lockedin the later storage harness. The old test raced 60 durable commits against the existing five-second busy timeout.Issue #662 records all three reported incidents with corrected attribution (sweep, analogy, SQLite contention), original assertions and runner evidence. It proposes a deterministic/injected-clock sweep fix in a separate small PR after PR 6; the unrelated analogy needs separate investigation.
Final exact-head CI evidence
All 15/15 jobs and commit-status checks passed in Forgejo run 4304 / API 9973 at
c62371a0037bd22fd549e482c8836ee41f285ce9. This includes sharing parity/migration, the full platform job and disposable storage/private-slot harness, Akh-Medu and Sokar tests, Seshat/core checks, Docker checks, chart and all five platform-image jobs. The revised SQLite fixture explicitly passed in the original runner log, followed by all 24 service-store unit tests and the integration groups.The PR remains open for operator review/merge. No merge, deployment, production import, volume switch or manifest change was performed.