Skip to content

Commit 91ba789

Browse files
1lckclaude
andcommitted
test(plugins): trust the SDK end-to-end fixture workspaces in plan requests
The SDK scenarios plan builds of their own fixture workspaces, which they trust: models, tasks, tests and run preparations of the sample providers run the workspace's code, so Core now refuses them without projectCodeAllowed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 150c857 commit 91ba789

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

‎shared/plugins/sdk/e2e/plugin_sdk/mod.rs‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,12 @@ pub fn run_sample_scenario(sample: &Sample) {
457457
let mut session = Session::start(&plugin_id, runtime, &arguments, &workspace);
458458
assert_eq!(session.functions(), ["snapshot.read", "workspace.build"]);
459459

460-
// Typed build requests: Core plans them and decodes the answers.
461-
let build = |operation: &str, request: Value| {
460+
// Typed build requests: Core plans them and decodes the answers. The fixture workspace is
461+
// the test's own, so it is trusted: a plan that runs the workspace's code needs that.
462+
let build = |operation: &str, mut request: Value| {
463+
if operation.ends_with("Plan") {
464+
request["projectCodeAllowed"] = json!(true);
465+
}
462466
core(
463467
operation,
464468
json!({ "manifest": manifest, "buildSystemID": BUILD_SYSTEM, "request": request }),

‎shared/plugins/sdk/e2e/plugin_sdk/native_build.rs‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ pub fn run(sample: &Sample) {
5555
session.functions().is_empty(),
5656
"native workflows must not need private functions"
5757
);
58-
let build = |command: &str, request: Value| {
58+
// The fixture workspace is the test's own, so it is trusted: a plan that runs the
59+
// workspace's code is refused without that.
60+
let build = |command: &str, mut request: Value| {
61+
if command.ends_with("Plan") {
62+
request["projectCodeAllowed"] = json!(true);
63+
}
5964
core(
6065
command,
6166
json!({"manifest":manifest,"buildSystemID":BUILD_SYSTEM,"request":request}),
@@ -89,7 +94,7 @@ pub fn run(sample: &Sample) {
8994
);
9095
let source_plan = core(
9196
"build.modelPlan",
92-
json!({"manifest":producer,"buildSystemID":"shared-source","request":{"root":root}}),
97+
json!({"manifest":producer,"buildSystemID":"shared-source","request":{"root":root,"projectCodeAllowed":true}}),
9398
);
9499
assert_eq!(source_plan["status"], "ok", "{source_plan}");
95100
let source_reply = source_session.build_request("source-model", &source_plan["plan"]);
@@ -120,7 +125,7 @@ pub fn run(sample: &Sample) {
120125
let input_plan = core(
121126
"build.modelPlan",
122127
json!({"manifest":consumer,"buildSystemID":BUILD_SYSTEM,
123-
"request":{"root":root,"modelInputs":snapshot}}),
128+
"request":{"root":root,"modelInputs":snapshot,"projectCodeAllowed":true}}),
124129
);
125130
assert_eq!(input_plan["status"], "ok", "{input_plan}");
126131
let input_reply = session.build_request("consumer-model", &input_plan["plan"]);

0 commit comments

Comments
 (0)