Skip to content

[CRE-1299] - support white listed requests#113

Open
gallone2000 wants to merge 1 commit into
masterfrom
alessandro_cre_1299_support_white_listed_requests
Open

[CRE-1299] - support white listed requests#113
gallone2000 wants to merge 1 commit into
masterfrom
alessandro_cre_1299_support_white_listed_requests

Conversation

@gallone2000

Copy link
Copy Markdown

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR exposes per-submission strategic metadata end-to-end so that “white listed requests” (likely keyed off strategic metadata) can be represented on the Submission object and surfaced through the Python bindings.

Changes:

  • Added strategic_metadata: Option<StrategicMetadataMap> to the core Rust Submission type and initialized it in constructors.
  • Updated submission DB reads (get_submission, submission_status) to fetch strategic metadata via submissions_metadata (using json_group_object) and normalize empty metadata to None.
  • Extended the opsqueue_python Submission binding to include strategic_metadata and include it in __repr__.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
opsqueue/src/common/submission.rs Adds strategic_metadata to Submission and populates it from DB queries via submissions_metadata aggregation.
libs/opsqueue_python/src/common.rs Surfaces strategic_metadata in the Python Submission wrapper and updates its __repr__.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread opsqueue/src/common/submission.rs
Comment thread opsqueue/src/common/submission.rs Outdated
Comment on lines +281 to +285
fn normalize_strategic_metadata(
strategic_metadata: Option<sqlx::types::Json<StrategicMetadataMap>>,
) -> Option<StrategicMetadataMap> {
strategic_metadata.and_then(|json| (!json.0.is_empty()).then_some(json.0))
}
Comment thread opsqueue/src/common/submission.rs Outdated
@gallone2000 gallone2000 force-pushed the alessandro_cre_1299_support_white_listed_requests branch from b8151e3 to f5bed41 Compare June 23, 2026 13:50
@gallone2000 gallone2000 force-pushed the alessandro_cre_1299_support_white_listed_requests branch from f5bed41 to 5692b0c Compare June 23, 2026 13:59
@gallone2000 gallone2000 self-assigned this Jun 23, 2026
@gallone2000 gallone2000 requested a review from ReinierMaas June 23, 2026 14:11
@gallone2000 gallone2000 marked this pull request as ready for review June 23, 2026 14:12

@ReinierMaas ReinierMaas left a comment

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.

LGTM! I have two optional extensions, one is removing the type level distinction that doesn't actually exist. I think that would make the whole API easier to use and understand!

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 like to point out that for the other queries we also assert the query plan. This allows us to spot potentially very bad execution behaviour. Could you add that for these queries?

.expect("insertion failed");

let fetched_submission = get_submission(submission.id, &mut conn).await.unwrap();
// When fetched from DB with no metadata rows, json_group_object returns '{}'.

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.

Ah so there is no distinction between Option<StrategicMetadataMap> and StrategicMetadataMap on the reader side?


Reading a bit further indeed shows to me that we can also remove the Option from the type to make this clear, this is also the type contract on InsertSubmission. Only the outer function insert_submission_chunks accepts the Option<StrategicMetadataMap> but it is unwrap_or_default into an empty map there.

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