Skip to main content

apply_with_premises

Function apply_with_premises 

Source
pub fn apply_with_premises(
    surface: &AgentSurface,
    value: Value,
    target: Option<Map<String, Value>>,
    ceiling: Option<&QueryCeiling>,
) -> Result<Value, AppError>
Expand description

The body of apply, with BOTH ambient facts supplied rather than read.

GAP-SG-201 shipped a refusal that no test could reach, and this signature is why it could not. The query ceiling lives in a second process-wide OnceLock, and OnceLock offers a static no reset at all — take and every get_mut require &mut self — so two tests in one binary could never state different ceilings. Nothing in the family had a test, the compiler was the only reader left, and dead_code cannot see a pub item in a lib crate. A guard was therefore written, translated, reviewed and never called.

apply_with_target keeps its own shape because the seventeen tests that only care about the target should not have to state a ceiling they have no opinion about.

§Errors

Returns AppError::Usage when the request cannot be honoured as asked.