test(codegen): add BM25 search integration test#792
Closed
pyramation wants to merge 2 commits intomainfrom
Closed
Conversation
Adds a BM25 schema fixture (example-bm25.schema.graphql) and 13 integration tests exercising the full codegen pipeline with pg_textsearch BM25 plugin-injected types: - Bm25SearchInput (query: String!, threshold?: Float) - bm25Body/bm25Content condition fields on Article/Post - BM25_BODY_SCORE_ASC/DESC and BM25_CONTENT_SCORE_ASC/DESC orderBy values - Backwards-compatible CRUD/filter type generation
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test(codegen): add BM25 search integration test
Summary
Adds integration tests that verify the codegen correctly handles BM25 (pg_textsearch) plugin-injected types — the same pattern as pgvector but for text search. This exercises the fix from #791 against a BM25-shaped schema.
New files:
graphql/codegen/examples/example-bm25.schema.graphql— hand-crafted PostGraphile-style schema withArticle/Postentities,Bm25SearchInputcustom input type, plugin-injectedbm25Body/bm25Contentcondition fields, andBM25_*_SCORE_ASC/DESCorderBy valuesgraphql/codegen/src/__tests__/codegen/bm25-codegen-integration.test.ts— 13 integration tests exercising the full pipeline (FileSchemaSource → runCodegenPipeline → generateOrm)What the tests verify:
Bm25SearchInput(withquery: String!,threshold?: Float) is generated as a TypeScript interfacebm25Body/bm25Contentplugin-injected condition fields appear inArticleCondition/PostConditionBM25_BODY_SCORE_ASC/DESCandBM25_CONTENT_SCORE_ASC/DESCappear in orderBy union typesNo production code changes — test-only PR.
Review & Testing Checklist for Human
example-bm25.schema.graphqlis hand-crafted, not captured from a real PostGraphile introspection withBm25SearchPlugin. Compare the condition type shape (e.g.,bm25Body: Bm25SearchInputonArticleCondition) and orderBy enum naming (BM25_BODY_SCORE_ASC) against whatcreateBm25SearchPlugin()ingraphile-pg-textsearch-plugin/src/bm25-search.tsactually produces. If the real plugin uses different field naming conventions or type wrapping, these tests would pass but miss real-world issues.Bm25SearchInputis simpler thanVectorNearbyInput: It only referencesStringandFloat(built-in scalars), so this doesn't exercise transitive enum resolution the way the vector test does withVectorMetric. This is not a gap in the codegen fix, but worth noting for test coverage awareness.pnpm testingraphql/codegen/to confirm all 320+ tests pass (13 new + existing).Notes