fix: make trgm adapter supplementary, enhance codegen docs, and slim down AGENTS.md#825
Merged
pyramation merged 6 commits intomainfrom Mar 15, 2026
Merged
Conversation
…degen docs - Add isSupplementary flag to SearchAdapter interface - trgm adapter now only activates on tables that already have intentional search (bm25 indexes, tsvector columns, pgvector embeddings) - Plugin's getAdapterColumns runs primary adapters first, then only runs supplementary adapters if primary adapters found columns - getEditableFields now accepts TypeRegistry to filter out computed/search fields - Add getSearchFields utility to identify plugin-added search fields - CLI docs generators pass registry to getEditableFields for proper filtering - Add 'Search API fields (computed, read-only)' callout in generated docs
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:
|
pgvector operates on embedding vectors, not text search. Add isIntentionalSearch flag to SearchAdapter interface so that only adapters representing real search infrastructure (tsvector, BM25) trigger supplementary adapters. pgvector sets isIntentionalSearch: false.
…t intentional search
… inline references AGENTS.md files are auto-ingested by AI coding agents. Large files reduce task success rates and increase inference cost (ETH Zurich research). Changes: - CLI AGENTS.md: stack overview, quick start, pointer to README.md - Multi-target CLI AGENTS.md: same pattern with target info - ORM AGENTS.md: stack overview, quick start, pointer to README.md - Hooks AGENTS.md: stack overview, quick start, pointer to README.md - Full API references remain in README.md (opt-in, not auto-ingested) - Skills references removed from AGENTS.md (generated separately)
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.
Summary
Fixes the issue where trgm similarity fields (
nameTrgmSimilarity,searchScore, etc.) were appearing as required create fields in generated CLI README docs for every table with text columns — even tables with no intentional search configuration.Three-layer fix:
Graphile search plugin (
graphile-search): IntroducesisSupplementaryandisIntentionalSearchflags on theSearchAdapterinterface. The trgm adapter now defaults torequireIntentionalSearch: true, making it supplementary. The plugin'sgetAdapterColumnsruns primary adapters first, then only runs supplementary adapters (trgm) if at least one adapter withisIntentionalSearch: truefound columns on that table.Crucially, pgvector sets
isIntentionalSearch: false— embedding columns are a different domain from text search, so their presence alone does not trigger trgm. Only tsvector columns and BM25 indexes count as "intentional search."Codegen docs (
graphql/codegen):getEditableFieldsnow accepts an optionalTypeRegistryand usesgetWritableFieldNamesto filter out computed/plugin-added fields. A newgetSearchFieldsutility identifies these fields so they can be excluded from create/update field lists.Special field categorization in generated docs: A new
categorizeSpecialFieldsutility detects and groups fields into three categories — PostGIS geospatial, pgvector embeddings, and Unified Search API — and surfaces them with descriptive context in README and skill reference docs.Updates since last revision
generates CLI AGENTS.md,generates ORM AGENTS.md,generates hooks AGENTS.md,generates multi-target AGENTS.md) removed fromcli-generator.test.tsalong with their stale snapshot entries (~903 lines deleted from snapshot file) and unused imports. Since AGENTS.md is now a thin router, snapshot-testing its content adds maintenance burden without meaningful coverage.Previous updates
generateAgentsDocs,generateMultiTargetAgentsDocs,generateOrmAgentsDocs,generateHooksAgentsDocs) now emit ~30-50 line index files instead of full inline API references. Each AGENTS.md now contains only: stack overview, quick start snippet, links toREADME.mdfor full API docs, conventions, and a "do not edit" boundary notice. This is motivated by research showing large auto-ingested AGENTS.md files reduce agent task success rates and increase inference cost. Full API references remain inREADME.md(opt-in, not auto-ingested). Net change: ~780 lines of inline content generation removed, replaced with ~89 lines of minimal router content.buildSpecialFieldsPlainimport removed from CLI and ORM docs generators (special field sections now only appear in README and skill files, not in the slim AGENTS.md).graphql/server-test): Theschema-snapshot.test.tssnapshot was regenerated. It confirms the plugin changes work correctly — trgm similarity fields, trgm search filters,fullTextSearchfilters, trgm ordering enums, andsearchScorewere all removed from 5 tables (users, posts, tags, comments, post_tags) that have no tsvector/BM25 columns. This is a 200-line deletion from the snapshot, validating the supplementary adapter logic.Review & Testing Checklist for Human
requireIntentionalSearchdefaults totrue— any existingcreateTrgmAdapter()call with no options will now suppress trgm on tables without intentional search. PassrequireIntentionalSearch: falseto restore old behavior. Check all call sites.types.ts):isSupplementarycontrols whether an adapter waits for others;isIntentionalSearchcontrols whether an adapter's presence triggers supplementary adapters. Verify the interaction is correct — e.g. a table with only pgvector columns (isIntentionalSearch: false) should NOT activate trgm, but a table with tsvector + pgvector should.README.md,types.ts,orm.ts,hooks.ts,helpers.ts). Verify these files are actually emitted by the corresponding generators so the links resolve. Runcnc codegenand inspect the generatedAGENTS.mdfiles across CLI, ORM, and hooks directories.## TOOLS,## HOOKS,## MODELSsections), they will need updating — those sections no longer exist in AGENTS.md (they remain in README.md).cnc codegenagainst constructive-db and diff the generatedsdk/constructive-cli/cli/README.mdandAGENTS.md. Confirm: (a) tables without intentional search no longer show*TrgmSimilarityorsearchScorein "Required create fields", (b) tables WITH tsvector/BM25 still get trgm fields, (c) PostGIS/pgvector/search fields appear in dedicated descriptive sections in README where expected, (d) AGENTS.md is now a short ~30-50 line router file.Recommended test plan: Run
cnc codegenagainst constructive-db, then inspect: (1)cli/AGENTS.mdis a thin router pointing toREADME.md, (2)orm/AGENTS.mdsimilarly minimal, (3)cli/README.mdstill has full API docs with special field sections, (4) trgm fields gone from tables without search in both README and schema snapshot.Notes
sdk/constructive-cli/cli/README.mdlisted trgm fields as required create fields.pnpm build). Codegen unit tests have a pre-existing Jest ESM configuration issue (all 18 suites fail to parse TypeScript imports) that is unrelated to these changes.getEditableFieldscall sites in CLI generators now pass theTypeRegistry. ORM generators do not yet thread the registry (backward-compatible — no filtering when registry is absent).Link to Devin session: https://app.devin.ai/sessions/1032ba4c970343ad8b0d8e00a56a6d51
Requested by: @pyramation