Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update overall status computed field #1629

Merged
merged 1 commit into from
May 20, 2024
Merged

Conversation

JSReds
Copy link
Contributor

@JSReds JSReds commented May 9, 2024

@JSReds JSReds self-assigned this May 9, 2024
@JSReds JSReds force-pushed the jsreds/update-overall-status branch 2 times, most recently from fa4d04f to a014b6f Compare May 13, 2024 16:22
@JSReds JSReds force-pushed the jsreds/update-overall-status branch 5 times, most recently from 3cd6a06 to 090e21a Compare May 16, 2024 15:34
@JSReds JSReds requested review from thgreasi and fisehara May 16, 2024 15:34
@JSReds JSReds force-pushed the jsreds/update-overall-status branch 3 times, most recently from b108b8e to 37c506a Compare May 16, 2024 17:37
@JSReds JSReds marked this pull request as ready for review May 17, 2024 10:58
Comment on lines 105 to 124
'When',
[
'Or',
[
'In',
['ReferencedField', 'device', 'status'],
['EmbeddedText', 'Ordered'],
['EmbeddedText', 'Preparing'],
],
[
'And',
['Not', ['ReferencedField', 'device', 'is online']],
[
'Equals',
['ReferencedField', 'device', 'status'],
['EmbeddedText', 'Shipped'],
],
],
],
['ToLower', ['ReferencedField', 'device', 'status']],
Copy link
Member

Choose a reason for hiding this comment

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

Should we also drop these non-used & already dropped HoD states, rather re-adding them?

['EmbeddedText', 'Post-Provisioning'],
];
// This check does not double check heartbeat state as it is already checked from isOverallOffline which runs before
export const hasPartialConnectivity: OrNode = [
Copy link
Member

@thgreasi thgreasi May 20, 2024

Choose a reason for hiding this comment

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

How about v so that vpn disabled&off & heartbeat timeout gives reduced-functionality?

-- In an ideal world:
partial = CASE
	WHEN vpn disabled
	THEN heartbeat = timeout
	ELSE (vpn on & heartbeat != online) || (vpn off & heartbeat = online,timeout)

=>

partial = CASE
	WHEN heartbeat = timeout THEN True
	ELSE (vpn enabled && vpn on & heartbeat IN offline)
		|| (vpn off & heartbeat = online && vpn enabled)

approximately => (so that we push `vpn enabled` later and reduce the cases that it needs to be checked)

partial = CASE
	WHEN heartbeat = timeout THEN True
	ELSE (vpn on & heartbeat IN offline)
		|| (vpn off & heartbeat = online && vpn enabled)

=>

partial =
	|| heartbeat = timeout
	|| (vpn on & heartbeat IN offline/unknown)
	|| (vpn off & heartbeat = online && vpn enabled)

=>

partial =
	|| heartbeat = timeout
	|| (vpn on & heartbeat != online)
	|| (vpn off & heartbeat = online && vpn enabled)

@flowzone-app flowzone-app bot enabled auto-merge May 20, 2024 11:43
@@ -55,12 +56,69 @@ export const isPostProvisioning: EqualsNode = [
['ReferencedField', 'device', 'provisioning state'],
['EmbeddedText', 'Post-Provisioning'],
];

const VPNConfigEnabled: NotEqualsNode = [
Copy link
Member

@thgreasi thgreasi May 20, 2024

Choose a reason for hiding this comment

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

How about?

Suggested change
const VPNConfigEnabled: NotEqualsNode = [
const isVpnEnabled: NotEqualsNode = [

Comment on lines +209 to +212
'In',
['ReferencedField', 'device', 'api heartbeat state'],
['EmbeddedText', 'online'],
['EmbeddedText', 'timeout'],
Copy link
Member

@thgreasi thgreasi May 20, 2024

Choose a reason for hiding this comment

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

Not a blocker: Should we add the same check in the overall_progress (and add a v6 translation)?
I kind of can see the use case of showing a progress bar in a reduced-functionality device... so just checking whether this was discussed.

We would effectively just need to change

			[
				'When',
				[
						'NotIn',
						['ReferencedField', 'device', 'api heartbeat state'],
						['EmbeddedText', 'online'],
						['EmbeddedText', 'timeout'],
				],
				// Otherwise if the device is offline but has previously been online we return no info
				['Null'],
			],

to

			[
				'When',
				isOverallOffline,
				// Otherwise if the device is offline but has previously been online we return no info
				['Null'],
			],

Not a blocker though, since we can change it later.

@JSReds JSReds force-pushed the jsreds/update-overall-status branch from acc0816 to b5a2656 Compare May 20, 2024 13:59
@JSReds JSReds marked this pull request as draft May 20, 2024 13:59
auto-merge was automatically disabled May 20, 2024 13:59

Pull request was converted to draft

Copy link
Member

@thgreasi thgreasi left a comment

Choose a reason for hiding this comment

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

Lets also change the commit message to something that makes clear that this only about /resin and doesn't affect v6
"Update the overall_status computed field in the unversioned model" or
"Update the overall_status computed field in the resin model" or
"Update the overall_status computed field for the future v7 model"

restTitle: string,
deviceName: string,
) => {
it(`should have "${overallStatus}" ${restTitle}`, async () => {
Copy link
Member

@thgreasi thgreasi May 20, 2024

Choose a reason for hiding this comment

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

Suggested change
it(`should have "${overallStatus}" ${restTitle}`, async () => {
it(`should have overall_status = "${overallStatus}" ${restTitle}`, async () => {

or

Suggested change
it(`should have "${overallStatus}" ${restTitle}`, async () => {
it(`should have an overall_status of "${overallStatus}" ${restTitle}`, async () => {

@JSReds JSReds force-pushed the jsreds/update-overall-status branch from b5a2656 to 3f8ab5c Compare May 20, 2024 15:22
@JSReds JSReds marked this pull request as ready for review May 20, 2024 15:37
@JSReds JSReds merged commit 8d191ab into master May 20, 2024
46 checks passed
@JSReds JSReds deleted the jsreds/update-overall-status branch May 20, 2024 15:37
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.

None yet

2 participants