Repository navigation
publish: read published deps from the package folder in the post-check - #112
Merged
Merged
Conversation
Contributor
Author
|
@greptile review |
gabe4coding
force-pushed
the
harness/publish-postcheck-deps-path
branch
from
October 26, 2026 08:46
d89e4e9 to
1a2f709
Compare
npm installs a shrinkwrapped package's dependencies in the package's own node_modules. The "Check the published package" step read them from the install prefix, so it failed with ENOENT after the good 3.1.0 publish. Move the check to scripts/check-published.mjs. It resolves each direct dependency as Node does: the package folder first, then the prefix. An integration test covers both layouts, a version drift and a missing dependency, and checks that publish.yml runs the script. Closes #102
gabe4coding
force-pushed
the
harness/publish-postcheck-deps-path
branch
from
October 26, 2026 09:19
1a2f709 to
adae568
Compare
gabe4coding
approved these changes
Oct 26, 2026
Contributor
Author
|
@greptileai review |
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.
Intent
Make the publish post-check pass after a good publish. It reads each direct dependency where npm installs it from the shrinkwrap, then compares the version with the lockfile.
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Install the published version from npm] --> B{"Dependency in the package folder?"} B -- yes --> D[Read its installed version] B -- no --> C{"Dependency in the install folder?"} C -- yes --> D C -- no --> E[Report the dependency as missing] D --> F{"Same version as the lockfile?"} F -- yes --> G[Run the CLI once] F -- no --> H[Fail the step with the drift list]Drift
publish.ymltoscripts/check-published.mjs. Thusnpm testruns its test.missingdrift line with the::error::annotation. Before, it gave a raw ENOENT stack.Decisions
package.jsonandpackage-lock.jsonfrom the working directory, as the inline script did.docs/development.mdxdoes not name a folder and stays true.scripts/and.github/are not in the npm package.Evidence
The harness runs the real "Check the published package" step from
publish.ymlagainst@gabe4coding/plain@3.1.0from npm. It uses Node 22.23.4 and npm 11.21.1, as the CI job does.Before (main
b4aad50). This is the same failure as Publish run 39253045346 on 3fa3e12:After (branch
5008d98):The real install puts the dependencies in the package folder. The install folder holds only the package:
The check still fails on real drift. This run uses the same real install and a lockfile copy that pins
@modelcontextprotocol/sdkto 0.0.1:New test
scripts/check-published.test.mjs, with the inline check of main moved verbatim into the script:The same test on the branch:
Full suite: main has 577 tests, 577 pass. The branch has 582 tests, 582 pass, 0 fail.
node scripts/validate.mjson the branch:The 15 failed e2e specs are the 15
expect-failspecs.actionlint .github/workflows/publish.ymlexits 0 with no findings.The real proof is the next Publish run after a version bump. This PR does not bump the version, so the step does not run on its merge.
Reading map
Config (CI):
.github/workflows/publish.yml, step "Check the published package": the inline script becomes one call to the new script.Error handling:
scripts/check-published.mjs: a dependency in neither folder becomes amissingdrift line, not a thrown ENOENT.Public API: none. Tests changed or deleted: none, one test file added.
Closes #102