fix(examples): install the antelope build the library resolves - #10
Conversation
There was a problem hiding this comment.
Pull request overview
Attempts to make example specs compile by unifying Antelope type resolution.
Changes:
- Adds a TypeScript path alias for
@wharfkit/antelope.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| "moduleResolution": "node", | ||
| "baseUrl": ".", | ||
| "paths": { | ||
| "@wharfkit/antelope": ["node_modules/@wharfkit/antelope"] |
There was a problem hiding this comment.
Correct on both points, and the version claim checks out: the root tree resolves @wharfkit/antelope 1.1.1 while the examples tree resolved 1.2.0, so the paths alias would have told the compiler the two builds were one while the runtime still crossed them.
Replaced the alias with the actual alignment: the examples now declare the version the library resolves. On a clean examples/node_modules all three trees report 1.1.1, and tsc goes to zero errors with no paths entry at all.
4a730aa to
552fd02
Compare
| "license": "MIT", | ||
| "devDependencies": { | ||
| "@atomichub/vert": "file:..", | ||
| "@wharfkit/antelope": "1.1.1", |
There was a problem hiding this comment.
Right, and unenforced it was worth little. CI now installs the demo and runs a typecheck script on it, straight after the root build so ../../dist exists.
Proven to fail, not just to pass: pushing the examples pin to 1.2.0 while the root stays on 1.1.1 brings back exactly the twelve diagnostics and exits non-zero, and restoring the pin returns zero. The step costs about four seconds, two for the install and two for the compile.
552fd02 to
bf87ca5
Compare
The demo specs fail before any test runs. ts-node type-checks by default, so twelve diagnostics throw a TSError while the first spec loads, which leaves the examples unrunnable even where blanc++ is present and the wasm fixtures are built; the absent fixtures hid an earlier blocker. Those diagnostics report a real defect rather than a compiler artifact. A spec imports Blockchain from ../../dist, which loads @wharfkit/antelope out of the root tree, and imports Name from @wharfkit/antelope, which resolves to the examples tree. Both sides declare the same caret range, but the two lockfiles resolved it years apart, so the root tree holds 1.1.1 while the examples tree held 1.2.0. Values built by two different releases of the same class crossed the API on every call, and the private field each release declares is what the compiler refused. Declaring the version the library itself resolves gives both sides one build and clears all twelve. Nothing enforced that alignment, so CI installs the demo and type-checks it from here on. A later move in the root lockfile would otherwise split the two builds apart again with every check still green, and the diagnostics would come back only for whoever ran the demo. The first spec now fails on its absent wasm fixture, which is the real blocker outside a blanc++ toolchain and the one this repository cannot remove.
bf87ca5 to
9889543
Compare
Why
The demo specs never reach a test.
ts-node/registertype-checks by default, so twelve diagnostics throw aTSErrorwhile the first spec loads. The examples are unrunnable even for someone who hasblanc++and has built the wasm fixtures, and those absent fixtures were hiding the earlier blocker.The diagnostics were reporting a real defect, not a compiler artifact. A spec imports
Blockchainfrom../../dist, which loads@wharfkit/antelopeout of the root tree, and importsNamefrom@wharfkit/antelope, which resolves to the examples tree. Both sides declare the same caret range, but the two lockfiles resolved it years apart: the root tree holds 1.1.1 while the examples tree held 1.2.0. Values built by two different releases of the same class crossed the API on every call, and the private field each release declares is what the compiler refused.Declaring the version the library itself resolves gives both sides one build. CI then installs the demo and type-checks it, so a later move in the root lockfile cannot split the two apart again while every check stays green.
Thanks for both review points. The first was right that a
pathsalias would have told the compiler two builds were one while the runtime still crossed them, and the second was right that the alignment was worth nothing unenforced.Validation
Verified on a clean
examples/node_modules: all three trees report@wharfkit/antelope1.1.1, the root one, the examples one, and the copy the file dependency makes.tsc --noEmitoverexamplesgoes from twelve errors to zero, with no compiler-side aliasing involved. Runningmocha ./foo/foo.spec.ts -r ts-node/registernow fails on the absentfoo/foo.wasminstead of on aTSError, which is the real blocker outside a blanc++ toolchain and the one this repository cannot remove.The new gate was proven to fail rather than merely to pass. Pushing the examples pin to 1.2.0 while the root stays on 1.1.1 returns exactly the twelve diagnostics and exits non-zero; restoring the pin returns zero. It costs about four seconds, two for the install and two for the compile.
Root gates:
yarn run testpasses, 35 unit tests plus the frozen examples install.