fix(desktop): treat an undecryptable connection catalog as empty instead of crashing environment discovery#4454
fix(desktop): treat an undecryptable connection catalog as empty instead of crashing environment discovery#4454bwmp wants to merge 2 commits into
Conversation
…ead of crashing environment discovery
|
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:
✨ Finishing Touches🧪 Generate unit tests (beta)
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.
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.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e482464. Configure here.
| Effect.catch(treatAsUnreadableCatalog), | ||
| ); | ||
| return Option.some(decrypted); | ||
| return decrypted; |
There was a problem hiding this comment.
Recoverable catalog can be overwritten
High Severity
The get method now returns Option.none() for both missing and undecryptable catalogs, making them indistinguishable. This ambiguity causes subsequent set operations, such as automatic credential persistence, to overwrite the existing encrypted catalog, destroying data intended for recovery.
Reviewed by Cursor Bugbot for commit e482464. Configure here.
ApprovabilityVerdict: Needs human review An unresolved high-severity review comment identifies potential data loss: undecryptable catalogs returning Option.none() could be overwritten by subsequent set operations, destroying recoverable data. This concern requires human evaluation. You can customize Macroscope's approvability policy. Learn more. |


This doesnt need to be merged but implementing your own fix to this would be appreciated since this issue caused my entire t3 code to be unusable no matter what
What Changed
DesktopConnectionCatalogStore.get()now treats an undecryptable or corruptconnection-catalog.jsonas an empty catalog (logs a warning, returnsOption.none()) instead of propagating the failure. The file is left on disk untouched, so if the underlying issue resolves, a later read can still recover the original data.Why
EnvironmentRegistry.makereads this store synchronously during its own construction. A decrypt failure — e.g. a stale OS-level encryption key after a Windows credential/profile change — previously threw all the way up through that construction, silently breaking the entire connection/environment registry with no console-visible error. This took down the local primary environment too, even though it doesn't depend on this file at all, and looked to the user like "the app just doesn't load projects" with nothing indicating why.Checklist
Note
Low Risk
Localized read-path behavior change with logging; malformed outer documents and filesystem errors still fail as before.
Overview
DesktopConnectionCatalogStore.get()no longer fails whenconnection-catalog.jsonexists but its encrypted payload cannot be decoded or decrypted (corrupt data, stale OS key after a Windows credential/profile change, etc.). Those cases now log a warning and returnOption.none()as if the catalog were empty.The file is left on disk so data can be recovered once decryption works again. This avoids breaking
EnvironmentRegistryconstruction and local environment discovery when remote-connection catalog data is unreadable but the local primary environment does not depend on that file.Tests were updated to expect empty-catalog behavior and to assert recovery after decrypt succeeds again.
Reviewed by Cursor Bugbot for commit e482464. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Fix
DesktopConnectionCatalogStore.getto return empty catalog on decryption failure instead of crashingPreviously, decryption or decode failures in
DesktopConnectionCatalogStore.getpropagated errors that crashed environment discovery. Now, any failure returnsOption.noneand logs a warning, leaving the catalog file on disk intact. If decryption is later restored (e.g. after a keychain fix), the catalog is recoverable.Macroscope summarized e482464.