Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/jacobian/sat_smt/cadical.py
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,9 @@ def _resolve_request(
schema_uri=sat.installation.cnf_schema_uri,
expected="one valid canonical CNF artifact and enforceable budget",
hint=(
"Create the instance with SatArtifactService.put_cnf and use "
"only the advertised wall-time and conflict limits."
"Use math.find for sat.cnf.materialize to create the canonical "
"CNF, then pass its cnf_uri with only the advertised wall-time "
"and conflict limits."
),
)
) from exc
Expand Down
14 changes: 9 additions & 5 deletions src/jacobian/sat_smt/sat_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def invoke(self, request: CapabilityRequest) -> CapabilityResult:
"literals referring only to declared variables"
),
hint=(
"Call math.find for sat.cnf.materialize and correct "
"Inspect sat.cnf.materialize with math.find and execute it with math.run to correct "
"the variable_names or clauses."
),
)
Expand Down Expand Up @@ -417,8 +417,10 @@ def invoke(self, request: CapabilityRequest) -> CapabilityResult:
"to one canonical CNF"
),
hint=(
"Create the assignment with SatArtifactService.put_assignment "
"against the intended canonical CNF."
"Inspect sat.model.find with math.find and execute it with math.run to produce an assignment "
"artifact for the intended canonical CNF. If that optional "
"producer is unavailable, install the CaDiCaL provider; do "
"not invent an assignment URI."
),
)
) from exc
Expand Down Expand Up @@ -630,8 +632,10 @@ def invoke(self, request: CapabilityRequest) -> CapabilityResult:
"lineage to one canonical CNF"
),
hint=(
"Create the proof with SatArtifactService.put_proof against "
"the intended canonical CNF."
"Inspect sat.unsat_proof.find with math.find and execute it with math.run to produce a proof "
"artifact for the intended canonical CNF. If that optional "
"producer is unavailable, install the CaDiCaL provider; do "
"not invent a proof URI."
),
)
) from exc
Expand Down
6 changes: 4 additions & 2 deletions src/jacobian/sat_smt/smt_capabilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,10 @@ def invoke(self, request: CapabilityRequest) -> CapabilityResult:
"lineage to one exact pinned-profile SMT query"
),
hint=(
"Create the proof with smt.unsat_proof.find or "
"SmtArtifactService.put_proof against the intended query."
"Use math.find for smt.unsat_proof.find to produce a proof "
"artifact for the intended query. If that optional producer "
"is unavailable, install the cvc5 provider; do not invent a "
"proof URI."
),
)
) from exc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,27 @@ def _verify(runtime: JacobianRuntime, proof_uri: str):
)


def test_invalid_proof_diagnostic_routes_through_public_capabilities(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
) -> None:
executable = _fake_carcara(
tmp_path,
"print('valid')\nraise SystemExit(0)",
)
runtime = _runtime_with_runtime(tmp_path, monkeypatch, executable)

result = _verify(runtime, "artifact://sha256/" + "0" * 64)

assert result.execution.status is ExecutionStatus.ERROR
assert result.diagnostics[0].code == "INVALID_SMT_UNSAT_PROOF"
hint = result.diagnostics[0].hint or ""
assert "math.find" in hint
assert "smt.unsat_proof.find" in hint
assert "cvc5" in hint
assert "SmtArtifactService" not in hint


def test_unsat_proof_is_verified_by_authorized_strict_carcara(
tmp_path: Path,
monkeypatch: pytest.MonkeyPatch,
Expand Down
17 changes: 17 additions & 0 deletions tests/composition/runtime/test_sat_assignment_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ def test_sat_assignment_verifier_declares_its_typed_artifact_route(
)


def test_invalid_assignment_diagnostic_routes_through_public_capabilities(
authorized_complete_runtime,
) -> None:
result = _verify(
authorized_complete_runtime,
"artifact://sha256/" + "0" * 64,
)

assert result.execution.status is ExecutionStatus.ERROR
assert result.diagnostics[0].code == "INVALID_SAT_ASSIGNMENT"
hint = result.diagnostics[0].hint or ""
assert "math.find" in hint
assert "sat.model.find" in hint
assert "CaDiCaL" in hint
assert "SatArtifactService" not in hint


def test_sat_assignment_is_verified_by_an_authorized_clean_process(
authorized_complete_runtime,
monkeypatch: pytest.MonkeyPatch,
Expand Down
Loading