Integrate Petri preparation removal and update admission checks

This commit is contained in:
Scott Werner 2026-10-23 10:30:54 -04:00
parent 0b38121930
commit d374ef0ec1
3 changed files with 45 additions and 36 deletions

31
Cargo.lock generated
View file

@ -5181,7 +5181,7 @@ checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
[[package]]
name = "petri-attractor-steps"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"async-trait",
"globset",
@ -5212,7 +5212,7 @@ dependencies = [
[[package]]
name = "petri-driver"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"async-trait",
"getrandom 0.3.4",
@ -5232,7 +5232,7 @@ dependencies = [
[[package]]
name = "petri-engine"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"petri-ir",
"serde",
@ -5244,7 +5244,7 @@ dependencies = [
[[package]]
name = "petri-execution"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"async-trait",
"petri-driver",
@ -5268,7 +5268,7 @@ dependencies = [
[[package]]
name = "petri-executor"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"async-trait",
"libc",
@ -5283,7 +5283,7 @@ dependencies = [
[[package]]
name = "petri-executor-sandbox"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"async-trait",
"petri-executor",
@ -5305,7 +5305,7 @@ dependencies = [
[[package]]
name = "petri-frontend"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"marked-yaml",
"petri-ir",
@ -5319,7 +5319,7 @@ dependencies = [
[[package]]
name = "petri-frontend-attractor"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"minijinja",
"petri-frontend",
@ -5336,7 +5336,7 @@ dependencies = [
[[package]]
name = "petri-frontend-fabro"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"petri-frontend",
"petri-frontend-attractor",
@ -5344,7 +5344,6 @@ dependencies = [
"regex",
"serde",
"serde_json",
"shlex",
"smol_str",
"toml 0.9.12+spec-1.1.0",
]
@ -5352,7 +5351,7 @@ dependencies = [
[[package]]
name = "petri-frontend-native"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"petri-frontend",
"petri-ir",
@ -5363,7 +5362,7 @@ dependencies = [
[[package]]
name = "petri-ir"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"regex",
"serde",
@ -5376,7 +5375,7 @@ dependencies = [
[[package]]
name = "petri-runtime"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"async-trait",
"petri-driver",
@ -5397,7 +5396,7 @@ dependencies = [
[[package]]
name = "petri-steps"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"async-trait",
"petri-executor",
@ -5413,7 +5412,7 @@ dependencies = [
[[package]]
name = "petri-store"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"async-trait",
"getrandom 0.3.4",
@ -5428,7 +5427,7 @@ dependencies = [
[[package]]
name = "petri-testkit"
version = "0.1.0"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#e34d60586a92719ba02a4f1a6c85a723d6376406"
source = "git+https://github.com/lithoscomputer/petri.git?branch=main#cfd57a52245e54b702d60321d94144800fdd92c2"
dependencies = [
"async-trait",
"petri-driver",

View file

@ -137,10 +137,6 @@ fn inspect_resolves_selector_via_server_endpoint() {
"git": {
"author": null
},
"prepare": {
"steps": [],
"timeout_ms": 300000
},
"execution": {
"mode": "normal",
"approval": "prompt"

View file

@ -486,12 +486,22 @@ async fn dry_run_admission_makes_nested_scopes_local_and_preserves_graph_digests
/// Keep this at the actual embedded frontend boundary: rejecting the key in
/// Fabro's config parser alone would still admit a stored old workflow version.
#[test]
fn removed_preparation_is_rejected_by_the_embedded_frontend_in_every_layer() {
fn invalid_settings_are_rejected_by_the_embedded_frontend_in_every_layer() {
for source in ["workflow.toml", ".fabro/project.toml", "settings.toml"] {
for syntax in [
"[run.prepare]",
"[run.prepare]\nsteps = []",
"run.prepare = false",
for (syntax, code) in [
("[run.prepare]", "unsupported.workflow_toml.run.prepare"),
(
"[run.prepare]\nsteps = []",
"unsupported.workflow_toml.run.prepare",
),
(
"run.prepare = false",
"unsupported.workflow_toml.run.prepare",
),
(
"run.prepare = 'private-value' broken",
"fabro.settings.toml",
),
] {
let mut request = request(
bundle(&[
@ -509,20 +519,24 @@ fn removed_preparation_is_rejected_by_the_embedded_frontend_in_every_layer() {
}
let error = check::check(&request)
.err()
.expect("removed preparation must not admit");
.expect("invalid settings must not admit");
let CheckError::Rejected(diagnostics) = error else {
panic!("expected admission diagnostics")
};
assert!(
diagnostics.iter().any(|diagnostic| {
diagnostic.code == "unsupported.workflow_toml.run.prepare"
&& diagnostic
.hint
.as_deref()
.is_some_and(|hint| hint.contains("command"))
}),
"{diagnostics:?}"
);
let diagnostic = diagnostics
.iter()
.find(|diagnostic| diagnostic.code == code)
.expect("the embedded frontend preserves the specific diagnostic");
assert!(diagnostic.message.contains(source));
assert!(!format!("{diagnostics:?}").contains("private-value"));
if code == "unsupported.workflow_toml.run.prepare" {
assert!(
diagnostic
.hint
.as_deref()
.is_some_and(|hint| hint.contains("command"))
);
}
}
}
}