Skip to content

feat: add metadata field to .workspace.json#238

Merged
vytautas-astrauskas-sensmetry merged 5 commits intomainfrom
feat/workspace-metadata
Mar 20, 2026
Merged

feat: add metadata field to .workspace.json#238
vytautas-astrauskas-sensmetry merged 5 commits intomainfrom
feat/workspace-metadata

Conversation

@vytautas-astrauskas-sensmetry
Copy link
Collaborator

The time is coming when the new version of SysML standard libraries will have to be released. Since the release will have breaking changes in the metamodel, we need to ensure that the metamodel field is properly set so that tools know what they are loading. This PR adds a metamodel field to .workspace.json to enable Pilot CI to build .kpars with the updated metamodel field.

Note: the workspaces are still an experimental feature and we are still keeping the right to completely rewrite it in non-backward compatible ways or even to remove it.

Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
Comment on lines +43 to +44
in the workspace. When set, individual projects must **not** also set
`metamodel` in their `.meta.json` — doing so will produce an error.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if at some point other tools might start generating/editing .meta.json files on their own. Could be a good idea to just demand that the metamodels are the same.

Not urgent though, feel free to ignore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed in c17f0f2


let mut result = Vec::new();
for project in workspace.projects() {
for project_info in workspace.projects() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should name this project_root, it's not a path of .project.json.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or project_path

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed in 99ac527

Comment on lines +42 to +44
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(default)]
pub meta: Option<WorkspaceMetaG<Iri>>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why have #[serde(default)] here? AFAIK serde defaults Option to None anyway if the field is missing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed in 99ac527

Comment on lines +338 to +348
if let Some(ws_mm) = ws_metamodel {
let project_meta = project.get_meta().map_err(KParBuildError::ProjectRead)?;
if let Some(meta) = &project_meta
&& meta.metamodel.is_some()
{
return Err(KParBuildError::WorkspaceMetamodelConflict {
workspace_metamodel: ws_mm.to_string(),
project_path: project_info.path.clone(),
});
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Move this check into do_build_kpar_inner, where meta is available.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed in d5bac73

Copy link
Collaborator

@andrius-puksta-sensmetry andrius-puksta-sensmetry left a comment

Choose a reason for hiding this comment

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

Aside from the nits above, this looks good.

@andrius-puksta-sensmetry
Copy link
Collaborator

In the near future it would be nice to merge .workspace.json into workspace-level sysand.toml, since workspaces are highly unlikely to make it into the standard, and doing so would reduce metadata files from 4 to 3 (which is still too many).

Comment on lines +297 to +305
if let Some(ws_metamodel) = workspace_metamodel
&& meta.metamodel.is_none()
{
meta.metamodel = Some(ws_metamodel.to_string());
use crate::project::ProjectMut;
local_project
.put_meta(&meta, true)
.map_err(KParBuildError::from)?;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Merge this with the conflict check, this will also eliminate redundant metamodel.is_none().

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Changed in d5bac73

Co-authored-by: Andrius Pukšta <andrius.puksta@sensmetry.com>
Signed-off-by: vytautas-astrauskas-sensmetry <vytautas.astrauskas@sensmetry.com>
…ta and workspace

Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
@vytautas-astrauskas-sensmetry vytautas-astrauskas-sensmetry merged commit 1de2c4f into main Mar 20, 2026
72 of 74 checks passed
@vytautas-astrauskas-sensmetry vytautas-astrauskas-sensmetry deleted the feat/workspace-metadata branch March 20, 2026 16:42
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.

3 participants