Skip to content

✨ Add versioning to election event configs#1855

Merged
BelSequent merged 9 commits into
mainfrom
feat/meta-6333A/main
Feb 13, 2026
Merged

✨ Add versioning to election event configs#1855
BelSequent merged 9 commits into
mainfrom
feat/meta-6333A/main

Conversation

@omri81
Copy link
Copy Markdown
Contributor

@omri81 omri81 commented May 29, 2025

omri81 added 2 commits May 29, 2025 10:12
the version is being added at export level from .env file and is being checked at import.
if system is in dev version not need to compare.
Copy link
Copy Markdown
Contributor

@xalsina-sequent xalsina-sequent left a comment

Choose a reason for hiding this comment

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

Please review the comments and also add the formatting of the resulting json

@@ -102,6 +102,7 @@ pub struct ImportElectionEventSchema {
pub reports: Vec<Report>,
pub keys_ceremonies: Option<Vec<KeysCeremony>>,
pub applications: Option<Vec<Application>>,
pub version: String,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This could make older election events import fails if version is not present. We could either add a default value to version or make the parameter optional for backwards compatibilit.

@@ -445,13 +399,54 @@ pub async fn decrypt_document(
Ok(temp_file_path)
}

fn extract_major(version: &str) -> Option<u32> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This could give an error if the version string includes a 'v' character like v1.0.0.

@BelSequent BelSequent self-requested a review December 5, 2025 14:38
);

// If current version is "dev", allow any import
if current_version == "dev" {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would suggest to create a const &str for "dev", e.g. APP_VERSION_DEV and use it to replace all the ocurrences with "dev" in rust.

major_str.parse::<u64>().ok()
}

fn check_version_compatibility(imported_version: &str, current_version: &str) -> Result<()> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I would love to see unit tests for this fn and fn extract_major

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There could be a negative test to showcase when extract_major would return None because parse:: returns error. The AI can generate this quickly.
Also, if we follow a specific version convention defined somewhere (do we?) we should match this implementation to that.

@BelSequent BelSequent merged commit 2a342a8 into main Feb 13, 2026
16 of 18 checks passed
@BelSequent BelSequent deleted the feat/meta-6333A/main branch February 13, 2026 11:17
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