Skip to content

Own build-state retirement policy in CNC - #1712

Closed
Zetazzz wants to merge 1 commit into
feat/temporary-scoped-introspectionfrom
feat/build-state-retirement
Closed

Own build-state retirement policy in CNC#1712
Zetazzz wants to merge 1 commit into
feat/temporary-scoped-introspectionfrom
feat/build-state-retirement

Conversation

@Zetazzz

@Zetazzz Zetazzz commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Architecture

This PR keeps the opt-in policy in CNC and the inaccessible Graphile internals in pnpm patches.

CNC normal source

  • Adds the independently importable BuildStateRetirementPlugin in graphile-settings.
  • The plugin registers build.registerAfterSchemaValidation(...) and is the only component that decides whether and when retirement runs.
  • ConstructivePreset explicitly installs the plugin.
  • Graphile defaultPreset remains unchanged.

CNC pnpm patches

  • Mirrors Crystal PR Server #1 neutral after-schema-validation lifecycle in graphile-build dist.
  • Keeps the retirement state machine, core and Behavior cleanup, owner disposer registration/execution, released-state guards, and aggregate disposal errors inside the patch.
  • Uses a private symbol capability to let the CNC plugin trigger retirement without exporting a Graphile retirement plugin.
  • Keeps PgBasics, PgCodecs, and PgPolymorphism owner cleanup in graphile-build-pg.
  • Does not modify pg-many-to-many.

CNC owners

  • graphile-search clears its build codec cache.
  • graphile-connection-filter clears its operator registry.
  • graphile-meta snapshots runtime metadata from the finalized schema.

Contracts

  • no CNC plugin: retained state and original behavior
  • validation failure: no retirement
  • installed plugin: retirement only after successful validation
  • disposers: deterministic reverse order; all attempted; failures aggregated
  • retirement: fail-closed with GRAPHILE_BUILD_STATE_RELEASED
  • executable schemas remain independent of retired build state

Validation

  • retirement contract tests: 5 passed
  • graphile-search owner test: passed
  • connection-filter owner test: passed
  • graphile-meta tests: 131 passed, 3 snapshots
  • real PostgreSQL ConstructivePreset integration: 38 passed
  • graphile-settings/search/connection-filter/meta builds: passed
  • ESLint on affected sources: no errors (one pre-existing graphile-search unused-variable warning)
  • frozen-lockfile install: passed
  • git diff --check: passed

@Zetazzz
Zetazzz force-pushed the feat/build-state-retirement branch from 02b6d56 to da25a44 Compare August 13, 2026 14:30
@Zetazzz Zetazzz changed the title Retire Graphile build state after schema validation Own build-state retirement policy in CNC Aug 13, 2026

Zetazzz commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #1722 on the replacement stack (#1716#1719#1722). Build-state retirement architecture and any further boundary changes will continue in #1722. This PR remains available as historical design context.

@Zetazzz Zetazzz closed this Aug 16, 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