Skip to content

Commit beac442

Browse files
synthesis: add metrics snapshot secret examples
1 parent 91dfef3 commit beac442

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

rust/modality/src/cmds/synthesize.rs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,8 @@ const FORMULA_EXAMPLE_GROUPS: &[FormulaExampleGroup] = &[
515515
r#"always([+PURGE_CRASH_DUMPS] true -> eventually(<+NOTIFY_RUNTIME_OWNER> true))"#,
516516
r#"always([+TRACE_EXPORT_SECRET_LEAKED] true -> (<+PURGE_TRACE_EXPORTS> true | <+REVOKE_TRACE_EXPOSED_CREDENTIALS> true))"#,
517517
r#"always([+PURGE_TRACE_EXPORTS] true -> eventually(<+NOTIFY_TRACING_OWNER> true))"#,
518+
r#"always([+METRICS_SNAPSHOT_SECRET_LEAKED] true -> (<+PURGE_METRICS_SNAPSHOTS> true | <+REVOKE_METRICS_EXPOSED_CREDENTIALS> true))"#,
519+
r#"always([+PURGE_METRICS_SNAPSHOTS] true -> eventually(<+NOTIFY_METRICS_OWNER> true))"#,
518520
r#"next(<+APPROVE> true)"#,
519521
r#"next((<+APPROVE> true | [<+REJECT>] true))"#,
520522
r#"<+WAIT> true until <+APPROVE> true"#,
@@ -5159,6 +5161,18 @@ F2: formula generated_2 {
51595161
));
51605162
}
51615163

5164+
#[test]
5165+
fn synthesis_list_includes_metrics_snapshot_secret_leak_prompt_examples() {
5166+
let output = synthesis_list_text();
5167+
5168+
assert!(output.contains(
5169+
"always([+METRICS_SNAPSHOT_SECRET_LEAKED] true -> (<+PURGE_METRICS_SNAPSHOTS> true | <+REVOKE_METRICS_EXPOSED_CREDENTIALS> true))"
5170+
));
5171+
assert!(output.contains(
5172+
"always([+PURGE_METRICS_SNAPSHOTS] true -> eventually(<+NOTIFY_METRICS_OWNER> true))"
5173+
));
5174+
}
5175+
51625176
#[test]
51635177
fn synthesis_list_includes_escrow_progression_prompt_examples() {
51645178
let output = synthesis_list_text();
@@ -15278,6 +15292,22 @@ gfp(X, []((X)) & ([<+ARCHIVE>] true))
1527815292
verify_synthesized_model(&model, &formulas).unwrap();
1527915293
}
1528015294

15295+
#[test]
15296+
fn verify_synthesized_model_accepts_metrics_snapshot_secret_leak_prompt_examples() {
15297+
let formulas = parse_formula_strings(&[
15298+
"always([+METRICS_SNAPSHOT_SECRET_LEAKED] true -> (<+PURGE_METRICS_SNAPSHOTS> true | <+REVOKE_METRICS_EXPOSED_CREDENTIALS> true))"
15299+
.to_string(),
15300+
"always([+PURGE_METRICS_SNAPSHOTS] true -> eventually(<+NOTIFY_METRICS_OWNER> true))"
15301+
.to_string(),
15302+
]);
15303+
let model = modality_lang::formula_synthesis::synthesize_from_formulas(
15304+
"MetricsSnapshotSecretLeak",
15305+
&formulas,
15306+
);
15307+
15308+
verify_synthesized_model(&model, &formulas).unwrap();
15309+
}
15310+
1528115311
#[test]
1528215312
fn verify_synthesized_model_accepts_mixed_alternatives_with_signer_requirement() {
1528315313
let formulas = parse_formula_strings(&[

0 commit comments

Comments
 (0)