Add unwired exact-selected Sites publication orchestration

Merged
SI
5d ago
+1213-35

Sites has evidence capture/read adapters but needs publication orchestration bound to the exact selected preview and explicit intent. This adds an unwired orchestrator against Database proposal #136, exact successor afd214aa73dfd70b0f2b860fce90c12ceb23f28b.

The server independently resolves the selected draft or signed working build and requires matching digest/revision/owner/artist plus explicitly nullable publication-pointer metadata. Workspace, Context, artist, paid entitlement and prepared fan configuration are checked before evidence capture and rechecked before publication. A stored review or explicitly requested override runs through the complete existing predicate. SQL receives the immutable record identity, selected digest, expected pointer and expected artist ID; its site-row lock now fences artist changes before publication writes. It publishes the stored candidate, never request-supplied replacement bytes.

Existing advisory publishing remains unchanged. Shared paid, return-URL and capture-envelope transforms are reused. Only the new path opts into Stripe read-error propagation (503 versus a real unpaid402). Missing/malformed pointer or evidence metadata fails closed; errors never become implicit overrides, replacement keys or automatic retries. There is no public route, UI/MCP/workflow caller, new mandatory artist approval, schema exposure, runtime grant, migration or activation. Database #136 stays draft and unmerged.

Remaining gates: external artist access/name, paid entitlement, Context, fan configuration and Workflow reads are not atomic with SQL. Latest-preview races, pointer ABA, explicit selection/override interaction, artist/fan preparation transitions, SQL release/admission and retention remain separate. The expected-artist fence closes the identified site-artist-ID race, not these other policies. Receipt/transport errors can follow a committed publication and must not trigger blind retries. See docs/site-selected-publication.md.

Validation:181 focused/regression tests across16files, actual-import TypeScript check, repository lint, changed-file formatting and diff check. Database proposal:30disposable tests on each PostgreSQL15.10/17.7 (29proposal+1inherited), including artist mismatch/no-write, null semantics and observed lock contention. API boundaries are mocked; actual identity/predicate/golden serialization are exercised. Independent spec/standards reviews cleared exact API1f2b819f1e01d3e158829a678cd84799f81274b5 paired with SQLafd214a. All8initial automated findings are addressed and resolved. Final cleanup head 97b5d6a800ad2e77091d388911a1d2381b65a932 is fully green: Unit workflow 44201131099 checked synthetic merge 39ec4968 with an identical tree, passed9,975tests/53skipped and every later offline/type step. Both independent reviewers cleared the cleanup; all10review threads are resolved. Final Cubic review found zero new issues in its four-file delta scope. Cross-repository authority remains bounded by the paired reviews and documented activation gates.