Repository navigation
Show the policy rule that would flip an existing allow decision - #292
Merged
karagozemin merged 3 commits intoOct 1, 2026
Merged
karagozemin merged 3 commits into
karagozemin merged 3 commits into
Conversation
Bad merges left three files uncompilable (unbalanced braces in fetchBlocklistWithTimeout, a refresh arrow function still closed like a useCallback, and a duplicated response binding in the audit export test), which stopped every suite importing the decision engine from running. Also restore the "timeout" blocklist status the analyzer tests assert and add the required descriptions to bare @ts-expect-error directives. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
Operators could activate a candidate policy that silently turns a live allow into a denial because diff, history and the decision engine each described changes differently. The history route now accepts a read-only ?candidate=<version> query and returns the payment ids whose result would change plus the rule id responsible, sourced from the same diff helper so both always agree. Nothing is activated by the read. Closes Fortexa-stellar#214 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
|
@blocorbitstech Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #214
What
GET /api/policy/historynow accepts a read-only?candidate=<version>query and reports, before that candidate is ever activated, which open allow decisions it would turn into a denial — and which rule id is responsible.diffDecisionImpact(src/lib/validation/diff.ts) diffs the candidate against the active policy throughgeneratePolicyDiff, so every change is keyed by a rule id (blockedDomains[api.safe-research.ai],perTxCapXLM,allowedHours, …).openAllowDecisionscollects the newest recorded result per action from the audit history and keeps the ones still allowed (APPROVE/WARN), each with its usage snapshot. Every one is re-run through the decision engine under both the active and the candidate policy.Response shape:
{ "entries": [ ... ], "decisionImpact": { "candidateVersion": 3, "activeVersion": 4, "flippedIds": ["payment-allow-1"], "flips": [{ "paymentId": "payment-allow-1", "ruleId": "blockedDomains[api.safe-research.ai]", "from": "APPROVE", "to": "BLOCK" }], "hasDecisionChange": true, "status": "decision change" } }Without
?candidate=the response keepsdecisionImpact: null, so existing consumers are unaffected. An invalid candidate returns 400, an unknown one 404.Acceptance criteria
no decision changeValidation
npm test→ 69 files, 589 tests passing (including the newsrc/lib/validation/diff.test.tsand the extended history route tests)npm run lint→ 0 errorsNote on the first commit
maincontained merge damage that stopped everything from compiling (unbalanced braces insrc/lib/security/analyzer.ts, auseCallback-style close on a plain arrow inuse-auth-session.ts, a duplicated binding in the audit export test, plus bare@ts-expect-errordirectives). No suite importing the decision engine could run at all, so the repair is included as a separate commit to keep the feature commit reviewable.🤖 Generated with Codebuff
Co-Authored-By: Codebuff noreply@codebuff.com