Skip to content

docs: fix contributor setup instructions - #285

Merged
marc0olo merged 1 commit into
chore/security-updates-drop-bun-lockfrom
docs/contributor-setup
Sep 22, 2026
Merged

marc0olo merged 1 commit into
chore/security-updates-drop-bun-lockfrom
docs/contributor-setup

Conversation

@marc0olo

@marc0olo marc0olo commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Stack of 4 — merge bottom to top. Review each layer against the one below it, not main.

    1. #284 — security fix: dependency advisories, bun.lock removal
→ 2. #285 — contributor setup docs
    3. #286 — consumer_install job, retires e2e_test_bun
    4. #288 — consumer install guidance

Repo installs are pnpm-only: pnpm.overrides, minimumReleaseAge and onlyBuiltDependencies are pnpm-only fields, so a second installer resolves a graph that bypasses them. Bun remains a supported consumer runtime, covered by consumer_install (bun) from layer 3.

Fixes contributor setup instructions. All four issues predate this stack.

  • Missing pocket-ic download. .npmrc sets ignore-scripts=true, so the postinstall that fetches the binary does not run on a plain install. Verified: after deleting the binary, pnpm i --frozen-lockfile does not restore it and pnpm run setup does. Both guides now list it as a step.
  • Missing example build order. build:examples generates the gitignored declarations/ that the specs import (counter.spec.ts imports ../../declarations/counter.did.js), and root build only builds packages/pic. It also needs the ICP CLI toolchain, which no guide mentioned.
  • Broken badges. They pointed at test-nodejs.yml and test-bun.yml; neither file exists.
  • Vestigial workspaces. It duplicated pnpm-workspace.yaml exactly for bun installs, and pnpm reads only the YAML. Verified all 12 workspace projects still resolve.

🤖 Generated with Claude Code

@marc0olo
marc0olo requested a review from a team as a code owner September 16, 2026 11:17
@marc0olo
marc0olo added this pull request to stack #287 September 16, 2026 11:17
Copilot AI lite review requested due to automatic review settings September 16, 2026 12:42
@marc0olo
marc0olo force-pushed the docs/contributor-setup branch from 73a75d4 to c680097 Compare September 16, 2026 12:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Example toolchain installation is incomplete, and removing workspaces may break Bun installs.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Updates contributor setup documentation, fixes a broken badge, and removes duplicate workspace metadata.

Changes:

  • Adds PocketIC and example build guidance.
  • Corrects the test workflow badge.
  • Removes the redundant workspaces declaration.
File summaries
File Summary
README.md Adds PocketIC setup instructions and fixes the badge.
package.json Removes duplicate workspace metadata; Bun compatibility needs preservation.
examples/README.md Adds build guidance, but toolchain setup remains incomplete.
Review details

Suppressed comments (1)

