fix: repair two post-merge Full Suite failures

The non-blocking Full Suite tier on main was red on shards 2 and 4:

- roadmap-store schema assertion lagged core's SCHEMA_VERSION bump to 117
  (landed in FN-6277), so it still expected 116.
- useCeSessions "cancel surfaces a transport error" failed deterministically:
  a session with an in-flight status keeps the poll fallback running, and a
  successful background list refresh called setError(undefined), wiping the
  cancel error before it could be observed. Background refreshes (poll + push)
  now leave action errors intact; only user-initiated/initial refreshes clear.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-06-14 15:56:26 -07:00
parent f7635faf37
commit 62335f8814
3 changed files with 29 additions and 16 deletions

View File

@@ -0,0 +1,5 @@
---
"@runfusion/fusion": patch
---
Fix two post-merge Full Suite test failures. Sync the roadmap store's schema-version assertion to core's `SCHEMA_VERSION` (116 → 117). Stop `useCeSessions` background refreshes (poll fallback and push events) from clearing an error a `cancel`/`remove` just surfaced — an in-flight session kept the poll running, which silently erased the action error before the user could see it.

View File

@@ -77,19 +77,27 @@ export function useCeSessions(options: UseCeSessionsOptions = {}): UseCeSessions
};
}, []);
const refresh = useCallback(async () => {
try {
const next = await transport.list(projectId);
if (mounted.current) {
setSessions(next);
setError(undefined);
// clearErrorOnSuccess: a user-initiated refresh (or the initial fetch) clears
// any prior error on success. Background refreshes (poll fallback, push
// events) pass false so a successful list fetch doesn't silently erase an
// error a cancel/remove just surfaced — an in-flight session keeps the poll
// running, which would otherwise wipe the action error before the user sees it.
const refresh = useCallback(
async (clearErrorOnSuccess = true) => {
try {
const next = await transport.list(projectId);
if (mounted.current) {
setSessions(next);
if (clearErrorOnSuccess) setError(undefined);
}
} catch (err) {
if (mounted.current) setError(err instanceof Error ? err.message : String(err));
} finally {
if (mounted.current) setLoading(false);
}
} catch (err) {
if (mounted.current) setError(err instanceof Error ? err.message : String(err));
} finally {
if (mounted.current) setLoading(false);
}
}, [transport, projectId]);
},
[transport, projectId],
);
// Initial fetch (and on project switch).
useEffect(() => {
@@ -102,7 +110,7 @@ export function useCeSessions(options: UseCeSessionsOptions = {}): UseCeSessions
useEffect(() => {
if (!enabled || !subscribe) return;
return subscribe(() => {
void refresh();
void refresh(false);
});
}, [enabled, subscribe, refresh]);
@@ -111,7 +119,7 @@ export function useCeSessions(options: UseCeSessionsOptions = {}): UseCeSessions
useEffect(() => {
if (!enabled || !anyInFlight) return;
const timer = setInterval(() => {
void refresh();
void refresh(false);
}, pollIntervalMs);
return () => clearInterval(timer);
}, [enabled, anyInFlight, pollIntervalMs, refresh]);

View File

@@ -743,10 +743,10 @@ describe("RoadmapStore", () => {
});
describe("schema version", () => {
it("schema version is 116 after init", () => {
it("schema version is 117 after init", () => {
// Tracks @fusion/core's SCHEMA_VERSION (the roadmap store layers on core's
// Database). Bump this in lockstep when core adds a migration.
expect(db.getSchemaVersion()).toBe(116);
expect(db.getSchemaVersion()).toBe(117);
});
});