mirror of
https://github.com/ModernRelay/omnigraph.git
synced 2026-06-12 01:45:14 +02:00
mr-668: drop vestigial PolicyEngine surface
* `validate_request` had zero callsites — pure surface for nothing. * `deny`'s `_actor_id` and `_request` parameters were both unused (the underscore prefix gave it away); the message is built by the caller before `deny` ever sees the request. Trim both. Closes the "public API that the type system can't justify" class for the policy engine. No behavior change; every existing test stays green because the deletions never had a runtime effect. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0b893426e7
commit
2bb6e24fe3
1 changed files with 2 additions and 15 deletions
|
|
@ -428,8 +428,6 @@ impl PolicyEngine {
|
|||
pub fn authorize(&self, actor_id: &str, request: &PolicyRequest) -> Result<PolicyDecision> {
|
||||
if !self.known_actors.contains(actor_id) {
|
||||
return Ok(self.deny(
|
||||
actor_id,
|
||||
request,
|
||||
None,
|
||||
format!(
|
||||
"policy denied action '{}' for unknown actor '{}'",
|
||||
|
|
@ -503,16 +501,11 @@ impl PolicyEngine {
|
|||
.unwrap_or_default(),
|
||||
actor_id
|
||||
);
|
||||
self.deny(actor_id, request, matched_rule_id, message)
|
||||
self.deny(matched_rule_id, message)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
pub fn validate_request(&self, actor_id: &str, request: &PolicyRequest) -> Result<()> {
|
||||
let _ = self.authorize(actor_id, request)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn run_tests(&self, tests: &PolicyTestConfig) -> Result<()> {
|
||||
if tests.version != 1 {
|
||||
bail!("policy test version must be 1");
|
||||
|
|
@ -548,13 +541,7 @@ impl PolicyEngine {
|
|||
self.known_actors.len()
|
||||
}
|
||||
|
||||
fn deny(
|
||||
&self,
|
||||
_actor_id: &str,
|
||||
_request: &PolicyRequest,
|
||||
matched_rule_id: Option<String>,
|
||||
message: String,
|
||||
) -> PolicyDecision {
|
||||
fn deny(&self, matched_rule_id: Option<String>, message: String) -> PolicyDecision {
|
||||
PolicyDecision {
|
||||
allowed: false,
|
||||
matched_rule_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue