Skip to content

Account/instance domain model fields, Relay connections, and GraphQL tests#18

Open
dahlia wants to merge 5 commits into
fedify-dev:mainfrom
dahlia:domain-models
Open

Account/instance domain model fields, Relay connections, and GraphQL tests#18
dahlia wants to merge 5 commits into
fedify-dev:mainfrom
dahlia:domain-models

Conversation

@dahlia

@dahlia dahlia commented Jun 24, 2026

Copy link
Copy Markdown
Member
  • Add name and admin fields to the accounts table; add admin and accepted fields to the instance_members table, treating NULL as a pending invitation. Generate the corresponding migrations under packages/models/drizzle.
  • Expose name and admin on the Account GraphQL type; expose uuid on both Account and Instance.
  • Add Relay-style instances connection on Account and members connection on Instance, both with totalCount and per-edge metadata (created, accepted, admin). Only accepted members appear in either connection.
  • Add partial indexes on instance_members (accountId and instanceId) that cover only accepted rows.
  • Add a GraphQL database test harness and a Yoga request test harness under packages/graphql/src.
  • Add tests for Account and Instance GraphQL fields and connections in packages/graphql/src/account.test.ts and packages/graphql/src/instance.test.ts.

Test code in packages/graphql/src/account.test.ts, packages/graphql/src/instance.test.ts, packages/graphql/src/harness.test.ts, and packages/graphql/src/harness-smoke.test.ts was written with assistance from Codex (GPT-5.5). All other changes were written without AI assistance. The AI-assisted test code has been manually reviewed and verified.

dahlia added 5 commits June 24, 2026 13:19
- Add `name` column to accounts table with a CHECK constraint ensuring
  non-empty names
- Add `accepted` timestamp to instance_members table to distinguish
  accepted members from invited (pending) ones
- Add partial indexes on instance_members for efficient lookups of
  accepted members
- Add filtered instanceMembers relations on both accounts and
  instances with `accepted IS NOT NULL` condition
- Add `instances` GraphQL connection on Account and `members` GraphQL
  connection on Instance, both filtering by accepted status
- Expose `name` field on Account and `slug` field on Instance in
  GraphQL

The instance_members junction table now tracks both invited and
accepted members. The `accepted` field is NULL for pending invitations.
Partial indexes on (accountId) and (instanceId) with `accepted IS NOT
NULL` optimize queries for active memberships.
Add a test-only helper that runs callbacks with a fresh migrated
PGlite database for GraphQL package tests.  Cover the helper with a
smoke test that verifies migrated tables are queryable.

Move shared database-related package versions into the pnpm catalog so
workspace packages can use the same PGlite, pg, and @types/pg versions.

Assisted-by: Codex:gpt-5.5
Add a test harness that builds a Yoga server on top of the temporary
migrated database helper.  The harness exposes the database, Yoga
server, bound fetch function, and a JSON POST helper for GraphQL tests.

Cover the harness with a smoke test that posts a simple operation
through the Yoga server.

Assisted-by: Codex:gpt-5.5
Add GraphQL tests for accountByUuid, Account.instances, and
Instance.members using the temporary Yoga test harness.  The tests seed
accepted and pending memberships to verify connection results only include
accepted relationships.

Assisted-by: Codex:gpt-5.5
Add admin flags to accounts and instance memberships, with the
corresponding Drizzle migration.

Define account and instance membership connections through Drizzle
connection helpers so their edges can expose membership metadata.  The
connections now include created, accepted, and admin fields while keeping
accepted-only filtering and totalCount behavior.

Assisted-by: Codex:gpt-5.5
@dahlia dahlia added this to the DrFed 0.1.0 milestone Jun 24, 2026
@dahlia dahlia self-assigned this Jun 24, 2026
@dahlia dahlia added the enhancement New feature or request label Jun 24, 2026
@dahlia dahlia requested review from 2chanhaeng, dodok8 and sij411 June 24, 2026 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Development

Successfully merging this pull request may close these issues.

1 participant