Skip to content

Add zero-patch CNC scoped introspection package - #1719

Draft
Zetazzz wants to merge 1 commit into
test/performance-harness-corefrom
feat/cnc-scoped-introspection
Draft

Add zero-patch CNC scoped introspection package#1719
Zetazzz wants to merge 1 commit into
test/performance-harness-corefrom
feat/cnc-scoped-introspection

Conversation

@Zetazzz

@Zetazzz Zetazzz commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add the independently publishable graphile-scoped-introspection package under graphile/.
  • Move the CNC Graphile plugin, preset, scoped SQL generator, PgService type augmentation, namespace/type closure validation, and gather/cache/watch tests into that package.
  • Keep graphile-settings responsible only for makePgService normalization, convenience re-exports, and explicit ConstructivePreset wiring.
  • Update the performance worker to import ScopedIntrospectionPreset directly from its owner package while continuing to use the narrow graphile-settings service factory.

Architecture

This implementation uses no pnpm patches and does not modify installed Graphile, Dataplan, or pg-introspection packages. The scoped SQL is CNC-owned, static, and parameterized; it is adapted from the MIT-licensed pg-introspection@1.0.1 query structure and the prior CNC implementation. It does not import private package subpaths or rewrite upstream SQL at runtime.

Stock-only configurations delegate to the upstream PgIntrospectionPlugin helper. Scoped configurations use the CNC query, and mixed stock/scoped services select independently. The replacement preset atomically disables the upstream plugin without mutating its singleton. A pinned graphile-build-pg@5.1.3 contract sentinel fails deterministically on version or gather-shape drift.

Client lifecycle

Introspection uses the normal three-argument withPgClientFromPgService(service, settings, callback) API. Each checkout returns to the upstream pool after the query; there is no destroy mode or custom release protocol. Final pool teardown remains the responsibility of PgService.release(), which the performance worker retains in finally for success and failure paths.

Validation

  • graphile-scoped-introspection: 6 suites / 18 tests passed.
  • graphile-settings: 6 non-database suites / 48 tests passed; real PostgreSQL ConstructivePreset build and runtime query passed.
  • @constructive-io/perf-harness: 6 suites / 8 tests passed.
  • CJS and ESM builds passed for all three affected packages.
  • Affected ESLint, Prettier check, and git diff --check passed.
  • pnpm install --frozen-lockfile and pnpm install --frozen-lockfile --offline passed.
  • PostgreSQL 18.4 fresh-process smoke passed with distinct PIDs (16685, 16687), matching schema hash 6f78c926837733edca7c1706b1fde33bc260defb54d89000f6327cbeb2b1e1f3, runtime validation in both cases, and no database URL in the report.
  • A scoped failure worker exited after the required-schema error, exercising its finally teardown path.
  • The final diff against test/performance-harness-core contains no patch files, no patchedDependencies, and no .gitattributes patch rule.

Follow-up

When Graphile progressive introspection is available, CNC can replace this concentrated package boundary with the upstream implementation while leaving graphile-settings and the performance harness wiring narrow.

@Zetazzz
Zetazzz force-pushed the feat/cnc-scoped-introspection branch from d42cd85 to 8a83d70 Compare August 14, 2026 13:09
@Zetazzz Zetazzz changed the title Add CNC-owned scoped PostgreSQL introspection Add zero-patch CNC scoped introspection package Aug 14, 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