Keep model diagnostics private in Eve play
This commit is contained in:
parent
50e7112651
commit
855d6be8fc
4 changed files with 44 additions and 21 deletions
|
|
@ -4421,13 +4421,8 @@ async fn command(
|
|||
*proposal = Some(assessment);
|
||||
}
|
||||
Err(error) => {
|
||||
return (
|
||||
StatusCode::UNPROCESSABLE_ENTITY,
|
||||
Json(ErrorBody {
|
||||
error: error.to_string(),
|
||||
}),
|
||||
)
|
||||
.into_response();
|
||||
let body = player_safe_assessment_failure(&error);
|
||||
return (StatusCode::UNPROCESSABLE_ENTITY, Json(body)).into_response();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5791,6 +5786,18 @@ fn player_safe_strategic_failure(error: &anyhow::Error) -> ErrorBody {
|
|||
}
|
||||
}
|
||||
|
||||
fn player_safe_assessment_failure(error: &anyhow::Error) -> ErrorBody {
|
||||
let private_error_chain: String = format!("{error:#}").chars().take(4_000).collect();
|
||||
tracing::warn!(
|
||||
error = %private_error_chain,
|
||||
"private action assessment failed without mutation"
|
||||
);
|
||||
ErrorBody {
|
||||
error: "Ghostlight could not produce a valid stakes assessment after one correction. No world state changed; your draft is preserved so you can retry or revise the attempt."
|
||||
.into(),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
@ -5813,6 +5820,22 @@ mod tests {
|
|||
assert!(!projected.error.contains("verifier"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn assessment_failure_projection_never_contains_private_model_diagnostics() {
|
||||
let private = anyhow::anyhow!(
|
||||
"stage action_assessment, instance /strong_effect/clock_advances/secret, schema /minimum: rejected hidden value"
|
||||
);
|
||||
let projected = player_safe_assessment_failure(&private);
|
||||
|
||||
assert_eq!(
|
||||
projected.error,
|
||||
"Ghostlight could not produce a valid stakes assessment after one correction. No world state changed; your draft is preserved so you can retry or revise the attempt."
|
||||
);
|
||||
assert!(!projected.error.contains("action_assessment"));
|
||||
assert!(!projected.error.contains("clock_advances"));
|
||||
assert!(!projected.error.contains("schema"));
|
||||
}
|
||||
|
||||
fn seed(name: &str) -> Campaign {
|
||||
let actor = ActorState {
|
||||
id: "player".into(),
|
||||
|
|
|
|||
2
vendor/eve
vendored
2
vendor/eve
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit e5a81185bb790906bea5eeba40507673b0d9b5bb
|
||||
Subproject commit 19c3dcf9173dce848a6253e975324ea239a02d24
|
||||
File diff suppressed because one or more lines are too long
2
web/dist/index.html
vendored
2
web/dist/index.html
vendored
|
|
@ -4,7 +4,7 @@
|
|||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Ghostlight Dungeon</title>
|
||||
<script type="module" crossorigin src="/assets/index-BZDMQ4Cd.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-DIf_m6wC.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-0xx6l_wS.css">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Reference in a new issue