feat: schema for cross-instance write path (#12) #63

Merged
claude-bot merged 1 commit from feat/v7-schema-remote-contributions into main 2026-06-30 01:10:31 +00:00
Contributor

Closes #12. First slice of v7 (host-inbound-first), the foundation everything else writes to.

Migration 041_remote_contributions.sql

project_collaborators.remote_actor_url — name an invited editor by their ActivityPub actor URL instead of a local user row:

  • Per-project unique (idx_pc_unique_remote_editor), mirroring the existing local-editor index — so one remote actor can edit several projects.
  • The editor-needs-an-identity check (chk_pc_editor_registered) now accepts a remote actor; new chk_pc_local_xor_remote ensures a row is local xor remote (viewer/commenter share links remain neither).

remote_contributions — logs each inbound signed write activity and its disposition (pending/applied/rejected/conflict); doubles as the #11 conflict review queue. Includes ap_activity_id (unique-when-present) so #10's inbox can process idempotently. Indexed for the review queue (project_id, status) and for #61's defederation sweep (remote_actor_url).

Two deliberate deviations from the literal issue text

  • The issue says remote_actor_url "UNIQUE when not null"; implemented as per-project unique so a remote actor isn't limited to one project instance-wide (matches how local editors work).
  • Added ap_activity_id (not in the issue's column list) — inbox idempotency is a near-certain need for #10, and migrations can't be edited after the fact.

Verification (dev server)

  • Migration applies cleanly ([test] migration applied: 041_remote_contributions.sql).
  • New remoteContributions.test.ts9 schema tests (remote-editor accepted; missing-identity / both-identities / duplicate-actor rejected; same actor across projects allowed; activity_type/status checks; ap_activity_id idempotency).
  • Full API suite: 184 passed (was 175), no regressions.

🤖 Generated with Claude Code

Closes #12. First slice of **v7** (host-inbound-first), the foundation everything else writes to. ## Migration `041_remote_contributions.sql` **`project_collaborators.remote_actor_url`** — name an invited editor by their ActivityPub actor URL instead of a local user row: - Per-project unique (`idx_pc_unique_remote_editor`), mirroring the existing local-editor index — so one remote actor can edit several projects. - The editor-needs-an-identity check (`chk_pc_editor_registered`) now accepts a remote actor; new `chk_pc_local_xor_remote` ensures a row is local *xor* remote (viewer/commenter share links remain neither). **`remote_contributions`** — logs each inbound signed write activity and its disposition (`pending`/`applied`/`rejected`/`conflict`); doubles as the #11 conflict review queue. Includes `ap_activity_id` (unique-when-present) so #10's inbox can process idempotently. Indexed for the review queue (`project_id, status`) and for #61's defederation sweep (`remote_actor_url`). ## Two deliberate deviations from the literal issue text - The issue says `remote_actor_url` "UNIQUE when not null"; implemented as **per-project** unique so a remote actor isn't limited to one project instance-wide (matches how local editors work). - Added **`ap_activity_id`** (not in the issue's column list) — inbox idempotency is a near-certain need for #10, and migrations can't be edited after the fact. ## Verification (dev server) - Migration applies cleanly (`[test] migration applied: 041_remote_contributions.sql`). - New `remoteContributions.test.ts` — **9 schema tests** (remote-editor accepted; missing-identity / both-identities / duplicate-actor rejected; same actor across projects allowed; `activity_type`/`status` checks; `ap_activity_id` idempotency). - Full API suite: **184 passed** (was 175), no regressions. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
feat(p12): schema for cross-instance write path (#12)
All checks were successful
CI / App — typecheck, test & build (push) Successful in 1m33s
CI / API — typecheck & tests (push) Successful in 2m23s
CI / App — typecheck, test & build (pull_request) Successful in 1m35s
CI / API — typecheck & tests (pull_request) Successful in 2m16s
2ecca193f2
Migration 041 lays the foundation for v7 collaborative editing:

- project_collaborators.remote_actor_url — name an invited editor by their
  ActivityPub actor URL instead of a local user. Per-project unique (one
  actor can edit many projects); a collaborator is local XOR remote; the
  editor-needs-an-identity constraint now accepts a remote actor.
- remote_contributions — logs each inbound signed write activity and its
  disposition (pending/applied/rejected/conflict); doubles as the #11
  conflict review queue. ap_activity_id gives the inbox an idempotency guard.

Note: the issue says remote_actor_url "UNIQUE when not null"; implemented as
per-project unique (mirrors the local-editor index) so a remote actor isn't
limited to a single project instance-wide.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
claude-bot scheduled this pull request to auto merge when all checks succeed 2026-06-30 01:08:17 +00:00
claude-bot deleted branch feat/v7-schema-remote-contributions 2026-06-30 01:10:32 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
rbrooks/TeaLeaves!63
No description provided.