Skip to content

test(codegen): add vector schema integration test for plugin-injected fields#790

Closed
pyramation wants to merge 5 commits intomainfrom
devin/1773277844-test-vector-codegen
Closed

test(codegen): add vector schema integration test for plugin-injected fields#790
pyramation wants to merge 5 commits intomainfrom
devin/1773277844-test-vector-codegen

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Mar 12, 2026

test(codegen): add vector schema integration test for plugin-injected fields

Summary

Follow-up to #791. Adds an integration test that exercises the full codegen pipeline (FileSchemaSource → runCodegenPipeline → generateOrm) against a hand-crafted vector (pgvector) schema fixture, validating that plugin-injected condition fields, orderBy values, and transitive types appear in the generated TypeScript output.

The transitive type resolution bug fix (for enum types like VectorMetric) and the VectorFilter scalar filter type have been upstreamed to #791. This PR now contains only the test infrastructure.

Changes

  1. New schema fixturegraphql/codegen/examples/example-vector.schema.graphql: a PostGraphile-style schema with Contact/Document entities, Vector scalar, VectorNearbyInput, VectorMetric enum, and plugin-injected condition/orderBy fields.

  2. Integration testvector-codegen-integration.test.ts (13 test cases): verifies pipeline table inference, typeRegistry contents, and generated ORM output including Vector→number[] mapping, condition fields, orderBy values, VectorNearbyInput/VectorMetric types, and backwards-compatible CRUD/filter types.

Updates since last revision

Review & Testing Checklist for Human

  • Check the fixture schema is realistic: example-vector.schema.graphql is hand-crafted, not captured from a real PostGraphile introspection. Verify the condition type shape (plugin-injected embeddingNearby alongside column fields) and orderBy enum values match what VectorSearchPlugin actually produces. If the real plugin output differs (e.g., different field naming or type wrapping), these tests would pass but not catch real-world issues.
  • String-matching assertions: The integration tests use toContain / toMatch on generated output strings. Confirm there are no false positives from matching substrings in unrelated sections of the generated file (e.g., "embeddingNearby" appearing in a comment vs. an actual field declaration).
  • Run pnpm test in graphql/codegen/ and pnpm build at workspace root to confirm all tests pass and build succeeds.

Notes

  • 13/13 integration tests pass locally; full suite (320 tests) passes; workspace build succeeds.
  • Unused imports cleaned up from initial commit.
  • Link to Devin session
  • Requested by @pyramation

…type resolution

- Add example-vector.schema.graphql fixture with Contact/Document entities,
  Vector scalar, VectorNearbyInput, VectorMetric enum, plugin-injected
  condition fields (embeddingNearby, contentEmbeddingNearby), and
  plugin-injected orderBy values (EMBEDDING_DISTANCE_ASC/DESC)

- Add vector-codegen-integration.test.ts that exercises the full codegen
  pipeline (FileSchemaSource → runCodegenPipeline → generateOrm) and
  verifies:
  - Tables are inferred correctly from vector schema
  - TypeRegistry includes vector-related types
  - Generated output maps Vector scalar to number[]
  - Condition types include plugin-injected fields
  - OrderBy types include distance-based sorting values
  - VectorNearbyInput and VectorMetric types are generated
  - Standard CRUD and filter types are still generated correctly

- Fix transitive type resolution in generateCustomInputTypes: follow all
  non-scalar types referenced by input fields (not just types ending with
  'Input'), so enum types like VectorMetric referenced by VectorNearbyInput
  are correctly included in generated output
@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

@devin-ai-integration devin-ai-integration bot changed the title test(codegen): add vector schema integration test and fix transitive type resolution test(codegen): add vector schema integration test for plugin-injected fields Mar 12, 2026
Base automatically changed from devin/1773277094-fix-vector-codegen to main March 12, 2026 04:32
@pyramation pyramation closed this Mar 12, 2026
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