Skip to content

feat(store): unique sibling channel-group names with a repairing migration (RIG-3030) - #1595

Open
rigel-mintaka wants to merge 9 commits into
mainfrom
compass-server/rig-3030-group-refs-by-name
Open

rigel-mintaka wants to merge 9 commits into
mainfrom
compass-server/rig-3030-group-refs-by-name

Conversation

@rigel-mintaka

@rigel-mintaka rigel-mintaka commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Channel-group names cannot contain /. A top-level name is unique per namespace, and a nested name is unique under its parent. So a slash path from main's group-ref resolver (#1705) names at most one group under a given parent.

  • Migration 0002_channel_group_names.sql repairs existing rows as compass_system:
    • slash names are rewritten;
    • duplicates get a free -N suffix, and the pre-existing valid name is kept;
    • reserved top-level groups are untouched.
  • It then adds a partial unique index on (namespace for top-level groups, parent, name) and a no-slash CHECK.
  • CreateChannelGroup maps the unique violation to AlreadyExists.

History

This PR was re-sliced onto main. #1705 (RIG-4344) shipped agent group refs by leaf or slash path, which superseded this PR's resolver half (ChannelGroupByNameForViewer, pickGroup, the group_id-as-name agent wiring). Only the constraint half remains, as one commit.

Testing

  • Migration pgtest: duplicates, suffix skip, slash rewrite and collision, reserved names, nested, cross-tenant.
  • TestCreateChannelGroupSiblingNamesUnique, TestCreateChannelGroupNestedNameUniquePerParent.
  • Full store pgtest suite: ok, no skips.
  • sqlc-vet, the migration gate, the proto gates and golangci-lint all pass.

Linear: RIG-3030

RIG-4458 (ruled A + K1)

  • K1: a new namespace_owner_id column (the agent's owner user) keys the sibling-name index. A trigger fills it for inserts that omit it, so older binaries keep working during a rolling deploy.
  • A: a leading / anchors a ref at top level, and /~handle/ qualifies the top-level owner. An ambiguous ref still returns invalid_argument (DL-291), and the error names a ref for each match.
  • Visibility: an OWNER group an agent creates is now visible to its user and to that user's other agents, as the proto says.
  • Review: Opus found 3 medium and 4 low. All are fixed. The nested shared-parent dead end went to RIG-4651.
  • The migration is 0002_channel_group_names.sql on the collapsed baseline.

RIG-4651 (ruled)

  • A shared group has no per-user namespaces, so pub/infra exists once. A second create of the same name returns AlreadyExists.
  • The sibling index keys nested groups on the parent alone. Top-level names stay per namespace (K1).
  • The migration repair suffixes duplicate nested siblings across namespaces. The spec gains a scenario for this.

Ledger-impact: none (implements the RIG-4458 and RIG-4651 rulings in the record's own terms; no DL row changes).

@linear-code

linear-code Bot commented Oct 4, 2026

Copy link
Copy Markdown

RIG-3030

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Compass engineering docs preview: https://compass-server-rig-3030-grou.compass-eng-docs.pages.dev

Deployed from compass-server/rig-3030-group-refs-by-name at ae8ae97.

Changed pages:

Base automatically changed from compass-server/rig-3030-update-members-by-name to main October 4, 2026 14:08
@trunk-io

trunk-io Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

❌ This pull request could not start testing because there was a merge conflict. See more details here.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@rigel-mintaka
rigel-mintaka force-pushed the compass-server/rig-3030-group-refs-by-name branch 2 times, most recently from cf19956 to 57bd360 Compare October 5, 2026 18:19
@rigel-mintaka rigel-mintaka changed the title feat(comms): resolve agent group refs by name or slash path (RIG-3030) feat(store): unique sibling channel-group names with a repairing migration (RIG-3030) Oct 5, 2026
@rigel-mintaka
rigel-mintaka force-pushed the compass-server/rig-3030-group-refs-by-name branch from 81b184a to d40ea59 Compare October 6, 2026 05:08
@rigel-mintaka
rigel-mintaka marked this pull request as ready for review October 6, 2026 06:55
rigel-mintaka and others added 9 commits October 6, 2026 23:23
…ation (RIG-3030)

Group names become unique among one owner's siblings and may not contain a
slash, so a slash path from main's group-ref resolver names at most one of
an owner's groups. The migration repairs existing rows as compass_system:
slash names are rewritten, duplicates get a free -N suffix with the
pre-existing valid name kept, and reserved top-level groups are untouched.
CreateChannelGroup maps the new unique violation to AlreadyExists.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
…d reserved names (RIG-3030)

Co-authored-by: Matt Wilkinson <matt@rigel.build>
sqlc-vet replays migrations through autocommit psql, where a bare LOCK TABLE errors.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
…lify group refs (RIG-4458)

A leading / anchors a ref at top level and /~handle/ picks the owner, so every
visible group stays addressable while ambiguity still errors (DL-291).

Co-authored-by: Matt Wilkinson <matt@rigel.build>
…line (RIG-3030)

Co-authored-by: Matt Wilkinson <matt@rigel.build>
… old-binary inserts (RIG-4458)

An agent-created owner group is visible to its user and sibling agents, matching
the OWNER contract. A trigger fills namespace_owner_id for inserts that omit it.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
A shared group has no per-user namespaces, so a child name exists once
under its parent whoever creates it. Top-level names stay per namespace.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
Co-authored-by: Matt Wilkinson <matt@rigel.build>
…G-3030)

Co-authored-by: Matt Wilkinson <matt@rigel.build>

This branch has not been deployed

No deployments
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.

2 participants