You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(astro): bump CACHE_SCHEMA_VERSION to 2 so v1.54 AssetRef fields propagate
The build cache at node_modules/.run402/assetMap.json stored AssetRefs
verbatim by source SHA. When the gateway started emitting the v1.54
shape-contract fields (blurhash_data_url + asset_schema), existing
caches kept returning pre-v1.54 AssetRefs on hit — every build with
unchanged source bytes was silently serializing manifests that looked
right (legacy fields populated) but lacked the two new fields.
Reproduced against silver-pines.kychon.com: manifest built 24 min after
the gateway fix shipped + live tests confirmed the fields on
api.run402.com, but the deployed manifest still had both fields missing.
Cache hit path at uploader.ts:404 returned the stale ref; buildManifest
(vite-plugin.ts:392) JSON.stringified it verbatim into the output.
Three coordinated changes plus the discipline note that prevents this
class of bug going forward:
1. astro/src/cache.ts — CACHE_SCHEMA_VERSION 1 → 2. Bumping is
non-destructive: stale entries are dropped silently and the next
build re-uploads (or, more commonly, hits the gateway's CAS dedupe
and re-receives a fresh, fully-populated AssetRef). New file header
documents the "bump on every AssetRef field add" discipline plus the
history of why the version was bumped.
2. astro/src/types.ts — AssetRef widened to mirror the current SDK
shape: v1.50 fields (metadata, image_format, image_info, image_exif,
image_exif_policy) plus v1.54 fields (blurhash_data_url,
asset_schema). Plus AssetMetadata + ExifPolicy supporting exports.
Strictly additive — every existing consumer continues to type-check.
CacheFile.version literal bumped to 2 in lockstep with cache.ts.
3. astro/src/cache.test.ts — existing version-on-disk assertion bumped
to 2 with a comment pointing at the bump discipline. Adds two new
tests: a v1 → v2 schema-migration regression that asserts v1 entries
are discarded on load (this is the actual bug), and a v1.54-field
roundtrip guard that catches accidental field stripping in
flush()/load() (the class of bug v2 prevents) by writing then reading
an AssetRef carrying blurhash_data_url + asset_schema.
4. astro/CHANGELOG.md — new "Unreleased" section above the existing
1.0.0-alpha.1 entry documenting the fix + the AssetRef widening +
the internal cache discipline doc.
223/223 astro unit tests pass; tsc build clean. Reproducer for
downstream consumers: rm -f node_modules/.run402/assetMap.json &&
npm run build, then jq '.assets[<key>] | {blurhash_data_url,
asset_schema}' dist/_assets-manifest.json populates both fields.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: astro/CHANGELOG.md
+14Lines changed: 14 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,20 @@
2
2
3
3
All notable changes to `@run402/astro`.
4
4
5
+
## Unreleased
6
+
7
+
### Fixed
8
+
9
+
-**Stale `dist/_assets-manifest.json` entries missing v1.54 AssetRef fields.** The build cache at `node_modules/.run402/assetMap.json` stores AssetRefs verbatim by source SHA; when the gateway started emitting `blurhash_data_url` + `asset_schema` (v1.54), existing caches kept returning pre-v1.54 AssetRefs on hit, silently producing manifests that looked correct (legacy fields populated) but lacked the v1.54 additions. Bumped `CACHE_SCHEMA_VERSION` from `1` to `2` so existing caches invalidate on first run after upgrade. Reproducer: `rm -f node_modules/.run402/assetMap.json && npm run build` then `jq '.assets[<key>] | {blurhash_data_url, asset_schema}' dist/_assets-manifest.json` populates both fields.
10
+
11
+
### Changed
12
+
13
+
-**`AssetRef` widened to mirror the current SDK shape.** Adds the v1.50 metadata + EXIF fields (`metadata`, `image_format`, `image_info`, `image_exif`, `image_exif_policy`) and v1.54 shape-contract fields (`blurhash_data_url`, `asset_schema`) the runtime already passed through. Plus the supporting `AssetMetadata` + `ExifPolicy` exports. Strictly additive — pre-existing consumers continue to type-check unchanged, but `as any` casts at field-access sites can now be removed.
14
+
15
+
### Internal
16
+
17
+
- New cache.ts header documents the AssetRef-field-add → cache-version-bump discipline that prevents future occurrences of this bug; `cache.test.ts` gains a v1 → v2 migration regression test and a v1.54-field roundtrip guard.
18
+
5
19
## 1.0.0-alpha.1 — unreleased
6
20
7
21
The agent-DX-locked default-export preset (Finding 5 in the design-review consultation). One-line `astro.config.mjs`:
0 commit comments