Record Policy Nexus metadata apply and diagnose bootstrap
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a058f3-8ba0-7692-a042-9a870fc3d663
This commit is contained in:
parent
1d5f35539d
commit
a6d47c51cc
3 changed files with 46 additions and 2 deletions
|
|
@ -31,6 +31,23 @@ class PolicyNexusForgejoSourceProvisionTests(unittest.TestCase):
|
|||
MODULE.verify_source_token("candidate", ["read:repository", "write:repository"])
|
||||
request.assert_not_called()
|
||||
|
||||
def test_diagnostic_redacts_unexpected_exception_details(self) -> None:
|
||||
with self.subTest("unexpected"):
|
||||
with mock.patch.object(MODULE, "DIAGNOSTIC_PATH") as path:
|
||||
MODULE.write_diagnostic("provision", RuntimeError("sensitive detail"))
|
||||
payload = path.write_text.call_args.args[0]
|
||||
self.assertNotIn("sensitive detail", payload)
|
||||
self.assertIn("unexpected internal error", payload)
|
||||
|
||||
with self.subTest("bounded provision error"):
|
||||
with mock.patch.object(MODULE, "DIAGNOSTIC_PATH") as path:
|
||||
MODULE.write_diagnostic(
|
||||
"provision",
|
||||
MODULE.ProvisionError("PUT /bounded/path returned HTTP 403"),
|
||||
)
|
||||
payload = path.write_text.call_args.args[0]
|
||||
self.assertIn("PUT /bounded/path returned HTTP 403", payload)
|
||||
|
||||
def test_actions_failure_revokes_pat_and_removes_new_kv_value(self) -> None:
|
||||
calls: list[tuple[str, str]] = []
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue