Skip to content

fix(cargokit): keep precompiled snapshot staging paths under Windows MAX_PATH - #29

Merged
iota9star merged 2 commits into
fluttercandies:mainfrom
ClosedHarmony:fix/max-path-staging
Sep 30, 2026
Merged

iota9star merged 2 commits into
fluttercandies:mainfrom
ClosedHarmony:fix/max-path-staging

Conversation

@HsukqiLee

Copy link
Copy Markdown
Contributor

What

Keep CargoKit precompiled-snapshot staging directory names under the Windows MAX_PATH (~260 char) limit by truncating the embedded generation key to its 16-hex prefix.

Why

PrecompiledAssetStore creates staging directories as v2/<key>/snapshots/<key>.staging-<id>-<tmp>/.... Embedding the full 64-hex key a second time — plus the staging id, the createTempSync suffix and the asset's relative path — pushes long cache roots past the ~260-char limit that dart:io enforces on Windows (it does not apply \\?\ prefixing), so snapshot publication fails with path-too-long errors on machines with deep user-profile/cache paths.

The 16-hex prefix keeps the name diagnostic and collision-free within the generation directory; the authoritative full key remains the parent directory name and the manifest.

Changes

  • cargokit/build_tool/lib/src/precompiled_asset_store.dart: truncate the key in the staging temp-dir prefix to 16 hex chars.
  • cargokit/build_tool/test/precompiled_asset_store_test.dart: align the staging-name assertion with the truncation.

Testing

dart test test/precompiled_asset_store_test.dart on Windows: all staging/snapshot rename assertions pass. (A few fresh processes … tamper tests time out flakily on this machine on clean main as well — pre-existing, unrelated to this change.)

Follow-up to the CI discussion in #22 — this is another independent fix carried in our fork, split out per the rebase note there.

The staging directory name embedded the full 64-hex generation key on top
of the v2/<key>/snapshots/ parent that already carries it; together with
the staging id, the createTempSync suffix and the asset's relative path
this pushed long cache roots past the ~260-char limit dart:io enforces
(no \\\\?\ prefixing), failing every precompiled download on Windows.

Truncate the embedded key to 16 hex chars: still diagnostic and
collision-free within the generation directory, while the authoritative
full key remains the parent directory name and the manifest. Legacy
cache-root-level <key>.staging-*/<key>.previous-* orphan matching in
hasAnyState is untouched and keeps matching old layouts.
…tion

The store now names snapshot staging directories with the 16-hex
truncation of the generation key; pin that contract in the rename
assertion (the published snapshot directory still carries the full key).
@iota9star
iota9star merged commit a13c2ae into fluttercandies:main Sep 30, 2026
14 checks passed
@HsukqiLee
HsukqiLee deleted the fix/max-path-staging branch September 30, 2026 13:34
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.

2 participants