Skip to content

feat: consolidate graphile-misc-plugins into graphile-settings and add @requiredInput plugin#842

Merged
pyramation merged 2 commits intomainfrom
devin/1773737841-consolidate-plugins-required-input
Mar 17, 2026
Merged

feat: consolidate graphile-misc-plugins into graphile-settings and add @requiredInput plugin#842
pyramation merged 2 commits intomainfrom
devin/1773737841-consolidate-plugins-required-input

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Mar 17, 2026

Summary

Two changes in one PR:

1. Package consolidation: Moves all source files, tests, and dependencies from graphile-misc-plugins into graphile-settings/src/plugins/. The graphile-misc-plugins package is deleted entirely. graphile-settings was the only internal consumer — it previously re-exported everything from graphile-misc-plugins via workspace:^. All imports in constructive-preset.ts and test files are updated to use local paths.

2. New RequiredInputPlugin: Implements the missing Graphile plugin that reads the @requiredInput smart tag (injected by constructive-db's api_required column) and wraps the corresponding GraphQL input field type with NonNull. This makes mutation inputs (create/patch/base) require the field, while keeping output types nullable. This is the application-side counterpart to the database-side plumbing in constructive-db (see tg_sync_api_required_smart_tag trigger).

Updates since initial revision

  • Fixed a missed dynamic import('../src/PublicKeySignature') path in PublicKeySignature.test.ts line 44 (static imports were updated but this dynamic import was not, causing CI failure).

Review & Testing Checklist for Human

  • Verify no external consumers depend on graphile-misc-plugins — the package was published to npm with "access": "public". If anything outside this monorepo imports it, this is a breaking change. Check npm dependents.
  • Verify build.inflection.attribute() is the correct PostGraphile v5 inflection for mapping DB attribute names → GraphQL field names in required-input-plugin.ts:71-74. The plugin was only tested with mocks, not a real PostGraphile build object. If this inflection is wrong, the plugin silently skips fields (fail-open) rather than crashing — safe, but incorrect.
  • Verify scope checks are complete — the plugin activates on isPgPatch || isPgBaseInput || isMutationInput. Confirm these cover all mutation input type scopes in PostGraphile v5 and that no output/filter types are accidentally affected.
  • End-to-end test recommended: Deploy against a database with @requiredInput smart tags (e.g., grantor_id on memberships) and verify the GraphQL schema shows the field as non-nullable in mutation inputs but nullable in query output types.
  • Check Lerna/workspace config — ensure the removed graphile-misc-plugins package doesn't need cleanup in pnpm-workspace.yaml or Lerna configuration.

Notes

  • The RequiredInputPlugin tests (14 cases) use mocked build/context objects, not a real PostGraphile schema. They verify the hook logic in isolation but cannot catch issues with real inflection or scope naming.
  • Lockfile changes are from removing the graphile-misc-plugins workspace package, causing deduplication of transitive resolution entries.

Link to Devin session: https://app.devin.ai/sessions/7b2047110b374fc884c1ea081c201ce1
Requested by: @pyramation

…@RequiredInput plugin

- Move all plugin source files from graphile-misc-plugins/src/ to graphile-settings/src/plugins/
- Move all tests from graphile-misc-plugins/__tests__/ to graphile-settings/__tests__/
- Update all imports to use local paths instead of graphile-misc-plugins package
- Update graphile-settings package.json with dependencies from graphile-misc-plugins
- Remove graphile-misc-plugins package from workspace
- Implement RequiredInputPlugin: reads @RequiredInput smart tag and makes mutation input fields non-nullable
- Add RequiredInputPreset to ConstructivePreset
- Add comprehensive tests for RequiredInputPlugin (14 test cases)
@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

@pyramation pyramation merged commit 60f7eca into main Mar 17, 2026
43 checks passed
@pyramation pyramation deleted the devin/1773737841-consolidate-plugins-required-input branch March 17, 2026 09:24
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