Skip to content

fix(graphile): isolate plugin caches by owner - #1751

Draft
Zetazzz wants to merge 1 commit into
test/performance-harness-corefrom
agent/graphile-build-cache-ownership
Draft

fix(graphile): isolate plugin caches by owner#1751
Zetazzz wants to merge 1 commit into
test/performance-harness-corefrom
agent/graphile-build-cache-ownership

Conversation

@Zetazzz

@Zetazzz Zetazzz commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements F08 from constructive-io/constructive-planning#1693 on top of the shared performance harness in #1716.

  • owns graphile-i18n discovery and locale GraphQL type caches by exact Graphile build
  • owns graphile-llm billing configuration caches by exact build and agent discovery caches by physical PostgreSQL pool
  • owns unified-search adapter discovery by exact build and codec identity
  • replaces the process-global BM25 discovery store with per-gather state bound to the exact codec attribute
  • removes the obsolete public BM25 module-global store/status exports
  • adds focused same-name, same-database, reused-codec, rebuilt-index, and cross-pool isolation tests

These changes prevent a long-lived plugin or preset instance from serving mutable discovery state produced by another build, tenant, or physical pool. Weak owner keys also allow cache state to be collected with its owner.

Contract changes

  • getLlmBillingConfig now requires an explicit cache owner; the metering plugin supplies its exact Graphile build.
  • getLlmBillingCacheStats reports one explicit owner's cache.
  • bm25IndexStore and bm25ExtensionDetected are no longer exported. Callers that intentionally supply an external BM25 store may continue to use the existing createBm25Adapter({ bm25IndexStore }) option.

Boundary

This PR is intentionally limited to F08 cache ownership:

  • no raw-SQL qualification changes (F07)
  • no request-context or pgSettings changes (F13)
  • no storage snapshot or presigned-URL cache changes (F14)
  • no build-state retirement or dependency patches
  • no default preset changes
  • no unrelated formatting-only changes

F08's retained-memory effect depends on which plugins are enabled, so this PR makes no isolated performance claim and does not add a benchmark arm before a representative multi-build fixture exists.

Validation

Passed:

  • graphile-i18n: 2 suites / 6 tests, including real PostgreSQL integration
  • graphile-llm without explicitly real-Ollama cases: 4 suites / 57 tests; 11 real-Ollama tests skipped
  • graphile-search: 6 suites / 78 tests, including real PostgreSQL integration
  • graphile-settings: 6 suites / 61 tests outside the existing preset-integration fixture failure
  • CJS and ESM builds for graphile-i18n, graphile-llm, graphile-search, and graphile-settings
  • shared performance harness: 5 suites / 7 tests; CJS and ESM build
  • frozen-lockfile install
  • ESLint on every changed TypeScript file (no errors; one existing scoreMetaKey warning in graphile-search)
  • Prettier check on all new files
  • git diff --check
  • ignore-whitespace audit confirming every modified file has semantic changes

Known environment/baseline limitations:

  • A local Ollama service was not available, so the 11 test names explicitly requiring real Ollama were excluded; all other graphile-llm tests passed.
  • graphile-settings preset integration still fails with permission denied for schema integration_test, the same repository fixture limitation documented in fix(graphile): qualify built-in plugin SQL #1748; its other six suites pass and the package builds successfully.

Refs constructive-io/constructive-planning#1693.

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