Repository navigation
fix(desktop): recover corrupt connection catalog documents - #5902
nickmatteo wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
One convention violation found in apps/desktop/src/app/DesktopConnectionCatalogStore.ts: recovery of the known decode failure uses Effect.catchTag instead of Effect.catchTags.
Posted via Macroscope — Effect Service Conventions
| }); | ||
|
|
||
| const readRecoverableDocument = readDocument(fileSystem, catalogPath).pipe( | ||
| Effect.catchTag("DesktopConnectionCatalogStoreDocumentDecodeError", (decodeError) => |
There was a problem hiding this comment.
Statically known tagged failures should be recovered with Effect.catchTags({ ... }), even when only one tag is handled; Effect.catchTag isn't used in this codebase's conventions.
Consider switching to the object form:
- Effect.catchTag("DesktopConnectionCatalogStoreDocumentDecodeError", (decodeError) =>
- Effect.gen(function* () {
+ Effect.catchTags({
+ DesktopConnectionCatalogStoreDocumentDecodeError: (decodeError) =>
+ Effect.gen(function* () {and close it with }), → }, plus the matching brace for the object (the body indentation shifts one level).
Posted via Macroscope — Effect Service Conventions
|
Closing as part of the open-PR backlog sweep (wave 1). Reason: Abandoned draft; no movement since August 9 Reopen if this is still wanted and you’re willing to rebase onto current |
Fixes #4750.
A malformed outer
connection-catalog.jsondocument currently aborts the desktop catalog read before T3 Code can reach its existing missing-catalog and legacy-migration behavior. On Windows, a power-loss-corrupted document can therefore prevent the app from starting normally on every subsequent launch.The current catalog writer already writes a temporary sibling and renames it into place, so this PR intentionally does not replace or claim to introduce atomic writes. Instead, it catches only
DesktopConnectionCatalogStoreDocumentDecodeError, moves the malformed document to a unique same-directoryconnection-catalog.json.corrupt.<pid>.<uuid>sibling, logs sanitized metadata, and treats the active catalog as missing. If quarantine itself fails, recovery remains best effort and startup can still proceed.Filesystem read and permission errors, invalid encrypted payload base64, safe-storage availability failures, and decryption failures continue to surface normally and leave the active catalog untouched.
Validation:
pnpm exec vp test run apps/desktop/src/app/DesktopConnectionCatalogStore.test.ts --reporter=dot— 11 tests passedpnpm exec vp run --filter @t3tools/desktop typecheckpnpm exec vp lint apps/desktop/src/app/DesktopConnectionCatalogStore.ts apps/desktop/src/app/DesktopConnectionCatalogStore.test.ts --report-unused-disable-directivespnpm exec vp fmt --check apps/desktop/src/app/DesktopConnectionCatalogStore.ts apps/desktop/src/app/DesktopConnectionCatalogStore.test.tsgit show --check HEADBuilt with GPT-5.6-Sol through the Codex harness in T3 Code.
Note
Recover corrupt connection catalog documents by quarantining them instead of failing
DesktopConnectionCatalogStore.getencounters a corrupt (undecodable) catalog file, it now renames the file to a quarantine path (<catalog>.corrupt.<pid>.<hex32>) and returnsOption.noneinstead of propagating a decode error.Option.noneis still returned.DesktopConnectionCatalogStoreDocumentDecodeErroron corrupt catalogs will now receive an empty result, treating the catalog as missing.Macroscope summarized 4832a47.