Repository navigation
Record exact runtime and extension pins for generated applications (#212) - #221
Merged
Merged
Conversation
jimhoyd
force-pushed
the
claude/pin-generated-dependencies-212
branch
2 times, most recently
from
September 20, 2026 03:59
b2f1865 to
fa27ff8
Compare
`urlcode init --with` resolved whatever extension packages happened to be installed and wrote nothing about which versions those were, so a generated site's reproducibility depended entirely on a manifest it did not have (#212). The auth initializer wrote a package.json with no dependencies at all. `init --with` now resolves core, every named extension and every package those extensions declare in peerDependencies, validates the whole set against every declared peer range, and writes a private package.json pinning each one at the version actually resolved. An incompatible set or a missing required peer refuses before the destination directory exists. `urlcode-auth init` pins this package and its peers the same way. Route-only `urlcode init` is unchanged and still writes no manifest; `--manifest` opts a route-only project into pinning the runtime, and `--no-manifest` opts a --with site out. `--pin <package>=<specifier>` records a local tarball or checkout, and a package npm installed from a local path is detected from npm's own install record and pinned by that path without a flag. No package manager is ever run: producing package-lock.json remains an explicit `npm install` the operator runs after reviewing the manifest, which the command output, the generated README and the docs all say. There is no upgrade command, and the docs say that plainly. Range satisfaction is a small local implementation (comparators, ^ and ~ over a complete x.y.z, || alternatives, npm's prerelease rule) because semver is a devDependency here and core takes no new runtime dependency; unsupported range syntax refuses rather than guessing. No extension implementation is imported: only package manifests are read, by name. Verified: npm run lint, npm run typecheck, npm run check and npm test (530 tests) pass, as do npm run test:workspace-integration against the real built auth/admin/ui packages and the auth package's scaffold suites and typecheck. Not verified: no actual `npm install` of a generated manifest was run (that needs a registry or a published tarball), and the auth package's full test suite was not run. Co-Authored-By: Claude Opus 5 <[email protected]>
CodeQL is a required check and it caught two real defects this branch introduced. js/polynomial-redos, src/project-dependencies.ts: `manifestName` trimmed with /^[._-]+|[-._]+$/, whose anchored trailing quantifier is retried from every start position -- quadratic on a directory name of many dashes, and the input is a path the caller supplies. Trimmed with indices instead. Verified behaviour-identical on ten cases spanning the previous regex's branches, and 60k dashes now trims in about a millisecond. js/incomplete-sanitization, test/project-dependencies.test.ts: the expected message was built into a RegExp escaping only dots. A version can carry prerelease and build punctuation, so it now escapes every metacharacter. Co-Authored-By: Claude Opus 5 <[email protected]>
#219 landed while this branch was open: `init --with` now names ui explicitly and composes the kit into the auth scaffold, and `--with auth,admin` refuses rather than emitting a project that throws at activation. Resolved in favour of both changes. The auth scaffold keeps main's ui composition and gains this branch's pin resolution ahead of mkdir; `@jimhoyd/urlcode-ui` is a declared peer of auth, so the kit the scaffold now emits is pinned by the same pass that pins auth itself. The integration test's role expectation was written when nobody named ui and it arrived only as a peer. The invocation now names it, so its role is genuinely `extension`; the expectation and its comment are corrected rather than the assertion weakened. No real composition reaches the peer role any more, so the comment points at test/project-dependencies.test.ts, which covers it against synthetic packages -- the first wording claimed `--with auth,admin` covered it, which is wrong now that the case refuses. Co-Authored-By: Claude Opus 5 <[email protected]>
jimhoyd
force-pushed
the
claude/pin-generated-dependencies-212
branch
from
September 20, 2026 04:11
fa27ff8 to
b148e52
Compare
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.
Closes #212.
What changed
New
src/project-dependencies.ts. Resolves the running runtime, every extension named in--with, and every package those extensions declare inpeerDependencies(so@jimhoyd/urlcode-uiis pinned for anauth,adminsite although nobody named it). It validates the whole set against every declared peer range and renders a privatepackage.jsonwith exact pins. Only package manifests are read, by name, through a plainnode_moduleswalk — no extension implementation is imported and nothing in a resolved package is loaded or executed.urlcode init --withnow writes that manifest by default, after refusing an incompatible set or a missing required peer before the destination directory exists. The site README gains a## Dependenciessection, and the install step is the first numbered next step.urlcode initis unchanged: route-only initialization still writes no manifest.--manifestopts a route-only project into pinning the runtime;--no-manifestopts a--withsite out.--pin <package>=<specifier>records an operator-chosen specifier (local tarball, checkout, mirror). A package npm installed from a local path or tarball is also detected from npm's own install record (node_modules/.package-lock.json) and pinned by that absolute path with no flag, with the README stating that such a pin only reproduces where the path exists.urlcode-auth init(packages/auth/src/scaffold.ts) previously wrote{name, private, type}with no dependencies; it now pins itself exactly and each declared peer at the version installed beside it, returns those pins, and names any peer it could not resolve. Changeset included.Docs:
docs/EXTENSIONS.md(new "Recorded versions"),docs/VERSION-ALIGNMENT.md(new "Generated applications"),docs/STARTERS.md, regeneratedllms-full.txt.Range satisfaction is implemented locally (comparators,
^/~over a completex.y.z,||, and npm's prerelease rule so0.5.0-alpha.1does not slip past<0.5.0) becausesemveris a devDependency here and core takes no new runtime dependency. Unsupported range syntax refuses rather than guessing.Verified
npm run lint,npm run typecheck,npm run check,npm test— 530 tests, 0 failures (1 pre-existing skip).npm run test:workspace-integrationagainst the real built auth/admin/ui packages: the generated manifest pins core, auth, admin and ui at the workspace versions, and nonode_modules/package-lock.jsonappears in the generated site.packages/authtypecheck and itsscaffold/scaffold-contractsuites.test/project-dependencies.test.tscovers prerelease range rules, the set validation refusals,--pin, hidden-lockfile local specifiers, and every init flag combination.Deliberately not done
npm installin the generated directory, printed by the command and the README. Core does not spawn a package manager — that would download and run code from aurlcode init, which this runtime's trust model keeps out of generation. If an opt-in--installflag that shells out to npm is wanted, that is a separate, reviewable change.docs/VERSION-ALIGNMENT.mdand the generated README both say plainly that it does not exist and that changing a pin means editing the manifest and re-installing.🤖 Generated with Claude Code