Repository navigation
Conversation
|
I hit an error while handling your request (Model unavailable on AI Gateway free tier: Free tier users do not have access to this model. Upgrade to paid credits at https://vercel.com/d?to=%2F%5Bteam%5D%2F%7E%2Fai%3Fmodal%3Dtop-up for unrestricted…). Please try again, rephrase, or reach out if it keeps failing. Error id: 92c31b27-f9c4-4ce1-a2fb-ce2e00b06d8f |
IndexedDB is origin-global and not scoped by project/scene. Sweeping every asset_data: entry missing from the just-loaded graph deleted local Files still referenced by other scenes, blank canvases, and previews. Keep only the undo-safe delayed delete when a node is removed. Fixes the orphaned-File leak from pascalorg#733 without a multi-scene wipe. Addresses review on pascalorg#854.
|
Addressed the Bugbot finding in d44b09d: removed the scene-load orphan sweep. IndexedDB is origin-global, so sweeping entries missing from the just-loaded graph could wipe assets still referenced by other scenes. Cleanup is now only the undo-safe delayed delete of a specific �sset:// File after its last live node is removed. |
The grace-period re-check only inspected the active useScene graph. Switching projects during the window could delete an origin-global IndexedDB File that another saved scene still referenced. Bump a scene epoch in applySceneGraphToEditor; timers scheduled under a previous epoch refuse to delete. Addresses review on pascalorg#854.
|
Addressed the latest Bugbot finding: delayed deletes now capture a scene epoch at schedule time. �pplySceneGraphToEditor bumps the epoch; timers from a previous epoch refuse to deleteAsset. Switching projects during the grace window no longer deletes origin-global IndexedDB Files that another saved scene still references. Covered by a new unit test. |
|
This finding is already fixed on the current HEAD (cb97731), which is ahead of the reviewed 7ae66a2.
No further code change needed for this comment. |
Aymericr
left a comment
There was a problem hiding this comment.
Blocker: cleanup is attached to two UI handlers rather than the deletion lifecycle, so the bug still reproduces through supported delete paths.
For example, packages/editor/src/hooks/use-keyboard.ts deletes a selected guide/scan directly with useScene.getState().deleteNode(...), and the generic selection/delete surfaces in selection-routing.ts and group-actions.ts also bypass scheduleLocalAssetDelete. Deleting the same local reference with the Delete key therefore still leaves its asset:// File in IndexedDB.
Please move the scheduling to a single path that observes all committed node removals/replacements, or route every supported guide/scan deletion path through one shared helper. Add a regression test for keyboard deletion (and ideally delete-mode/generic selection deletion) so this cannot remain UI-entry-point dependent. The 120-second grace period, live-reference recheck, cache revocation, and scene-epoch guard are otherwise sensible.
|
Addressed the deletion-lifecycle blocker in $(git rev-parse --short HEAD):
Grace period, live-reference recheck, cache revocation, and scene-epoch guard are unchanged. |
Aymericr
left a comment
There was a problem hiding this comment.
The central delete lifecycle now covers the missing keyboard/generic paths, but the current head still has three correctness blockers before cleanup is safe: (1) URL replacement schedules deletion without a fire-time scan of all live nodes, so undo or another node sharing the same asset:// URL can lose its File; (2) the reference-panel replacement schedules before updateNode commits, so a no-op/throw can delete the still-current asset; and (3) the scene epoch only advances in applySceneGraphToEditor, while unload/import/reset paths can replace the graph through setScene/clearScene and leave an old timer valid. Please make the timer predicate query the current graph for the URL at fire time, schedule replacements only after a committed change, and put epoch invalidation at the shared graph-replacement boundary. CI also needs the three Biome organize-import fixes shown by quality. Add regressions for shared-reference replacement, undo restoration, failed/no-op replacement, and a clear/set scene transition.
|
Addressed the three correctness blockers and Biome organizeImports on $head:
Regressions added for shared-reference replacement, undo restoration, unreferenced replacement, and setScene epoch. packages/core: 1545 tests pass. |
Aymericr
left a comment
There was a problem hiding this comment.
The new fire-time live-graph checks fix the reported undo/shared-node cases, but there is still a cross-scene data-loss blocker. asset:// storage is origin-global, and scene/project duplication preserves those URLs. If scene A and an unopened saved scene B reference the same File, deleting the last reference in the currently loaded A schedules deleteAsset; staying in A for 120 seconds means the timer sees no current reference and deletes B’s File. The epoch only protects a scene switch during the grace window, not references in persisted scenes that were never loaded. This is the same ownership problem that made the original sweep unsafe.
Please do not physically delete origin-global Files based only on the active graph. The cleanup path needs a durable cross-scene reference index/refcount (updated atomically with scene persistence), per-scene asset ownership/copying, or a conservative explicit garbage-collection pass that can inspect every saved graph. Until one of those exists, this PR trades an orphan leak for silent corruption of another project. Add a regression with two persisted scenes sharing one asset URL; deleting from one must not break the other.
|
Addressed the cross-scene data-loss blocker in No longer deletes origin-global Files from the active graph.
Orphan leak may remain until a successful full enumeration runs — that is preferred over silent corruption of another project. |
|
Fixed the two High findings on
Unit tests cover truncated list, failed list, and mid-GC live-graph growth. |
|
Addressed the mount-time GC findings on
This leaves possible orphans in IndexedDB rather than deleting Files another tab, keepalive flush, or unpersisted upload still needs. |
|
Fixed keep-set completeness on
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 276e5b0. Configure here.
|
Reviewing this against #733 — verified the fix routes local Questions while reading:
|
|
Thanks for the careful questions. The PR had changed substantially since its original description, so I corrected the title and body to match the current code.
This means the PR is groundwork for #733, not a complete automatic fix. I removed the closing |
|
@Aymericr The review threads are resolved, and the latest push fixes the live-material keep-set and makes GC abort on malformed or incomplete scene inventories. All current checks pass. Could you take another look? The PR description now states clearly that this is an explicit cleanup API and does not fully close #733. |
|
Merged current main (c5eaf51) in eb19a8f and resolved the core export conflict, preserving both the new upstream exports and the local asset APIs. I also removed leftover comments and hook dependencies from the earlier automatic-cleanup implementation. Cleanup remains explicit, with no mount/load caller. Local validation: bun install --frozen-lockfile, bun run check, all 13 check-types tasks, and all 23 focused asset storage/collection/GC tests passed. The standalone app's full lib suite also passed (59 tests). The full monorepo run is not green on Windows: unchanged upstream checks hit Windows path/POSIX-mode assumptions and a geometry golden comparison, and standalone history probes hit module resolution issues. No unrelated fixes are included here. GitHub now reports the PR as mergeable. The new CI run (quality and macOS cli-smoke) and mcp-ci run have all passed at eb19a8f. Ready for another review of the explicit-cleanup scope. |
Aymericr
left a comment
There was a problem hiding this comment.
Thanks for keeping this deliberately conservative, @Zhao0335. Leaving it as an explicit, uncalled host API is the right approach given the shared IndexedDB. The branch now conflicts with main, so please rebase. #912, which changes how assets are stored in IndexedDB, may land first, so please make sure listLocalAssetUrls and deleteAsset work with the new { assetVersion, bytes, type } records too. I'll take another look after the rebase.
|
Hey @Zhao0335, heads up: this branch has merge conflicts with main now. #1126 just landed and bumped a few dependencies in |
eb19a8f to
e804160
Compare
|
Friendly check-in @Zhao0335: is this still on your radar? It still needs the rebase onto |
e804160 to
a0adc5f
Compare

What does this PR do?
Adds conservative, explicit cleanup for local
asset://data related to #733. Core exposes deletion, enumeration, sweeping, and reference collectors; the editor host API inventories the live graph, local draft, and every persisted scene before an explicitly requested sweep. Uncertain or malformed inventories abort cleanup.The host API has no automatic caller. Hosts must ensure a complete scene inventory, no in-flight writes or uploads, and enough API rate budget. This does not fully fix #733 or delete assets when an individual node is removed.
This revision rebases the existing contribution onto
main(9f2874a95833e602b3345bb8dc9644ebe2550531), regeneratesbun.lockwith the repository's Bun 1.4.4, and aligns the editor test dependency with core'sfake-indexeddb ^6.2.6. New public-API regression tests exercise both legacyFilevalues and the proposed{ assetVersion: 1, bytes, type }records: listing sees both, deletion preserves unrelated keys, and explicit sweeping preserves referenced record payloads.How to test
bun install --frozen-lockfilewith Bun 1.4.4 and a supported Node version. The lockfile was regenerated withbun install; the pre-push frozen-lockfile dry run passed.bun test packages/core/src/lib/asset-storage.test.ts packages/core/src/lib/local-asset-lifecycle.test.ts apps/editor/lib/local-asset-gc.test.ts. All 25 tests passed, covering asset storage, nested references, inventory aborts, and the live graph re-read.bun run check-typesandbun run check. All 14 type-check/build dependency tasks passed; Biome passed with existing warnings.bun x --no-install turbo run build --filter=@pascal-app/corealso passed.Local verification used Windows, Bun 1.4.4, and Node 22.23.4. Full
bun run cistopped at localization checks that use Windows backslash paths against slash-delimited baseline keys. A separate fullbun run testattempt also failed outside the focused regression set, including doubled-drive stylesheet paths (D:\\D:\\...), CLI runtime process identity, and MCP tests. The complete suite is not claimed as locally passing. On this exact revision, GitHub Actions passed the full Linux quality job (localization, type checks, tests, and build), the macOS CLI runtime smoke, and MCP CI. Cursor Bugbot also reported no issues. See CI run and MCP CI run.The new record tests verify enumeration/deletion/sweeping, not loading the record format proposed by #912.
Screenshots / screen recording
N/A — non-visual change.
Checklist
bun devbun checkto verify)mainbranchReview questions
Note
Medium Risk
Incorrect sweeps could delete origin-shared
asset://data still referenced by other scenes; mitigation is strict null-on-uncertainty, but callers must invoke GC only under safe conditions.Reviewed by Cursor Bugbot for commit a0adc5f. Bugbot is set up for automated code reviews on this repo. Configure here.