Skip to content

Bump @balena/compose to 7.3.0 - #3041

Open
cywang117 wants to merge 2 commits into
masterfrom
update-compose-7.3.0
Open

Bump @balena/compose to 7.3.0#3041
cywang117 wants to merge 2 commits into
masterfrom
update-compose-7.3.0

Conversation

@cywang117

Copy link
Copy Markdown
Contributor

This bump adds support for io.balena.requires.sw.linux and io.balena.requires.sw.balena-os container contract labels.

compose v7.0.12 removed ImageModel and ReleaseModel typings in favor of getting them from balena-sdk, so this bump necessitates changing some type sourcing from compose to SDK as well.

Change-type: patch

@cywang117
cywang117 force-pushed the update-compose-7.3.0 branch 7 times, most recently from b1798ab to 57571c7 Compare January 5, 2026 22:38
compose v7.0.12 removed ImageModel and ReleaseModel typings in favor
of getting them from balena-sdk, so this bump necessitates changing
some type sourcing from compose to SDK as well.

Change-type: patch
Signed-off-by: Christina Ying Wang <christina@balena.io>
Signed-off-by: Christina Ying Wang <christina@balena.io>
@cywang117
cywang117 force-pushed the update-compose-7.3.0 branch from 57571c7 to 97bf269 Compare January 5, 2026 23:04
Comment on lines +42 to +45
type ServiceImage = Omit<
BalenaModel['image']['Read'],
'created_at' | 'is_a_build_of__service'
>;

@cywang117 cywang117 Jan 5, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

See Release.serviceImages below which omitted these two props from the image model. I'm unclear as to the reason but I assume the properties are set by the backend (computed properties?)

@flowzone-app
flowzone-app Bot enabled auto-merge January 5, 2026 23:41
type: string;
[key: string]: any;
};

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

{ [key: string]: JSON } | JSON[] has never been the valid type for a contract from what I could find. Even the release contract field generated from balena.yml is the type as specified above. For example, tested on a device:

contract: {
  description: "Test app for Intel NUC",
  name: "NUCTest",
  type: "sw.application",
  version: "1.0.0",
  data: {...}
}

Where is the { [key: string]: JSON } | JSON[] type being derived from?

Comment thread src/utils/compose.ts
if ('is_a_build_of__service' in serviceImage) {
delete serviceImage.is_a_build_of__service;
// is_a_build_of__service is not an optional field in the SDK, but we need to delete it
serviceImage.is_a_build_of__service = undefined as any;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As mentioned above, these two fields are omitted in the ServiceImage type, unsure of reason but assuming that they're API-computed fields. However, this type error is due to balena-compose's releaseMod.create function returning the wrong type, so we should fix it there, then consider removing these deletes.

Comment thread src/utils/compose_ts.ts
Comment on lines -1333 to +1343
serviceImage.dockerfile = props.dockerfile;
serviceImage.project_type = props.projectType;
serviceImage.dockerfile = props.dockerfile ?? null;
serviceImage.project_type = props.projectType ?? null;
if (props.startTime) {
serviceImage.start_timestamp = props.startTime;
serviceImage.start_timestamp = props.startTime.toISOString();
}
if (props.endTime) {
serviceImage.end_timestamp = props.endTime;
serviceImage.end_timestamp = props.endTime.toISOString();
}
serviceImage.push_timestamp = new Date();
serviceImage.push_timestamp = new Date().toISOString();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

According to Balena Model in SDK, these timestamps are string format, and when querying a release using the SDK, they are returned in ISO time format. SBVR types categorizes date as any of the following:

import * as TypeUtils from '../type-utils';
export declare const types: {
    postgres: string;
    mysql: string;
    websql: string;
    odata: {
        name: string;
    };
};
export type Types = TypeUtils.TsTypes<string, string | number | Date>;
type DbWriteType = Date;
export declare const fetchProcessing: TypeUtils.FetchProcessing<Types['Read']>;
export declare const nativeFactTypes: TypeUtils.NativeFactTypes;
export declare const validate: TypeUtils.Validate<Types['Write'], DbWriteType>;
export {};

...so setting timestamps to ISO string should be ok for creating a service image, and if so, the toISOString conversion is just to align with the stricter SDK types. However, these timestamps were also okay before as raw JS Date objects. Correct or no?

Comment thread src/utils/compose_ts.ts
);
if (skipLogUpload) {
delete serviceImage.build_log;
serviceImage.build_log = null;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

build_log is non-optional but can be set to null

@cywang117

Copy link
Copy Markdown
Contributor Author

Waiting on #2997

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.

1 participant