Conversation
Retarget sync-core/sync-plugin from this repo's V2 certified-assets canister to the legacy `assetstorage` canister shipped with dfx 0.32.0 (`ic-certified-assets`, api_version 2). Per-asset metadata now comes from `.ic-assets.json5` instead of `_headers`/`_redirects`. sync-core: - new `config.rs`: full `.ic-assets.json5`/`.ic-assets.json` parser ported from ic-asset (nested inheritance, glob `match`, `ignore`, `headers`, `cache.max_age`, `enable_aliasing`, `allow_raw_access`, `encodings`, `security_policy`) - new `security_policy.rs`: standard/hardened/disabled CSP presets - `scan.rs` rewritten as gather_asset_descriptors (walkdir + config-driven ignore; `.well-known` kept; config files excluded) - `canister.rs`: add `enable_aliasing` (CreateAsset) and `is_aliased` (SetAssetProperties + AssetProperties); drop RedirectRule/RulePattern/ SetRedirectRules/get_redirect_rules - `sync.rs`: drive CreateAsset/SetAssetProperties from AssetConfig; drop redirect/html-handling; keep chunk packing + commit staging - delete redirects.rs, headers.rs, html_handling.rs, glob.rs - update_properties ignores the canister-injected `Set-Cookie: ic_env=...` header (added by icp-cli's env-var step) so syncs stay idempotent e2e: - build.rs fetches the real 0.32.0 assetstorage.wasm.gz (sha256-pinned, installed gzipped, no decompress) instead of building this repo's canister - convert fixtures/tests to `.ic-assets.json5`; remove redirect/header/ multi-dir cases; add config.rs end-to-end test Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
mainThe
migrationbranch is a permanently separate line of work. Do not merge it.Instead, we will git-tag commits on this branch and cut special GitHub releases that host the built
sync-pluginwasm module. icp-cli projects (recipes, templates) reference that hosted wasm directly.The driving use case: a companion assets recipe that swaps the sync mechanism from the old
type: assetstotype: pluginwhile keeping the canister wasm unchanged (the legacy dfx 0.32.0assetstoragecanister). This minimizes the upgrade effort for existing assets-recipe users when we droptype: assetssync in the upcoming icp-cli release.What this branch does
Retargets
sync-core/sync-pluginfrom this repo's V2 certified-assets canister to the legacyassetstoragecanister shipped with dfx 0.32.0 (ic-certified-assets, which reportsapi_version == 2). Per-asset metadata is read from.ic-assets.json5(fullic-assetparity) instead of the_headers/_redirectsfiles used onmain.The legacy canister's wire protocol is nearly identical to this repo's V2 canister; the differences are narrow and handled here:
main(new)get_redirect_rules/SetRedirectRulesCreateAssetArgumentsenable_aliasingSetAssetPropertiesArgumentsis_aliasedAssetPropertiesis_aliased_headers+_redirects.ic-assets.json5enable_aliasingsync-coreconfig.rs—.ic-assets.json5/.ic-assets.jsonparser ported fromic-asset: nested config inheritance, globmatch,ignore,headers,cache.max_age,enable_aliasing,allow_raw_access,encodings,security_policy.security_policy.rs—standard/hardened/disabledCSP presets.scan.rsrewritten asgather_asset_descriptors(walkdir + config-drivenignore;.well-knownkept; config files excluded).canister.rs— addenable_aliasing/is_aliased; dropRedirectRule/RulePattern/SetRedirectRules/get_redirect_rules.sync.rs— driveCreateAsset/SetAssetPropertiesfromAssetConfig; drop redirect & html-handling; keep chunk packing + commit staging.redirects.rs,headers.rs,html_handling.rs,glob.rs.Set-Cookie: ic_env=...header into every HTML asset (driven by icp-cli's env-var step) and returns it fromget_asset_properties.update_propertiesnow ignores that canister-managed cookie so repeat syncs report "up to date" instead of clobbering it every run.e2e
build.rsfetches the realassetstorage.wasm.gzfrom the dfx 0.32.0 release (sha256-pinned to the GH release digest, installed gzipped — no decompression) instead of building this repo's canister..ic-assets.json5; redirect / header / multi-dir cases removed; newconfig.rsend-to-end test (headers,max_age, aliasing,security_policyCSP, config-file-not-uploaded).Test plan
cargo test -p sync-core— 75 unit tests pass.cargo build -p sync-plugin --target wasm32-wasip2 --release— links under WASI.cargo test -p e2e— deploys the real 0.32.0assetstorage.wasmand exercises the plugin viaicp deploy; config test + all sync tests (incl. idempotentno_op_sync) pass.🤖 Generated with Claude Code