Skip to content

Conversation

@labbott
Copy link
Contributor

@labbott labbott commented Jan 25, 2026

No description provided.

@labbott labbott marked this pull request as draft January 25, 2026 18:40
@labbott labbott force-pushed the labbott/measurement_blueprints branch from 03bf716 to e6a722e Compare January 27, 2026 21:15
@labbott labbott marked this pull request as ready for review January 27, 2026 21:15
@labbott labbott changed the title WIP: Add measurements to blueprints Add measurements to blueprints Jan 27, 2026
@labbott labbott force-pushed the labbott/measurement_blueprints branch from e6a722e to 9d27ff4 Compare January 27, 2026 21:16
We don't actually update the measuremenst right now, that
will come in follow on work.

#[derive(Queryable, Clone, Debug, Selectable, Insertable)]
#[diesel(table_name = bp_single_measurements)]
//#[diesel(check_for_backend(diesel::pg::Pg))]
Copy link
Contributor

Choose a reason for hiding this comment

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

Leftover debugging?

},
hash: *self
.image_artifact_sha256
.expect("this should always be set"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the field be non-optional (and the corresponding db row have a NOT NULL constraint)?

pub id: DbTypedUuid<MeasurementKind>,

pub image_artifact_sha256: Option<ArtifactHash>,
pub prune: bool,
Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed in chat but noting for completeness - I think we can drop the prune field since the planner has access to both the current and previous TUF repo.

}
}

impl From<BTreeSet<BlueprintSingleMeasurement>> for BlueprintMeasurements {
Copy link
Contributor

Choose a reason for hiding this comment

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

These Froms seem fine-ish but surprising - could wherever we're currently using BTreeSet<BlueprintSingleMeasurement> use BlueprintMeasurements instead?

self.measurements.insert(single);
}

// An empty measurement set here corresponds to the install dataset
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this property guaranteed? Wondering if there are edge cases where we could have an empty set of measurements but that didn't imply "use the install dataset" - maybe dev/test systems? Or if this is a surprising security-related property in the future sometime if someone assumes "empty set" means "won't be able to talk" but it actually means "falls back to whatever was most recently written to the install dataset (possibly months/years ago)".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah this is a bit of a strange edge case. I did a first pass with this being an enum like BlueprintZoneImageSource but I'm trying to remember why doing that here was ugly. It's possible I went a layer too far in getting rid of indirection. I'll play around with this more.

That said, there eventually should be no case in the future when this is empty past the initial install. As we get further along and more confident I expect we'll want to make that a stronger assertion.

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