Repository navigation
chore: prepare release 0.3.2 - #118
Merged
Merged
Conversation
`state-hash ./dist` — the exact invocation `docs/verifying-contents.md` tells a verifier to run — failed with "read_dir /dist: No such file or directory". `scan` rebuilt its root by prepending `/` and keeping only `Normal` components, so any relative path became absolute. Predates the `state-hash` tool; the plugin never hit it because the host hands it a preopen guest name, and the e2e verifier test passes an absolute path. Use `dir` verbatim instead. Nothing needed the absolute root: `walk` only joins onto the root it was handed and strips that same prefix back off, and the sibling `_headers` / `_redirects` reads already used `dir` relative. The docstring keeps the reasoning that motivated the rebuild — don't reintroduce `canonicalize`, it ENOENTs under a multi-component WASI preopen — and now states where sandbox safety actually comes from: the preopen itself (a guest reaches nothing outside it however a path is spelled) plus the host rejecting absolute / `..` `dirs` entries. The `Normal`-only filter protected nothing; its only real effect was silently reinterpreting relative paths. All three spellings of a directory (`./dist`, `dist`, absolute) now produce the same hash. Two test-infrastructure fixes found while verifying this: - `crates/e2e/build.rs` never listed `asset-prep` in `rerun-if-changed`, so the first nested-preopen run silently tested a stale `dist/plugin.wasm` and proved nothing. `wire-types`, `state-hash` and `sync-plugin/wit/` were missing too. It now watches every crate that lands in either wasm, whole-crate, plus the root manifest and lockfile. - The `nested` fixture gained a `_redirects` at the root of its multi-component preopen, and `nested_dir_deploy` fetches `/old` to prove the rule loaded. An absent config file means "no rules", so a path that failed to resolve there would have dropped every redirect rule without an error. Verified load-bearing by breaking the read and watching the test fail. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…otection docs Closes #116. `issue_token` takes a single `IssueTokenArgs` record, but the quick start and the managing-tokens table in `docs/access-protection.md` passed three positional arguments. The call fails — an arity/type mismatch that traps in the canister, or a serialization error when the CLI has the candid interface to check against. The runnable example (`examples/access-protection/README.md`) already had the record form, so the docs contradicted both the `.did` and the working example. The scan the issue asked for turned up one more broken form in the same tables: the methods that take no arguments were written bare (`list_tokens`, `check_protection_status`, `disable_protection`). Given no argument, `icp canister call` does not send an empty one — it opens an interactive prompt to build the arguments, which for a non-interactive caller is either "arguments were not provided and could not fetch candid type" or a silent "User cancelled." They now pass `'()'`, and a line under the table says why. No other doc snippet drifted: every remaining `canister call` occurrence across the docs, READMEs and ARCHITECTURE.md matches the `.did`. Verified by deploying `examples/access-protection` to a local replica and running every `icp canister call` line extracted from the two edited files (both with and without `--candid`, stdin closed): all succeed, the old positional form fails, and the documented quick start ends with a logged-out 307 to /login.html and a 200 for a request bearing the passphrase. Also confirmed the table's claim about random tokens — `value = null` and an omitted `value` field both mint one. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
#116 was a documented call that never worked: `issue_token` printed with three positional arguments in a copy-pasteable quick start *and* in the reference table, while `protection.rs` called the same method correctly by hand. Nothing executed the documented form, so the drift shipped. `documented_calls_are_accepted_by_the_canister` closes that: it extracts every `<method> '<candid>'` pair from the committed `docs/access-protection.md` and `examples/access-protection/README.md` — fenced `sh` blocks and reference tables alike, since the bug was in both — and sends each to the deployed example. Reference forms carry placeholders, so a small explicit table fills them in; a placeholder with no entry fails the test rather than silently skipping the snippet. A final assertion requires all six management methods to have been covered, so a reformatted table that stopped matching can't leave the test passing vacuously. Snippets are judged one at a time, not as a sequence: only `issue_token` needs the gate open, so it is re-enabled before those, and the documented order stays the concern of the existing gating test. Reading the committed files (not the deployed copy) is deliberate — the guarantee is about the files a reader lands on. Verified load-bearing both ways: restoring the positional `issue_token` fails the test with the canister's decode trap, attributed to `docs/access-protection.md`; renaming a placeholder fails it with "unfilled placeholder … add it to PLACEHOLDERS". Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…pes#34 dfinity/icp-cli-recipes#34 (merged) added an optional `visibility` to `metadata` entries across all five recipes that expose the parameter, `static-site` among them — but it edited `recipes/static-site/` directly, and this repo is that directory's source: `scripts/publish-recipe.sh` overwrites both `recipe.hbs` (from the release asset generated out of `recipe.hbs.in`) and `README.md` (copied from `crates/recipe-gen/assets/`). The next publish would have silently reverted it. Ported here verbatim, so it survives. - … metadata "{{ name }}" -d "{{ value }}" --keep-name-section + … metadata "{{ name }}" -d "{{ value }}"{{#if visibility}} -v {{ visibility }}{{/if}} --keep-name-section Confirmed the port closes the loop: regenerating the v0.3.1 release recipe now matches the published `recipes/static-site/recipe.hbs` byte for byte, and `crates/recipe-gen/assets/README.md` matches the published README byte for byte. So the next `publish-recipe.sh` run is a no-op on these lines rather than a revert. Coverage for the new field, at both levels: - `recipe-gen` unit tests pin the full `ic-wasm` command line rather than grepping it: `local_with_metadata` now asserts an entry that omits `visibility` renders byte-for-byte what it did before the field existed (the backward-compatibility claim, and the case that would break under icp-cli's handlebars strict mode), and `local_with_metadata_visibility` covers `public`, explicit `private`, and omitted in one mixed list — the shape where a template slip shows up as a stray flag or a lost `--keep-name-section`. - `recipe_metadata` (e2e) gains a `visibility: public` entry beside the existing private one and now reads the sections back off the deployed canister, which is the only place the difference is observable: `visibility` decides whether ic-wasm writes `icp:public <name>` or `icp:private <name>`, and the replica serves the former to anyone while gating the latter on the caller being a controller. So the public section is read with `--identity anonymous` and the private one must be refused, with a controller read of both first so neither anonymous check can pass vacuously. Verified load-bearing: dropping `visibility: public` from the fixture fails the test with the intended message. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Patch bump — `0.3.1 → 0.3.2` — so a deployed canister moves in place with `--mode upgrade` and keeps its state; nothing in this series changed a stable-state shape. The value is also the canister↔plugin release identity (`crates/wire-types/src/version.rs`), so both wasms rebuild reporting 0.3.2 and only talk to each other. `Cargo.lock` carries the same bump for all 11 workspace members and no dependency churn — the compressor builds whose output bytes end up in deployed canisters and in `state_hash` are untouched. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…'s identity
`recipe_metadata` failed on both CI runners while passing locally. The
assertion it failed on read the *private* section anonymously and required
a refusal — which assumes the anonymous principal is not a controller of
the canister. On a fresh icp-cli install the only identity is the built-in
`anonymous` one and it is the default (`icp/src/identity/manifest.rs`), so
CI deploys as anonymous, anonymous *is* the controller, and every section
reads back fine. A developer machine with a real default identity behaves
the opposite way. The test was passing for a reason that had nothing to do
with the recipe.
Visibility is now read where it does not depend on who is asking: the
section *names* on the built wasm, via `ic-wasm <wasm> metadata`, which
prints `icp:public build:commit` / `icp:private app:framework`. That is
exactly the distinction `-v public` controls, and the replica cannot supply
it — it serves a public section to anyone and a private one to controllers,
so telling them apart needs a non-controller caller, and no identity is
available that a test can rely on being one. The controller-side read of
both values off the deployed canister stays, so the visibility check still
can't pass on a wasm whose sections never reached the replica.
Reaching into `.icp/cache/artifacts/<canister>` is an icp-cli implementation
detail (`icp build` has no `--output`), so the helper asserts the artifact is
there with a message saying to update the path if the layout moves, rather
than failing as if the recipe broke.
Verified by reproducing CI's condition locally instead of guessing at it:
under a throwaway `ICP_HOME` — a fresh install, anonymous as default
identity — the previous test fails with CI's exact message ("must stay
private … Got: react") and the new one passes; it also still passes under a
normal home with a real default identity. Dropping `visibility: public` from
the fixture fails it with the intended message, so the check is still
load-bearing.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
lwshang
marked this pull request as ready for review
July 30, 2026 21:41
raymondk
pushed a commit
to dfinity/icp-cli-recipes
that referenced
this pull request
Jul 31, 2026
Publishes the `static-site` recipe at v0.3.2, pinning the canister and sync-plugin wasm from dfinity/certified-assets's v0.3.2 release. The committed `recipe.hbs` is the asset attached to that release, verbatim — verify it matches: https://github.com/dfinity/certified-assets/releases/download/v0.3.2/recipe.hbs After merge, tag `static-site-v0.3.2` in this repo to cut the recipe release. ------ ### Context: version ordering This publishes `static-site-v0.3.2`, below the existing `static-site-v0.4.0`. That's deliberate: the `static-site` recipe version tracks the certified-assets release it pins, and v0.4.0 pins v0.3.1 artifacts. A minor bump upstream also carries a specific meaning — breaking change, canister reinstall, every asset re-uploaded — which doesn't apply here. Sequence: merge this → tag `static-site-v0.3.2` → retire the `static-site-v0.4.0` tag and release. One local checkout references it, coordinated directly. #34's `visibility` option is unaffected: it was carried upstream in [certified-assets#118](dfinity/certified-assets#118), so it's in the recipe committed here and the diff is only the two wasm pins. These files are regenerated from that repo on each publish, so changes persist by landing there.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Four changes bundled into the 0.3.2 patch release. Nothing here touches a
stable-state shape, so a deployed canister moves with
--mode upgradeandkeeps its assets.
fix(asset-prep): scan a relative dist directory as givenstate-hash ./dist— the exact invocationdocs/verifying-contents.mdtells a verifier torun — failed with
read_dir /dist: No such file or directory.scanrebuilt itsroot by prepending
/and keeping onlyNormalcomponents, so any relative pathbecame absolute. The plugin never hit it (the host hands it a preopen guest name)
and the e2e verifier test passes an absolute path, so it went unnoticed.
diris now used verbatim. Nothing needed the absolute root:walkonly joinsonto the root it was handed and strips that same prefix back off, and the sibling
_headers/_redirectsreads were already relative. The docstring keeps thereasoning that motivated the rebuild — don't reintroduce
canonicalize, itENOENTs under a multi-component WASI preopen — and now states where sandbox
safety actually comes from: the preopen itself, plus the host rejecting absolute
/
..dirsentries. All three spellings (./dist,dist, absolute) nowproduce the same hash.
Two test-infrastructure fixes found while verifying it:
crates/e2e/build.rsnever listedasset-prepinrerun-if-changed, so thefirst nested-preopen run silently tested a stale
dist/plugin.wasm.wire-types,state-hashandsync-plugin/wit/were missing too. It nowwatches every crate that lands in either wasm, plus the root manifest and
lockfile.
nestedfixture gained a_redirectsat the root of its multi-componentpreopen, and
nested_dir_deployfetches/oldto prove the rule loaded — anabsent config file means "no rules", so a path that failed to resolve there
would have dropped every redirect rule without an error.
docs: fixissue_tokencall form and empty-argument callsCloses #116.
issue_tokentakes a singleIssueTokenArgsrecord, but the quickstart and the managing-tokens table passed three positional arguments — a call
that traps in the canister. The scan the issue asked for turned up one more
broken form: the zero-argument methods were written bare (
list_tokens,check_protection_status,disable_protection). Given no argument,icp canister calldoesn't send an empty one — it opens an interactive prompt,which for a non-interactive caller is either
arguments were not provided and could not fetch candid typeor a silentUser cancelled.They now pass'()'.Verified against a local replica: every
icp canister callline extracted fromthe edited files succeeds, the old positional form fails, and the documented
quick start ends with a logged-out
307 → /login.htmland a200for a requestbearing the passphrase.
test(e2e): run the docs' canister-call snippetsThe drift above shipped because nothing executed the documented form.
documented_calls_are_accepted_by_the_canisterextracts every<method> '<candid>'pair from the committed docs — fencedshblocks andreference tables, since the bug was in both — and sends each to the deployed
example. Reference forms carry placeholders, so a small explicit table fills them
in; a placeholder with no entry fails the test rather than silently skipping the
snippet. A final assertion requires all six management methods to have been
covered, so a reformatted table can't leave the test passing vacuously.
Verified load-bearing both ways: restoring the positional
issue_tokenfailswith the canister's decode trap, attributed to the document; renaming a
placeholder fails with
unfilled placeholder … add it to PLACEHOLDERS.feat(recipe): adopt the metadatavisibilityfielddfinity/icp-cli-recipes#34
(merged) added an optional
visibilitytometadataentries, but it editedrecipes/static-site/directly — and this repo is that directory's source:scripts/publish-recipe.shoverwrites bothrecipe.hbs(from the release assetgenerated out of
recipe.hbs.in) andREADME.md(copied fromcrates/recipe-gen/assets/). The next publish would have silently reverted it.Ported verbatim, and confirmed the loop closes: regenerating the v0.3.1 release
recipe now matches the published
recipe.hbsbyte for byte, and the READMEsource matches the published README byte for byte.
Coverage for the new field at both levels:
recipe-genunit tests pin the fullic-wasmcommand line rather thangrepping it. An entry omitting
visibilitymust render byte-for-byte what itdid before the field existed (the backward-compatibility claim, and the case
that would break under icp-cli's handlebars strict mode); a second test covers
public, explicitprivate, and omitted in one mixed list.recipe_metadata(e2e) gained avisibility: publicentry beside the privateone and now reads the sections back off the deployed canister, the only place
the difference is observable:
visibilitydecides whether ic-wasm writesicp:public <name>oricp:private <name>, and the replica serves the formerto anyone while gating the latter on being a controller. So the public section
is read with
--identity anonymousand the private one must be refused, with acontroller read of both first so neither anonymous check passes vacuously.
chore: prepare release 0.3.2Patch bump, and
Cargo.lockcarries it for all 11 workspace members with nodependency churn — the compressor builds whose bytes end up in deployed canisters
and in
state_hashare untouched.Testing
cargo nextest run --locked --all-targets— 466 pass (462 before this branch);cargo clippy --workspace --all-targetsandcargo fmt --check --allclean.🤖 Generated with Claude Code