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

#9257: fix heartbeat telemetry regression #9258

Merged
merged 3 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/types/contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,5 +271,5 @@ export type ActivatedDeployment = {
deployment: UUID;
// Use legacy names - these are passed to the server
blueprint: RegistryId;
blueprintVersion: string;
blueprintVersion: SemVerString;
};
6 changes: 6 additions & 0 deletions src/types/helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ describe("types/helpers.ts", () => {
coerce: true,
expected: "v1.2.3",
},
{
value: "0.0.0",
allowLeadingV: false,
coerce: false,
expected: "0.0.0",
},
])(
"$value with allowLeadingV: $allowLeadingV and coerce: $coerce returns $expected",
({ value, allowLeadingV, coerce, expected }) => {
Expand Down
8 changes: 0 additions & 8 deletions src/types/registryTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,11 @@ export type Metadata = {
*/
readonly name: string;

/**
* An optional human-readable description.
*/
/**
* An optional human-readable description.
*/
readonly description?: string;

/**
* The semantic version of the package.
*
* Currently optional because it defaults to the browser extension version for bricks defined in JS.
*/
/**
* The semantic version of the package.
*
Expand Down
14 changes: 9 additions & 5 deletions src/utils/deploymentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
type IntegrationDependency,
type SanitizedIntegrationConfig,
} from "@/integrations/integrationTypes";
import { validateUUID } from "@/types/helpers";
import { normalizeSemVerString, validateUUID } from "@/types/helpers";
import { type Except } from "type-fest";
import { PIXIEBRIX_INTEGRATION_ID } from "@/integrations/constants";
import getUnconfiguredComponentIntegrations from "@/integrations/util/getUnconfiguredComponentIntegrations";
Expand Down Expand Up @@ -150,11 +150,15 @@ export function selectActivatedDeployments(
return uniqBy(
modInstances
.filter((x) => x.deploymentMetadata != null)
.map((x) => ({
.map((modInstance) => ({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- Typescript not picking up filter
deployment: x.deploymentMetadata!.id,
blueprint: x.definition.metadata.id,
blueprintVersion: x.definition.metadata.id,
deployment: modInstance.deploymentMetadata!.id,
blueprint: modInstance.definition.metadata.id,
// In practice, all activated mods must have a version. But be defensive given that Metadata type used by
// ModDefinition does not currently require version.
blueprintVersion:
modInstance.definition.metadata.version ??
normalizeSemVerString("0.0.0"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: why "0.0.0" vs "1.0.0"?

It seems like we do this defaulting logic in a couple of different places so it might be worth looking into if we can make this a non-optional field upstream.

Copy link
Contributor Author

@twschiller twschiller Oct 9, 2024

Choose a reason for hiding this comment

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

nit: why "0.0.0" vs "1.0.0"?

So on the backend it's easier to see if it's defaulted or not

It seems like we do this defaulting logic in a couple of different places so it might be worth looking into if we can make this a non-optional field upstream.

I agree - see the future work ticket calling out fixing the upstream types. The change was too large to make on short turnaround

})),
(x) => x.deployment,
);
Expand Down
Loading