Skip to content

test(codegen): add BM25 search integration test#792

Closed
pyramation wants to merge 2 commits intomainfrom
devin/1773283866-bm25-codegen-test
Closed

test(codegen): add BM25 search integration test#792
pyramation wants to merge 2 commits intomainfrom
devin/1773283866-bm25-codegen-test

Conversation

@pyramation
Copy link
Contributor

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 with Article/Post entities, Bm25SearchInput custom input type, plugin-injected bm25Body/bm25Content condition fields, and BM25_*_SCORE_ASC/DESC orderBy values
  • graphql/codegen/src/__tests__/codegen/bm25-codegen-integration.test.ts — 13 integration tests exercising the full pipeline (FileSchemaSource → runCodegenPipeline → generateOrm)

What the tests verify:

  • Bm25SearchInput (with query: String!, threshold?: Float) is generated as a TypeScript interface
  • bm25Body / bm25Content plugin-injected condition fields appear in ArticleCondition / PostCondition
  • BM25_BODY_SCORE_ASC/DESC and BM25_CONTENT_SCORE_ASC/DESC appear in orderBy union types
  • Standard CRUD and filter types are still generated correctly (backwards compat)

No production code changes — test-only PR.

Review & Testing Checklist for Human

  • Verify the fixture schema is realistic: example-bm25.schema.graphql is hand-crafted, not captured from a real PostGraphile introspection with Bm25SearchPlugin. Compare the condition type shape (e.g., bm25Body: Bm25SearchInput on ArticleCondition) and orderBy enum naming (BM25_BODY_SCORE_ASC) against what createBm25SearchPlugin() in graphile-pg-textsearch-plugin/src/bm25-search.ts actually produces. If the real plugin uses different field naming conventions or type wrapping, these tests would pass but miss real-world issues.
  • Bm25SearchInput is simpler than VectorNearbyInput: It only references String and Float (built-in scalars), so this doesn't exercise transitive enum resolution the way the vector test does with VectorMetric. This is not a gap in the codegen fix, but worth noting for test coverage awareness.
  • Run pnpm test in graphql/codegen/ to confirm all 320+ tests pass (13 new + existing).

Notes

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
@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

Base automatically changed from devin/1773279354-fix-vector-codegen-v2 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