Skip to content

build: make the published package installable and runnable - #887

Merged
swapnilpaliwal-sd merged 1 commit into
mainfrom
fix/886-package-installable
Sep 18, 2026
Merged

swapnilpaliwal-sd merged 1 commit into
mainfrom
fix/886-package-installable

Conversation

@swapnilpaliwal-sd

Copy link
Copy Markdown
Contributor

Fixes #886.

npm install of the packed tarball produced an install that could not run. Four causes, each fatal on its own, none visible from a source checkout, where the parser is built, the CLI is invoked by path and the dependencies are present because a workspace install put them there.

Changes

  • files listed explicitly. Without it npm falls back to the ignore rules and honours a workspace's own .gitignore: parser/.gitignore ignores dist/, so the built parser was dropped from the tarball while parser/src/test-data shipped. Listing what ships inverts the default, so a new build output is included unless excluded rather than silently lost.
  • bin added, so axiomcode is on PATH after install.
  • bin/axiomcode resolves $0 through symlinks before the root walk. npm installs a bin entry as a link in node_modules/.bin, so the walk started in .bin/, climbed the user's project, found a package.json with no graph/ beside it and returned /. The run then failed with parser not built at //parser/dist/index.js and advised a build an installed copy cannot run. It now also fails with a clear message when the marker is never found.
  • dependencies hoisted from the parser workspace. The parser ships here as parser/dist but is never published, so nothing installed what it requires; first use died on Cannot find module 'typescript'.

Size

files also stops the corpora shipping: 81 MB to 3.1 MB packed, 428 MB to 13.6 MB unpacked. All engine rules still ship.

Test

graph/test/tools/package-contents-test.sh reads the pack manifest, so it costs a second and needs no network. It asserts the manifest fields, that the rules and CLI ship, that the corpora do not, and that built outputs are not excluded. Against the manifest before this change it fails on all four defects, including does NOT ship parser/dist/ and the 3326 corpus files. Wired into the java preflight.

Build outputs are asserted only when present on disk, so an unbuilt checkout skips rather than fails, and the skip is printed rather than silent.

Verification

A clean cloud VM with no souffle, gcc, make or cmake, asserted absent before and after the node install. Installing only the two tarballs and running against four public OSS projects, one per language:

language time tables
java 11s 40
typescript 7s 63
python 25s 103
javascript 7s 52

Every run reports using packaged engine, so the engine came from the package and nothing was compiled. The native parser dependencies installed from prebuilt binaries with zero node-gyp invocations, so the no-compiler promise holds for the parser as well as the engine.

Compatibility

Nothing here changes how a source checkout behaves. The root walk is unchanged when $0 is not a symlink, which is every existing invocation (bin/axiomcode, npm run, the suites). files, bin and dependencies affect the tarball only. The hoisted dependencies duplicate parser/package.json, which the new test asserts stays in step.

Independent of #478 and lands separately: #478 makes the engine installable, and these four defects sit in front of it. With them in place the engine is resolved correctly and the run still fails, because the parser half of the package is not installable. Both are needed before a release.

`npm install` of the packed tarball produced an install that could not run.
Four causes, each fatal on its own, none visible from a source checkout.

- files: absent, so npm fell back to the ignore rules and honoured a
  workspace's own .gitignore. parser/.gitignore ignores dist/, so the built
  parser was dropped while parser/src/test-data shipped. Installed clean,
  failed on first use for every language.
- bin: absent, so nothing put axiomcode on PATH.
- bin/axiomcode: the root walk started at dirname "$0", which under a
  node_modules/.bin symlink is .bin/. It climbed the user's project, found a
  package.json with no graph/ beside it and returned "/", reporting
  `parser not built at //parser/dist/index.js` and advising a build that an
  installed copy cannot run. Resolve the link first, and fail clearly when the
  marker is never found.
- dependencies: absent. The parser ships here as parser/dist but is a
  workspace and is never published, so nothing installed what it requires and
  first use died on `Cannot find module 'typescript'`.

Adding files also stops the corpora shipping: 81 MB to 3.1 MB packed,
428 MB to 13.6 MB unpacked. All engine rules still ship.

graph/test/tools/package-contents-test.sh reads the pack manifest and asserts
the fields and the contents; it fails on each of the four defects above. Wired
into the java preflight.

Verified on a clean VM with no souffle, gcc, make or cmake, asserted absent
before and after the node install: installing only the tarballs and running
four public OSS projects, one per language, all four complete and write
graph.sqlite (java 11s, typescript 7s, python 25s, javascript 7s). The native
parser dependencies installed from prebuilt binaries with no node-gyp runs.

Fixes #886
@swapnilpaliwal-sd
swapnilpaliwal-sd force-pushed the fix/886-package-installable branch from 39c4169 to 865be69 Compare September 18, 2026 05:31
@swapnilpaliwal-sd
swapnilpaliwal-sd merged commit 301892e into main Sep 18, 2026
@swapnilpaliwal-sd
swapnilpaliwal-sd deleted the fix/886-package-installable branch September 18, 2026 05:31
swapnilpaliwal-sd added a commit that referenced this pull request Sep 18, 2026
…478) (#903)

Reverts f6ba1c2. The engine binaries work is not ready to ship, so it goes back
to a pull request and #454 reopens with it.

Not a plain revert, because two changes landed on top of it and both have to keep
working:

- #897 pinned the collation inside write_program, which #478 introduced. Reverting
  removes that function and would take the guard with it, and the restored executor
  has the same defect: its #include lines come from unguarded globs, so the cache
  key follows the user's locale. The guard is re-applied to the restored program
  generation, and engine-id-locale-test.sh now accepts either shape of the
  executor so it keeps measuring rather than failing for the wrong reason. Its
  --emit-program checks skip here, since that flag belongs to #478, and they report
  the skip rather than passing silently.

- #887 added bin, files and dependencies, which are independent of the engine work
  and stay. optionalDependencies goes with the feature: nothing resolves a packaged
  engine any more, so those entries would name packages the executor never looks for.

What comes back: the executor compiles with a local souffle and caches the binary,
exactly as before #478. engine.conf, packaging/ and the two engine tests go with it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant