Skip to content

feat(naming-spec): @pgpmjs/naming-spec — PGPM naming spec v1 (derived change paths) - #1547

Merged
pyramation merged 2 commits into
mainfrom
feat/pgpm-naming-spec
Jul 31, 2026
Merged

feat(naming-spec): @pgpmjs/naming-spec — PGPM naming spec v1 (derived change paths)#1547
pyramation merged 2 commits into
mainfrom
feat/pgpm-naming-spec

Conversation

@pyramation

@pyramation pyramation commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

New zero-dependency leaf package @pgpmjs/naming-spec: the PGPM naming spec as a pure projection. A change path is never authored and never identity — it is rendered on demand from an object's identity, so regrouping, renaming schemes, or repartitioning packages can never break identity-keyed consumers (diff, dependency resolution).

The reference implementation is constructive-db's db_deps SQL package (db_deps.table_deps, column_deps, procedure_deps, next_alteration, ...); this is the TypeScript rendering of the same spec, byte-for-byte compatible with the generated application/constructive plan.

  • pathFor(identity, { style }) — total, deterministic:
    directory style (db_deps / generated plans, default):
      schemas/{s}/schema
      schemas/{s}/tables/{t}/table
      schemas/{s}/tables/{t}/columns/{n}/column
      schemas/{s}/tables/{t}/{constraints|policies}/{n}/{constraint|policy}
      schemas/{s}/tables/{t}/{triggers|indexes|fixtures}/{n}
      schemas/{s}/procedures/{n}/procedure     schemas/{s}/views/{n}/view
      extensions/{n}   roles/{n}
    flat style (hand-authored packages): drops the trailing kind token
    
  • alterationPathFor(parent, n) — the conflict/re-alteration convention: <parent>/alterations/alt0000000042, mirroring db_deps.next_alteration (strips any existing suffix so a parent can be renumbered; the counter is caller state, rendering is pure).
  • PGPM_NAMING_SPEC_VERSION = 1; ObjectIdentity declared structurally (identical to identityOf's output in pgsql-parser#326) — parsing stays in the parser repo, pgpm conventions stay here.

Verified no duplicate change names exist in any constructive-db pgpm.plan (the alt counter is what keeps it that way). Phase 1 of constructive-planning#1329; follow-ups: defaultChangeName delegates to identityOf+pathFor, and db-deps gains parity tests against this package.

Note: pnpm run lint fails identically in existing pgpm packages (ESLint 9 flat-config migration pending repo-wide) — not introduced here; tests and build pass.

Link to Devin session: https://app.devin.ai/sessions/562099f8b3d94877b5ab57ec8bb90bec
Requested by: @pyramation

@pyramation pyramation self-assigned this Jul 31, 2026
@devin-ai-integration

Copy link
Copy Markdown
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, CI, and merge conflict monitoring

@pyramation
pyramation merged commit d21cdda into main Jul 31, 2026
16 checks passed
@pyramation
pyramation deleted the feat/pgpm-naming-spec branch July 31, 2026 05:51
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