Skip to content

fix(store): enforce hub approval access groups - #16

Merged
TudorAndrei merged 2 commits into
mainfrom
fix/hub-approval-foreign-key
Nov 14, 2026
Merged

TudorAndrei merged 2 commits into
mainfrom
fix/hub-approval-foreign-key

Conversation

@TudorAndrei

@TudorAndrei TudorAndrei commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Why

The store accepted hub approvals for missing access groups. Group deletion could leave an approval that failed later during hub sync. Closes #3.

What changes

flowchart LR
  subgraph Before
    A[Write approval] --> B[Accept missing group]
    C[Delete group] --> D[Keep approval]
  end
  subgraph After
    E[Write approval] --> F{Group exists?}
    F -->|Yes| G[Keep approval]
    F -->|No| H[Return error with group name]
    I[Delete group] --> J[Delete its approvals]
  end
Loading
  • Migration 019 keeps all fields of valid approvals and discards approvals for missing groups. It does not move approvals to another group.
  • The foreign key uses ON DELETE CASCADE. The owner approved this rule. An index on access_group supports group deletion.
  • A failed replacement keeps the old approval. The database constraint also applies to direct SQL writes.

A separate commit corrects the MCP server version from 0.3.0 to the package version 0.1.0, as required by the existing negotiation test.

Look at: crates/aether-store/migrations/node/019_hub_approval_access_group.sql, especially the rule for existing invalid rows.

Evidence

  • The regression test failed before the fix because the store accepted a missing group.
  • The original SQLite check now passes: an approval for a missing group fails at the foreign key.
  • cargo fmt --all -- --check: passed.
  • cargo clippy --all-targets --all-features -- -D warnings: passed.
  • cargo doc -p aether-store --no-deps: passed with two existing private-link warnings.
  • cargo test -p aether-store: 79 passed. cargo test -p aether-core: 8 passed.
  • The first workspace run stopped on an existing MCP version mismatch (0.3.0 versus package version 0.1.0). A separate commit corrects the reported value. The final cargo test --workspace passed: 564 tests and 98 feature scenarios (553 steps). Two live Codex tests and 18 documentation examples were skipped by the existing test settings. The final Clippy check also passed.

Three new tests cover invalid writes and replacement rollback, group deletion, and upgrade from schema 18 with valid and invalid rows. The upgrade test also checks data after reopening and the automatic backup. Added runtime is estimated at less than one second. Hub server and container checks were not run; the change is in the node store.

Merge danger

Door: one-way
Blast radius: node

Each node applies the migration when it first opens its database with the new binary. The store makes a backup before upgrade. Invalid approvals are discarded. Group deletion cancels all approvals for that group, including stored signed bundles. A source revert cannot restore deleted rows. An older binary refuses the new schema.

The wire formats, hub protocol, and signing keys do not change. Owners must restart the node with the new binary to apply this change.

After merge

  1. Owners update the node and restart aether node serve.

@TudorAndrei
TudorAndrei merged commit 5103c26 into main Nov 14, 2026
4 of 8 checks passed
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.

store: hub_approvals.access_group has no foreign key to access_groups

1 participant