Skip to content

Conversation

@egalvis27
Copy link

@egalvis27 egalvis27 commented Jan 29, 2026

What is Changed / Added


  • Improved error handling
  • Fixed issue when creating a device in a new account

Why

attributes: { endpoint: '/backup/v2/devices' },
});
return left(error);
return { error: error };

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Non blocking] You don't really need to write error twice. You can use this eslint rule to show a warning: https://eslint.org/docs/latest/rules/object-shorthand

export type FetchDeviceProps = { deviceIdentifier: DeviceIdentifierDTO } | { uuid: string } | { legacyId: string };

async function getDeviceByProps(props: FetchDeviceProps): Promise<Either<Error, Device | null>> {
async function getDeviceByProps(props: FetchDeviceProps) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Non blocking] Just to give some information. We found that maybe this is no longer necessary since this is just a backup to recover to the device identifier of the user in case the app is uninstalled. However, the backup paths are lost anyway, so this doesn't provide a solution.


const legacyId = configStore.get('deviceId');
const savedUUID = configStore.get('deviceUUID');
logger.debug({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't these logs useful to track if the device is migrated or in linux are we logging already the requests so we can see the that?


const device = createNewDeviceEither.getRight();
const user = DependencyInjectionUserProvider.get();
user.backupsBucket = device.bucket;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically backupsBucket is always defined so we shouldn't do this anymore. We had the same code on windows and we deleted it. Check if that's true and you can simplify this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ran some tests and confirmed that the backupsBucket does not exist for new users until they create their first device, so this line is still necessary.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh shit, then we have a bug on windows. Thanks for the info :)

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
10.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@egalvis27 egalvis27 merged commit 3b31c7d into main Feb 2, 2026
8 of 9 checks passed
@egalvis27 egalvis27 deleted the refactor/backups-device-module branch February 2, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants