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 2 times, most recently 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!

Comment thread opsqueue/src/common/submission.rs
Comment thread opsqueue/src/common/submission.rs
@gallone2000 gallone2000 requested a review from ReinierMaas June 26, 2026 11:22

@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.

I require a few more changes.

Comment thread opsqueue/src/common/.submission.rs.pending-snap Outdated
Comment thread opsqueue/src/common/submission.rs Outdated
Comment thread opsqueue/src/common/submission.rs Outdated
@gallone2000 gallone2000 force-pushed the alessandro_cre_1299_support_white_listed_requests branch from 8088491 to f92a05b Compare July 2, 2026 11:51
@gallone2000 gallone2000 force-pushed the alessandro_cre_1299_support_white_listed_requests branch from f92a05b to 2ae6046 Compare July 2, 2026 12:00
@gallone2000 gallone2000 requested a review from ReinierMaas July 2, 2026 12:09

@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 small remaining notes but nothing blocking the merge.

Comment on lines +1222 to +1226
// When fetched from DB with no metadata rows, json_group_object returns '{}'.
let submission = Submission {
strategic_metadata: Default::default(),
..submission
};

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.

The submission now always carries the strategic_metadata and it is by default the default so this should be unnecessary.

Comment on lines -480 to +501
match submission {
match submission_row {
None => Err(E::R(SubmissionNotFound(id))),
Some(submission) => Ok(submission),
Some(row) => Ok(Submission {
id: row.id,
prefix: row.prefix,
chunks_total: row.chunks_total,
chunks_done: row.chunks_done,
chunk_size: row.chunk_size,
metadata: row.metadata,
strategic_metadata: row.strategic_metadata.0,
otel_trace_carrier: row.otel_trace_carrier,
}),

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.

Can we now with the AS "strategic_metadata!: sqlx::types::Json<StrategicMetadataMap>" switch back to the shorter query_as! without the manual mapping? Or is the row.strategic_metadata.0 the only syntax that prevents us from doing so?

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