package.json:11

  • Removing this field breaks the Bun installation path: the example test packages all declare @dfinity/pic as workspace:* (for example, examples/counter/tests/package.json:5), but Bun discovers the root workspace from package.json, not pnpm-workspace.yaml. A fresh bun install will therefore not link/resolve these packages. Keep this field for Bun or replace it with a Bun-supported workspace configuration; pnpm's continued resolution does not cover Bun installs.
  "scripts": {
  • Files reviewed: 3/3 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread examples/README.md Outdated
@marc0olo
marc0olo force-pushed the docs/contributor-setup branch from c680097 to 3c329bf Compare September 16, 2026 14:17
@marc0olo

Copy link
Copy Markdown
Contributor Author

On the suppressed comment about removing the root workspaces field — it's factually right, and worth recording. Bun does not read pnpm-workspace.yaml, so with the field gone bun install at the root finds nothing:

with    workspaces  ->  "Checked 4 installs across 3 packages"
without workspaces  ->  "No packages! Deleted empty lockfile"
                        pkgs/app: error: lib@workspace:* failed to resolve

Keeping it as-is, deliberately: after this stack nothing supported runs bun install — CI installs with pnpm, both guides say pnpm, engines already carries "npm": "please use pnpm", and bun.lock is gone. The field's only remaining effect would be to let an unsupported root bun install succeed and produce a graph that bypasses pnpm.overrides and minimumReleaseAge — the exact hazard #284 removes.

The cost is that bun install now no-ops quietly instead of erroring clearly, which is not a great failure mode. It's a close call; happy to restore the field if you'd rather keep that path working.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

examples/README.md still omits building packages/pic before example tests.

Review details

Suppressed comments (1)

examples/README.md:39

  • Following this setup on a clean checkout still makes pnpm test:examples fail: the workspace dependency resolves @dfinity/pic to packages/pic, whose entry point is dist/index.js, but pnpm i does not build that directory and this sequence only runs build:examples. Please run the package build before the example build (for example, add pnpm build here).
- Build all examples. This compiles the canisters and generates the
  `declarations/` that the tests import, so it must run before the tests:

  ```bash
  pnpm build:examples
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

@marc0olo
marc0olo force-pushed the docs/contributor-setup branch from 3c329bf to 6396284 Compare September 16, 2026 14:38
@marc0olo

Copy link
Copy Markdown
Contributor Author

Valid — fixed. Following the guide on a clean checkout did fail:

Error: Cannot find module '.../examples/counter/tests/node_modules/@dfinity/pic/dist/index.js'

packages/pic/dist is gitignored and untracked, main is ./dist/index.js, and the package's only script is postinstall (with .npmrc setting ignore-scripts=true), so nothing builds it. CI runs pnpm run build before build:examples; the guide skipped it.

Added a pnpm build step before the example build, so the documented order now matches CI: pnpm i → pnpm run setup → toolchain → pnpm build → pnpm build:examples → pnpm test:examples.

Verified by deleting dist/: resolution fails before pnpm build and succeeds after.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The documented setup corrections are complete with no blocking issues.

Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

- Both setup guides omitted the `pocket-ic` download. `.npmrc` sets
  `ignore-scripts=true`, so the `postinstall` that fetches the binary never
  runs on a plain install; `pnpm run setup` is now an explicit step.
- `build:examples` generates the gitignored `declarations/` the tests import
  and needs the ICP CLI toolchain, neither of which was documented.
- The two CI badges pointed at workflow files that do not exist.
- Drops the `workspaces` field, which duplicated pnpm-workspace.yaml for bun
  installs and is ignored by pnpm.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@marc0olo
marc0olo force-pushed the docs/contributor-setup branch from 6396284 to 4ceff2e Compare September 22, 2026 09:58
@marc0olo
marc0olo added this pull request to the merge queue Sep 22, 2026
Merged via the queue into main with commit a4029df Sep 22, 2026
30 checks passed
@marc0olo
marc0olo deleted the docs/contributor-setup branch September 22, 2026 10:10
marc0olo added a commit to yasumorishima/pic-js that referenced this pull request Sep 25, 2026
> **Stack of 4 — merge bottom to top.** Review each layer against the
one below it, not `main`.
>
> **→** 1. dfinity#284 — security fix: dependency advisories, `bun.lock`
removal
> &nbsp;&nbsp;&nbsp; 2. dfinity#285 — contributor setup docs
> &nbsp;&nbsp;&nbsp; 3. dfinity#286 — `consumer_install` job, retires
`e2e_test_bun`
> &nbsp;&nbsp;&nbsp; 4. dfinity#288 — consumer install guidance
>
> Repo installs are pnpm-only: `pnpm.overrides`, `minimumReleaseAge` and
`onlyBuiltDependencies` are pnpm-only fields, so a second installer
resolves a graph that bypasses them. Bun remains a supported
**consumer** runtime, covered by `consumer_install (bun)` from layer 3.
>
> Scoped to the security fix and the install-path change it forces.
Pre-existing documentation gaps in `README.md` and `examples/README.md`,
including the `pnpm run setup` step and the canister toolchain, are
fixed in dfinity#285.

Clears all 24 open Dependabot alerts (1 critical, 13 high, 8 moderate, 2
low). Supersedes dfinity#275 and dfinity#283.

Bumps `vite` to `^7.3.5` and `vitest` to `^4.1.11`, and extends
`pnpm.overrides` to cover the 21 transitive advisories. Drops the
`minimumReleaseAgeExclude: [vite]` entry, annotated for removal after
2026-04-16.

## Removing `bun.lock`

`pnpm.overrides`, `minimumReleaseAge` and `onlyBuiltDependencies` are
pnpm-only, so `bun.lock` resolved a second dependency graph that
bypassed them. Against the overrides as they stood on `main`:

| `pnpm.overrides` on `main` | pnpm-lock.yaml | bun.lock |
| --- | --- | --- |
| `brace-expansion@>=1 <2` → `^1.1.13` | 1.1.13 | 1.1.12 |
| `brace-expansion@>=2 <2.0.3` → `^2.0.3` | 2.0.3 | 2.0.2 |
| `picomatch@>=2 <3` → `^2.3.2` | 2.3.2 | 2.3.1 |
| `picomatch@>=4 <4.0.4` → `4.0.4` | 4.0.4 | 4.0.3 |
| `yaml@>=2 <2.8.3` → `2.8.3` | 2.8.3 | 2.8.2 |

This PR then raises several of those bounds to clear the open
advisories, so the versions now resolved are `brace-expansion` 1.1.18 /
2.1.4, `picomatch` 2.3.2 / 4.0.4 and `yaml` 2.8.3.

Dependabot cannot keep `bun.lock` current either: bun is supported for
[version updates but not security
updates](https://docs.github.com/en/code-security/dependabot/ecosystems-supported-by-dependabot/supported-ecosystems-and-repositories),
so security PRs updated `package.json` and `pnpm-lock.yaml` only,
leaving it stale and failing `bun i --frozen-lockfile`.

`e2e_test_bun` now installs with pnpm and still builds and tests with
bun. Contributor-facing commands move to pnpm to match, including the
eight per-example READMEs.

## Verified

`pnpm audit` clean · `pnpm i --frozen-lockfile` up to date · `pnpm
test:pic` 65 passed · `bun run build` against the pnpm tree

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
marc0olo added a commit to yasumorishima/pic-js that referenced this pull request Sep 25, 2026
> **Stack of 4 — merge bottom to top.** Review each layer against the
one below it, not `main`.
>
> &nbsp;&nbsp;&nbsp; 1. dfinity#284 — security fix: dependency advisories,
`bun.lock` removal
> &nbsp;&nbsp;&nbsp; 2. dfinity#285 — contributor setup docs
> **→** 3. dfinity#286 — `consumer_install` job, retires `e2e_test_bun`
> &nbsp;&nbsp;&nbsp; 4. dfinity#288 — consumer install guidance
>
> Repo installs are pnpm-only: `pnpm.overrides`, `minimumReleaseAge` and
`onlyBuiltDependencies` are pnpm-only fields, so a second installer
resolves a graph that bypasses them. Bun remains a supported
**consumer** runtime, covered by `consumer_install (bun)` from layer 3.
>
> The job name is required by convention; add the four
`consumer_install:required (…)` contexts to the ruleset only after this
merges, or the layers below block on a job they do not have.

Adds a `consumer_install` job that verifies the published package
actually installs and runs, and retires the `e2e_test_bun` matrix it
replaces.

## The gap

`@dfinity/pic` delivers the `pocket-ic` binary from a `postinstall`
script. Three of the four supported package managers now block lifecycle
scripts by default, each with its own opt-in:

| | postinstall by default | opt-in |
| --- | --- | --- |
| npm 12 | blocked | `allowScripts` |
| pnpm 10 | blocked | `onlyBuiltDependencies` |
| bun 1.3 | blocked | `trustedDependencies` |
| yarn 1 | runs | — |

Nothing covered this: every example depends on `"@dfinity/pic":
"workspace:*"`, so the tarball was never installed in CI. `npm pack`
appeared only in `release.yml`, to publish.

## The job

Packs the package, installs it with each manager, asserts the binary is
present and executable, then starts and stops a `PocketIcServer` against
it.

All four legs pass on ubuntu. The opt-in lives in
`scripts/smoke-test-install.sh` alongside the guides, so a change to the
pnpm, bun or yarn mechanism fails the build.

**npm is only partly covered.** npm keys `allowScripts` by resolved
spec, so installing from a tarball needs the `file:` path where a
consumer installing from the registry writes the package name. This leg
proves npm still honours `allowScripts`, but not the key form the guide
documents. Closing that needs a post-release leg installing
`@dfinity/pic` from the registry; noted in the script.

Runs on ubuntu only: the opt-in mechanisms are not platform specific,
and the darwin binary download stays covered by `e2e_test_nodejs` on
`macos-latest`.

## Replacing `e2e_test_bun`

That job ran the jest and vitest examples under bun. With no
bun-specific code in `packages/pic` and no example using `bun:test`, it
largely duplicated `e2e_test_nodejs` against runtime-agnostic code,
while covering neither bun as a package manager nor bun as a test
runner.

Bun as a *test runner* is still uncovered — `using-bun.mdx` documents a
`bun:test` and `bunfig.toml` workflow that nothing exercises, before or
after this change. A `bun:test` example would be the fix; out of scope
here.

Renames a required check. The `e2e_test_bun:required` contexts have
already been dropped from ruleset `4081516`, so nothing blocks this; see
the note above for when to add the `consumer_install` ones.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
marc0olo added a commit to yasumorishima/pic-js that referenced this pull request Sep 25, 2026
…ity#288)

> **Stack of 4 — merge bottom to top.** Review each layer against the
one below it, not `main`.
>
> &nbsp;&nbsp;&nbsp; 1. dfinity#284 — security fix: dependency advisories,
`bun.lock` removal
> &nbsp;&nbsp;&nbsp; 2. dfinity#285 — contributor setup docs
> &nbsp;&nbsp;&nbsp; 3. dfinity#286 — `consumer_install` job, retires
`e2e_test_bun`
> **→** 4. dfinity#288 — consumer install guidance
>
> Repo installs are pnpm-only: `pnpm.overrides`, `minimumReleaseAge` and
`onlyBuiltDependencies` are pnpm-only fields, so a second installer
resolves a graph that bypasses them. Bun remains a supported
**consumer** runtime, covered by `consumer_install (bun)` from layer 3.

Fixes the consumer install instructions. PicJS downloads the `pocket-ic`
binary from a `postinstall` script, and npm, pnpm and bun all block
install scripts by default — so the binary is missing and
`PocketIcServer.start()` fails.

Three problems:

- `getting-started.mdx` never showed how to install `@dfinity/pic`, or
that the install script needs permitting. No guide did.
- `running-tests.mdx` stated the binary is "downloaded when installing
`@dfinity/pic`", which is untrue by default for three of the four
supported package managers.
- `using-bun.mdx` held the only opt-in documented anywhere.

Adds an **Installing PicJS** section to the getting started guide with
the install command and required entry per package manager, corrects the
running tests guide, and points the bun guide at the shared section.

## Opt-ins, each verified against a registry install

| Package manager | Entry in `package.json` |
| --- | --- |
| npm 12 | `"allowScripts": { "@dfinity/pic": true }` |
| pnpm 10 | `"pnpm": { "onlyBuiltDependencies": ["@dfinity/pic"] }` |
| bun 1.3 | `"trustedDependencies": ["@dfinity/pic"]` |
| yarn 1 | not needed |

Confirmed by installing `@dfinity/pic` from the registry with each and
asserting the binary lands. The `consumer_install` job from dfinity#286 covers
the pnpm, bun and yarn mechanisms on every run; npm's is only partly
covered there, because a tarball install keys `allowScripts` by `file:`
path rather than by name.

Tabs match the idiom in `using-jest.mdx`, `using-vitest.mdx` and
`using-bun.mdx`. Nothing in this repo renders MDX — the docs build is
typedoc plus a copy — so the rendered page is worth an eye.

Longer term this friction is better removed than documented: shipping
the binary as platform-specific `optionalDependencies` gated on
`os`/`cpu` needs no install script and no opt-in, which is the approach
esbuild, swc and sharp all moved to. Out of scope here.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants