Skip to content

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Jan 28, 2026

feat: initial Graphile v5 migration - minimal baseline

Summary

This PR establishes the foundation for migrating from PostGraphile v4 to v5, including the GraphQL 15→16 upgrade. The approach follows the agreed strategy: disable all plugins and middleware initially to get a minimal working baseline, then incrementally re-enable features.

Core dependency updates:

  • graphql: 15.10.1 → ^16.9.0
  • postgraphile: ^4.14.1 → ^5.0.0-rc.4
  • graphile-build: ^4.14.1 → ^5.0.0-rc.3
  • New deps: grafast, grafserv, graphile-config, pg-sql2

Architecture changes:

  • graphile-settings rewritten to use v5 preset pattern (PostGraphileAmberPreset)
  • graphql/server/middleware/graphile.ts rewritten to use postgraphile() + grafserv for Express integration
  • graphql/types/graphile.ts updated with GraphileConfig.Preset pattern
  • graphile-cache updated for v5 instance structure
  • TypeScript configs updated to use node16 moduleResolution (required for v5 ESM exports)

Temporarily disabled packages (to be migrated incrementally):

  • graphql/explorer, graphql/codegen, graphql/test, graphql/react
  • graphql/playwright-test, graphql/server-test
  • graphile/graphile-test, packages/cli

CI workflow changes:

  • Commented out all graphile/* plugin tests (depend on v4 APIs)
  • Commented out all graphql/* package tests (depend on v4 server)
  • Commented out packages/cli and jobs/knative-job-service tests (depend on graphql packages)

Migration plan documented in docs/plan/graphile-v5-migration.md.

Review & Testing Checklist for Human

  • Verify server starts: Run the server locally and confirm it starts without errors. The middleware was completely rewritten and build passing doesn't guarantee runtime correctness.
  • Test basic GraphQL query: Execute a simple query against the running server to verify the grafserv integration works.
  • Review type casting in graphql/server/src/middleware/graphile.ts lines 52-53: The context function uses (ctx: unknown) with type assertions - verify this matches the actual grafserv context structure.
  • Confirm disabled packages are acceptable: 8 packages have builds disabled and ~20 CI test jobs are commented out. Verify this doesn't break any critical workflows.
  • Review graphile-settings/src/index.ts: This was rewritten from v4 options to v5 preset pattern - verify the minimal preset configuration is correct.

Recommended test plan:

  1. pnpm install && pnpm build (should pass)
  2. Start the server with a test database
  3. Navigate to /graphiql and run a basic query
  4. Verify authentication/context is passed correctly

Notes

The v5 spike repo (constructive-io/graphile) was used as reference for correct patterns but not imported directly.

Link to Devin run: https://app.devin.ai/sessions/0b3cd9962e044fd28cc3cefb5fb61ea4
Requested by: Dan Lynch (@pyramation)

This commit establishes the foundation for migrating from Graphile v4 to v5:

Core changes:
- Update graphql from 15.10.1 to ^16.9.0
- Update postgraphile from ^4.14.1 to ^5.0.0-rc.4
- Update graphile-build from ^4.14.1 to ^5.0.0-rc.3
- Add new v5 dependencies: grafast, grafserv, graphile-config, pg-sql2

Architecture changes:
- Rewrite graphile-settings to use v5 preset pattern (PostGraphileAmberPreset)
- Update graphile-cache for v5 instance structure (pgl, serv, handler)
- Rewrite graphql/server middleware to use v5 postgraphile() and grafserv
- Update graphql/types with GraphileConfig.Preset pattern
- Use node16 moduleResolution for v5 ESM exports

Temporarily disabled packages (to be migrated incrementally):
- graphql/explorer
- graphql/codegen
- graphql/test
- graphql/react
- graphile/graphile-test
- packages/cli

The server middleware now uses:
- v5 preset-based configuration
- grafserv for Express integration
- grafast context for request context (replacing pgSettings function)
- Direct SQL queries in api.ts (replacing graphile-query)

Next steps documented in docs/plan/graphile-v5-migration.md
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Temporarily disabled in CI workflow:
- All graphile/* plugin tests (depend on v4 APIs)
- All graphql/* package tests (depend on v4 server)
- packages/cli and jobs/knative-job-service (depend on graphql packages)

Also disabled builds for:
- graphql/playwright-test
- graphql/server-test

These will be re-enabled incrementally as each package is migrated to v5.
@devin-ai-integration devin-ai-integration bot deleted the feature/graphile-v5-migration branch January 28, 2026 01:56
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