Skip to content

feat(coordinator): move one Project to its own boundary in one transaction - #3072

Merged
kunickiaj merged 1 commit into
mainfrom
feat/project-move-commit
Nov 29, 2026
Merged

kunickiaj merged 1 commit into
mainfrom
feat/project-move-commit

Conversation

@kunickiaj

@kunickiaj kunickiaj commented Nov 29, 2026 •

Copy link
Copy Markdown
Owner

Description

The coordinator can now move one Project from its older scope to its own boundary. One atomic batch, on SQLite and D1, creates the managed_project boundary, gives it the older scope's authorized members with their roles, writes one membership audit row each, and logs the move. A move is one-way. It reads and writes nothing of readiness.

  • What gets copied: the batch copies the members with one INSERT ... SELECT that reads them as they are when the write runs. A member counts as authorized with an active membership at the scope's epoch, an enabled enrollment and no revocation of the device or its key.

  • Exclusions: the admin device sends excluded_device_ids, such as devices of people removed from the Team. It also sends team_removal_seq, the group's Team removal sequence it built that list from. Team removals don't revoke the older scope's rows, so the sequence is what keeps the list current. A move whose group has recorded a removal since then is refused, and the admin device rebuilds the list.

  • Refusals: a move is refused, and nothing is written, when:

    • the asking device isn't an enrolled, unrevoked device of the group, or its key ID was never filled in;
    • the older scope isn't an active coordinator scope with members;
    • the boundary already has a scope or a membership row;
    • a member's key ID was never filled in, so its key can't be checked against revocations;
    • any member doesn't list project_boundary_migration_v1 in its presence.

    The key and version refusals name the waiting devices.

  • Checks inside the write: the batch checks the asking device, the boundary, the removal sequence and the completeness of the copy again, and aborts as a whole if any changed. A repeated request returns the logged move.

  • Contract doc: it now also says what the admin device records. Recipients are only people and Teams, and every device the older scope authorized keeps access.

Type of Change

  • 🚀 Feature (new functionality)
  • 🐛 Bug fix (fixes an issue)
  • 📚 Documentation (docs-only change)
  • 🔧 Maintenance (refactor, chore, CI, etc.)
  • 🧪 Testing (test-only changes)

Testing

  • One contract suite runs on SQLite, emulated D1 and native D1 in the Worker. It covers:

    • moving, repeats and exclusions;
    • every kind of member that must not be copied;
    • each refusal;
    • races in which the members, presence, Team removals, keys, the boundary or the asking device change between the decision and the write.
  • Disabling each of the move's 26 checks in turn makes a test fail.

  • The D1 statement check, pnpm run tsc and the Biome ratchet pass. The full suite runs in CI.

  • Relevant checks pass locally (pnpm run tsc, pnpm run lint, pnpm run test)

  • Added/updated tests for changes

  • Manually verified changes work as expected

Checklist

  • Code follows project style (pnpm run lint passes for touched files)
  • Self-review completed
  • Documentation updated (if needed)
  • No new warnings introduced

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T04:13:55.788428Z 216cda6 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 84dc8ce6f8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kunickiaj
kunickiaj force-pushed the feat/project-move-commit branch from 84dc8ce to 36df0b0 Compare November 29, 2026 03:13
@kunickiaj
kunickiaj force-pushed the feat/project-moves-contract branch 2 times, most recently from 056d907 to f13948e Compare November 29, 2026 03:52
@kunickiaj
kunickiaj force-pushed the feat/project-move-commit branch from 36df0b0 to 384a59a Compare November 29, 2026 03:52
@kunickiaj kunickiaj mentioned this pull request Nov 29, 2026
8 of 12 tasks
Base automatically changed from feat/project-moves-contract to main November 29, 2026 04:09
…ction

The coordinator moves one Project from an older scope to its managed_project boundary with one atomic batch on SQLite and D1. It reads what its conditions need, decides, and writes only if the batch's first statements find the same values again: the asking device's enrollment, key, Identity and revocation state; that the boundary has no scope or membership row; and a fingerprint of the older scope, its members, their enrollments and stored presence, and the revocations. A failed check aborts the whole batch, and the move reads again to say why.

The version gate refuses the move until every authorized member of the older scope lists project_boundary_migration_v1 in its stored presence, and names the devices that don't. The batch then creates the boundary, copies only the older scope's active authorized members with their roles, writes one audit row each and logs the move. A repeated request returns the logged move. The move reads and writes nothing of readiness.

The contract now says what the admin device records: recipients are people and Teams, every device the older scope authorized keeps access, a device bound to no person makes its scope wait, and a Project in two older scopes is held.
@kunickiaj
kunickiaj force-pushed the feat/project-move-commit branch from 384a59a to 216cda6 Compare November 29, 2026 04:12
@kunickiaj
kunickiaj merged commit 1b3e075 into main Nov 29, 2026
23 checks passed
@kunickiaj
kunickiaj deleted the feat/project-move-commit branch November 29, 2026 04:30
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