refactor: one component name, each namespace adding only the prefix it needs - #8
Merged
Conversation
…t needs
auth-auth-provider was a symptom. The cause is that a single string was doing
three jobs at once — directory, npm package, container image — so a prefix
correct for one namespace was wrong in another. Naming the image explicitly
(the previous commit) hid that; this fixes it.
The rule is that a name carries exactly the disambiguation its namespace does
not already provide:
component provider | policy-verifier
directory packages/create-${c} inside the auth repo — "auth" is
already given by where the file is
npm create-auth-${c} scope is provin-line, not auth
image auth-${c} org is provin-line, not auth
So the publish matrix carries the component again and every identifier derives
from it, rather than the image being spelled out per entry.
Directories lose the prefix their location already implies:
create-auth-provider → create-provider, auth-provider-did → provider-did,
auth-provider-dplaax-module → provider-dplaax-module. npm names gain it where
it was missing: create-policy-verifier → create-auth-policy-verifier,
policy-verifier-dplaax-module → auth-policy-verifier-dplaax-module. That
deliberately breaks the directory↔package-name mirror; pnpm resolves by the
name in package.json, and the alternative was keeping a prefix that says
"auth" to a reader who is already inside the auth repository.
Every one of the six packages is unpublished on npm, which is the only reason
this is a refactor and not a breaking change.
The same conflation was live in both generators, and there it was not
cosmetic:
const TRANSITIVE_PROVIN_PACKAGE_DIRS = ["auth-provider-did", ...]
`@provin-line/${dir}` // used as an npm name
`path:/packages/${dir}` // and as a directory
One list, two meanings. After the rename it would have emitted a git spec
pointing at packages/auth-provider-did, a path that no longer exists — so a
generated scaffold would have failed to install rather than merely read
oddly. Now { name, dir } pairs, with a comment saying why they are separate.
The generator test caught it; that is the test earning its place.
Also corrected while in here: the verifier's `bin` and its usage line still
said create-policy-verifier, and two assertions escaped the slash in
@provin-line\/create-policy-verifier so a literal search could not see them.
One generator test's expected array had to be reordered — the rename moved
auth-policy-verifier-dplaax-module ahead of did-dplaax in a sorted list,
which is the assertion doing its job.
The lockfile diff is nine lines and touches no resolution or integrity field.
That took two attempts: `pnpm install --lockfile-only` re-resolved dependencies
that had nothing to do with renaming anything (picomatch and tinyglobby swapped
out, among others), and `make instances` then wrote the generated instances'
own dependencies into the ROOT lockfile, because pnpm counts them as workspace
projects. Both were reverted; the committed lockfile is the base one with the
importer keys and link targets substituted, validated by --frozen-lockfile so
nothing was re-resolved to make it pass.
Verified: frozen-lockfile install, build, typecheck, every package test (484
passing plus integration), make instances, make smoke, and the CI assertion
that a fresh generation is byte-identical to instances/ — including that the
generated overrides key on @provin-line/auth-provider-did while pointing at
/packages/provider-did.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Merged
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.
auth-auth-providerwas a symptom. The cause is that one string was doing three jobs — directory, npm package, container image — so a prefix that is correct in one namespace is wrong in another. Naming the image explicitly (#7) hid that. This fixes it.The rule
A name carries exactly the disambiguation its namespace does not already provide:
So the publish matrix carries the component again and every identifier derives from it.
What moves
packages/create-auth-providerpackages/create-providerpackages/auth-provider-didpackages/provider-didpackages/auth-provider-dplaax-modulepackages/provider-dplaax-module@provin-line/create-policy-verifier@provin-line/create-auth-policy-verifier@provin-line/policy-verifier-dplaax-module@provin-line/auth-policy-verifier-dplaax-moduleThis deliberately breaks the directory↔package-name mirror. pnpm resolves by the
nameinpackage.json, and the alternative was keeping a prefix that says "auth" to a reader who is already inside the auth repository.All six packages are unpublished on npm, which is the only reason this is a refactor and not a breaking change.
The same conflation was live in the generators — and there it broke things
One list, two meanings. After the rename it would have emitted a git spec pointing at
packages/auth-provider-did— a path that no longer exists, so a generated scaffold would have failed to install rather than merely read oddly.Now
{ name, dir }pairs, with a comment saying why they are separate. The generator test caught this; that is the test earning its place.Also corrected while in here
binand itsUsage:line still saidcreate-policy-verifier@provin-line\/create-policy-verifier— so a literal search could not see themauth-policy-verifier-dplaax-moduleahead ofdid-dplaaxin a sorted listThe lockfile is nine lines, and that took two attempts
resolution/integritychanges: zero.Getting there meant reverting two accidents:
pnpm install --lockfile-onlyre-resolved dependencies unrelated to any rename (picomatchandtinyglobbyswapped out, among others) — 488 linesmake instancesthen wrote the generated instances' own dependencies into the root lockfile, because pnpm counts them as workspace projects — 413 linesThe committed lockfile is the base one with importer keys and
link:targets substituted, validated with--frozen-lockfileso nothing was re-resolved to make it pass.Verification
Plus the CI assertion reproduced locally — a fresh generation is byte-identical to
instances/— and confirmation that the generated overrides key on@provin-line/auth-provider-didwhile pointing at/packages/provider-did.Not yet verified
The published images are currently the ones #7's per-entry
image:produced. The derived form should yield the same names, butpublish-imageshas not been dispatched against this change, so that is unproven until it runs.🤖 Generated with Claude Code