Skip to content

[FIX]: Make Result.safe a derived property - #124

Merged
behnam-o merged 1 commit into
microsoft:mainfrom
behnam-o:behnam-o-urban-sniffle
Jul 28, 2026
Merged

[FIX]: Make Result.safe a derived property#124
behnam-o merged 1 commit into
microsoft:mainfrom
behnam-o:behnam-o-urban-sniffle

Conversation

@behnam-o

Copy link
Copy Markdown
Contributor

What

Result.safe is now a computed @property (status is SafetyStatus.SAFE) instead of a stored dataclass field, so it can never drift out of sync with status.

Since the invariant safe == (status is SafetyStatus.SAFE) already held everywhere, this also removes the now-redundant safe value from the resolver plumbing:

  • resolve_as_attack / resolve_as_probe now return SafetyStatus directly instead of a (safe, status) tuple.
  • XPIAExecution._adjust_for_observability takes/returns only SafetyStatus.
  • All Result(...) constructions drop the safe= argument.

Notes

  • result.safe, bool(result), and repr(result) (still shows safe=...) behave exactly as before.
  • Updated the affected doc examples (extending-rampart.md, testing.md, pytest-integration.md).

Testing

  • ruff check rampart tests — all checks passed
  • pytest tests/unit — 616 passed

Derive safe from status (status is SafetyStatus.SAFE) so it can never
drift out of sync. Simplify resolve_as_attack/resolve_as_probe and XPIA
observability adjustment to return SafetyStatus directly, and drop the
redundant safe= argument from all Result constructions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 5765e8db-a669-459f-8975-bc09b960608a
@behnam-o
behnam-o requested a review from a team July 22, 2026 23:16
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@behnam-o behnam-o changed the title Make Result.safe a derived property [FIX]: Make Result.safe a derived property Jul 22, 2026
@behnam-o
behnam-o merged commit 03a19da into microsoft:main Jul 28, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants