build(sdk): route npm test through scripts/test.sh (split from #165) - #170
Conversation
|
Warning Review limit reachedNext included review available in 51 minutes. View limit detailsLimit details: You’ve used the included review currently available. Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: 📒 Files selected for processing (3)
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing. Comment |
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FtQSAcGDta5VH9xiZFT4sR Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1
Split out of #165, which bundled this with a wholesale revert of the CI workflow. The workflow half restored `ops/cargo.sh` for the kernel test step (that wrapper redirects RUSTUP_HOME to an empty dir on a runner, so rustup cannot choose a toolchain) and dropped the analyzer-skip env, i.e. it reverted #153, #154 and #159 together. Only the sdk tooling is carried here; `.github/` is byte-identical to main. scripts/test.sh runs the same chain the inline `test` script did, in the same order, with `set -eu` for the fail-fast the `&&` chain gave. The new behaviour is the EXIT trap, which prunes `.map` and `.d.ts` from sdk/dist afterward. CI is unaffected either way: the workflow runs the expanded chain minus test:prep, not `npm test`. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FtQSAcGDta5VH9xiZFT4sR Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1 Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1
a2b5ce0 to
2323b47
Compare
Resolves the open question I raised on this PR rather than merging past it. `package.json` declares `"types": "./dist/index.d.ts"`, and the script deleted every `.d.ts` under `dist` -- so `npm test` left the package's declared type entry pointing at a file it had just removed. Nothing breaks today: every current in-repo consumer imports `.js` -- `ops/probes/**`, `workflows/drive.yaml:394`, `workflows/drive-cloud.yaml:247` and `testdata/backlog-picker.flow.yaml:18` all load `sdk/dist/*.js` -- and `surface` does not depend on the sdk. But the next TypeScript consumer would meet a failure whose cause is "someone ran the tests", and the space this buys is not worth that. The file count that actually drives the sandbox problem is `kernel/target/debug` at ~4900 files, per ops/cargo.sh's own measurements; `dist` declarations are noise beside it. Source maps are still pruned, which is the part with no such cost. An earlier revision of this message claimed `ops/probes/**` were the only consumers. The history lens showed that was false; the conclusion was unaffected, since all of them import `.js`, but the claim was not. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FtQSAcGDta5VH9xiZFT4sR Session-Id: c228933d-4f94-4d83-9a9a-daf3c83b94f1
2323b47 to
3e7ee75
Compare
The sdk half of #165, without its CI revert. Do not merge yet — one open question below.
What this is
#165 bundled two unrelated changes. Its
.github/workflows/cloud-runtime-artifact.ymlhunk reverted #153, #154 and #159 together: it restoredops/cargo.shfor the kernel test step, and dropped the analyzer-skip env. That wrapper redirectsRUSTUP_HOMEto$HOME/.relayflows-toolchain/rustup, which on a GitHub runner is empty, so the rustup shim has nothing to choose and the step dies withrustup could not choose a version of cargo to run. The wrapper exists for a cloud sandbox, which a runner is not.This branch carries only the sdk tooling.
.github/is byte-identical to main:sdk/package.jsondiffers from main by exactly one line (thetestscript), so nothing else on that file is reverted despite #165 being based on an older main.scripts/test.shruns the same chain the inline script did, in the same order, withset -eusupplying the fail-fast the&&chain gave. CI is unaffected either way — the workflow runs the expanded chain minustest:prep, notnpm test.Open question before merge
prune-test-build.mjsdeletes every.mapand.d.tsundersdk/dist, recursively.sdk/package.jsondeclares:So running
npm testleaves the package's declared type entry pointing at a file that was just deleted. Nothing in the repo breaks today — the only in-repo consumers (ops/probes/**) import.jsfromdist, andsurfacedoes not depend on the sdk at all — so this is latent, not live. But the next TypeScript consumer of@relayflows/sdkgets a confusing failure whose cause is "someone ran the tests".I did not change the script, because that would alter the contributed change rather than split it. Three ways forward, your call:
.mapand leave.d.tsalone — smallest change, keeps the declared types intact.typesentry frompackage.json, ifdisttypes are not meant to be consumed.I would take (1): the stated motivation for pruning is propagated-tree file count in a cloud sandbox, and
ops/cargo.sh's own measurements put that squarely onkernel/target/debug(4900 files) rather than onsdk/dist, so deleting the type surface buys very little.Supersedes the sdk half of #165. #165 itself should be closed once this lands — its remaining content is the CI revert, which we do not want.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FtQSAcGDta5VH9xiZFT4sR