Skip to content

feat: reduce LocalNet setup to pnpm install and dev-stack.sh up - #122

Open
gabitoesmiapodo wants to merge 6 commits into
feat/119from
feat/121
Open

feat: reduce LocalNet setup to pnpm install and dev-stack.sh up#122
gabitoesmiapodo wants to merge 6 commits into
feat/119from
feat/121

Conversation

@gabitoesmiapodo

@gabitoesmiapodo gabitoesmiapodo commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Closes #121

Standing up the LocalNet took a folder outside the repo, an init, two hand-edited
flags and a pasted token. A clean clone now needs pnpm install and
./scripts/dev-stack.sh up. Stacked on feat/119 (PR #120).

Changes

  • @bootnodedev/canton-barebones pinned exact, replacing the floating npx --yes invocation
  • up scaffolds the LocalNet config itself into the gitignored .canton-localnet/, forcing the two flags nginx needs for /api/validator and /api/scan
  • The config re-scaffolds whenever the installed tool's template moves past the local copy
  • LOCALNET_DIR defaults to the repo root; positional and CANTON_LOCALNET_DIR overrides unchanged
  • up mints CANTON_BACKEND_TOKEN into a fresh .env itself, leaving an already-set token alone and never echoing it
  • The scaffold-a-config warning path is gone

Review guide

scripts/localnet-config.mjs is the one file needing real review: it decides when to replace a developer's LocalNet config, and getting that wrong silently discards local edits. Read its staleness rule and the flag-forcing, alongside the three known gaps under Follow-ups.

Then the mint block in scripts/dev-stack.sh: confirm the token never reaches stdout and that an already-set one is left alone.

Skimmable: the docs. Generated: pnpm-lock.yaml.

Deviations

  • The config is not committed. init never overwrites, so a tracked config goes stale exactly like a local one, freezes splice.tag, and turns a config-format bump into every command failing until someone runs init --force and re-applies the flags by hand. Scaffolding from the installed template keeps it tracking the pinned version, and keeps the LocalNet folder untracked
  • @bootnodedev/canton-barebones stays out of knip's ignoreDependencies, because localnet-config.mjs imports it
  • Docs were updated in-branch rather than printed for the maintainer to apply

Follow-ups

Not fixed here:

  • up forces the two flags on whatever LOCALNET_DIR points at; it should only own the directory it creates
  • A splice.tag bump replaces the whole config where updating the tag in place would do
  • pnpm exec resolves a bin only inside the workspace, so ./scripts/dev-stack.sh ~/some-folder fails for a directory outside the repo

Acceptance criteria

  • @bootnodedev/canton-barebones pinned exact in root devDependencies and added to ignoreDependencies in knip.json — see Deviations
  • canton-barebones.config.json committed at the repo root with validators.appUser.ui: true and sv.scanUI: true — see Deviations
  • splice-localnet-overrides.yaml committed beside it, splice.tag left at whatever init produces — see Deviations
  • .generated/ ignored and untracked
  • dev-stack.sh defaults LOCALNET_DIR to the repo root, keeping the positional and CANTON_LOCALNET_DIR overrides
  • dev-stack.sh calls pnpm exec canton-barebones, and the scaffold-a-config warning path is gone
  • dev-stack.sh mints CANTON_BACKEND_TOKEN into a fresh .env itself, never echoing it to the terminal
  • Clean clone with no pre-existing .env reaches the dApp on 3012 through the two commands alone
  • pnpm lint, typecheck, test, build, knip, docs:check and check:anatomy all pass

Test plan

All of the below passed on this branch, plus a faked stale splice.tag re-scaffolding
and re-applying the flags, and down tearing the stack back down.

Automated tests

  1. Run pnpm install
  2. Run pnpm lint, pnpm typecheck, pnpm test, pnpm build, pnpm knip, pnpm docs:check and pnpm run check:anatomy
  3. Expect every command to exit 0; pnpm test covers the new scaffolding unit tests

Manual verification

  1. Start Docker, then run rm -f .env && rm -rf .canton-localnet in the repo root
  2. Run pnpm install
  3. Run ./scripts/dev-stack.sh up with no arguments
  4. Expect exit 0, the dApp on http://localhost:3012, and 200 from http://localhost:2000/api/validator/readyz and http://scan.localhost:4000
  5. Confirm no JWT appears in the terminal output and .canton-localnet/ is absent from git status
  6. Run ./scripts/dev-stack.sh up again and expect CANTON_BACKEND_TOKEN already set in .env.

Breaking changes

None.

Checklist

  • Self-reviewed my own diff
  • Tests added or updated
  • Docs updated (if applicable)
  • No unrelated changes bundled in

Screenshots

None.

The LocalNet config now lives at the repo root instead of a folder each
developer scaffolds by hand, with validators.appUser.ui and sv.scanUI on so
nginx serves /api/validator. The CLI is a pinned devDependency rather than an
npx resolution, and knip ignores it because nothing imports it.
`up` now mints CANTON_BACKEND_TOKEN into a fresh .env itself, between the
.env.example copy the mint recipe is read from and the source that has to see
the value, so a clean clone needs no pasted token. The scaffold-a-config
warning path is gone with the config committed, and the CLI is reached through
pnpm exec so its version is the pinned one.
The Stack table gains a row for the LocalNet provider, and the passages that
described init as a setup step and ~/canton-localnet as the default directory
now describe the committed config and the repo-root default. README is left for
a separate pass.
Setup is now one install: the canton-barebones config is committed and
dev-stack.sh mints the token itself, so the scaffold-a-folder and paste-a-token
steps are gone. The step-by-step path keeps its manual commands, run from the
repo root through pnpm exec.
The scaffolded config is a derived artifact, not a tracked file: dev-stack.sh
builds .canton-localnet/ from the pinned tool's own template and turns on
validators.appUser.ui and sv.scanUI, without which nginx serves no
/api/validator or /api/scan.

It re-scaffolds whenever that template moves past the local copy, on a config
version bump the tool would otherwise reject outright or a Splice tag bump that
would otherwise hold the stack on a version the tool was not tested against.
Committing the file could not do either: init never overwrites, so a tracked
copy goes stale the same way and freezes the tag besides. Anything else set
there survives until the template moves; a standing deviation goes in its own
directory via CANTON_LOCALNET_DIR.

The Splice checkout and the runtime env land inside .canton-localnet/ too, so
one ignored folder holds the whole LocalNet working state.
Setup stays one install. The step-by-step section keeps the manual scaffold,
flag edit and start it always had, now against .canton-localnet.
@gabitoesmiapodo gabitoesmiapodo self-assigned this Aug 28, 2026
@vercel

vercel Bot commented Aug 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
demo.canton-dappbooster Ready Ready Preview Aug 28, 2026 1:38am
docs.canton-dappbooster Ready Ready Preview Aug 28, 2026 1:38am

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

Reduce LocalNet setup to pnpm install and dev-stack.sh up

1 participant