Merge remote-tracking branch 'origin/develop' into work/t-533-plugin-worker-composed
# Conflicts: # crates/server-api/src/lib.rs # crates/server-api/src/plugin.rs # crates/server-api/src/plugin_types.rs # crates/worker-runtime/Cargo.toml # crates/worker-runtime/src/workspace_request/plugin_delivery.rs # crates/workspace-server/Cargo.toml # crates/workspace-server/src/lib.rs # crates/workspace-server/src/server.rs # crates/workspace-server/src/server/tests/subject_authorization_tests.rs # crates/workspace-server/src/server_plugin_delivery.rs # crates/workspace-server/src/server_plugin_delivery_tests.rs # openapi/server-api.json # web/workspace/src/lib/generated/companion-api.ts # web/workspace/src/lib/generated/plugin-api.ts # web/workspace/src/lib/generated/repository-api.ts # web/workspace/src/lib/generated/runtime-api.ts # web/workspace/src/lib/generated/ticket-api.ts # web/workspace/src/lib/generated/workdir-api.ts # web/workspace/src/lib/generated/worker-launch-api.ts
This commit is contained in:
@@ -408,6 +408,9 @@ pub enum WorkerInputKind {
|
||||
pub struct WorkerInput {
|
||||
pub kind: WorkerInputKind,
|
||||
pub content: String,
|
||||
/// Provenance stamped by the authenticated Backend, never by public/model input.
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub source: Option<protocol::AuthenticatedInputSource>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub submission_request_id: Option<String>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
@@ -1624,6 +1627,30 @@ pub const REMAINING_RUNTIME_ROUTES: &[RemainingRuntimeRoute] = &[
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn trusted_notify_source_round_trips_and_omitted_source_defaults_to_none() {
|
||||
let mut value = serde_json::json!({
|
||||
"kind": "notify", "content": "message", "submission_request_id": "stable-id"
|
||||
});
|
||||
let legacy: WorkerInput = serde_json::from_value(value.clone()).unwrap();
|
||||
assert!(legacy.source.is_none());
|
||||
assert_eq!(serde_json::to_value(legacy).unwrap(), value);
|
||||
for source in [
|
||||
protocol::AuthenticatedInputSource::Account {
|
||||
account_id: "account-a".into(),
|
||||
},
|
||||
protocol::AuthenticatedInputSource::Worker {
|
||||
runtime_id: "runtime-a".into(),
|
||||
worker_id: "worker-a".into(),
|
||||
},
|
||||
] {
|
||||
value["source"] = serde_json::to_value(&source).unwrap();
|
||||
let input: WorkerInput = serde_json::from_value(value.clone()).unwrap();
|
||||
assert_eq!(input.source, Some(source));
|
||||
assert_eq!(serde_json::to_value(input).unwrap(), value);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn backend_job_journal_grant_defaults_off_and_does_not_enable_memory_grant() {
|
||||
let legacy = serde_json::json!({"job_id":"job", "attempt_id":"attempt", "subjektiv_consolidation":true});
|
||||
|
||||
Reference in New Issue
Block a user