feat(pep): decide -> fulfill -> forward Decision Mode PEP (#2571)#191
Merged
Conversation
Add the SDK analog of platform/shared/pep (ADR-056, epic #2563): a decide client that surfaces engine-fulfillable redact_pii obligations, plus a fulfill helper that discharges them by round-tripping content through the named engine endpoint (check-input) -- never by redacting locally. - decide() / fulfillRequest() / decideAndFulfill() (+ async mirrors) and the Pep.hasRequestRedaction() helper + constants on the main client - DecideRequest (fluent builder) / DecideResponse / Obligation / ObligationFulfillment / DecisionCallerIdentity / DecisionTarget types - redacted / redacted_statement / redaction_evaluated on MCPCheckInputResponse; redaction_evaluated on MCPCheckOutputResponse; content_type on check-input - ObligationNotFulfillableException fail-closed signal (no local redaction) - 34 unit tests (every fail-closed branch + passthrough + decide parse + decide_and_fulfill allow/deny/unfulfillable; 99% line cover on new code) + runtime-e2e (real enterprise agent: decide -> fulfill -> masked, demo creds refused); wire-shape baseline annotated (pinned spec SHA unchanged) Minor bump 8.4.0 -> 8.5.0 (additive, SDK semver decoupled from platform). Refs #2563 Signed-off-by: Saurabh Jain <saurabh.jain@getaxonflow.com>
…571) R3 parity follow-up: fulfillRequest now throws ObligationNotFulfillableException on a self-contradictory engine response (redacted=true but null/empty redacted_statement) instead of forwarding the unredacted original. Adds a unit test. Brings Java to parity with the same hardening applied to Python/Go/TS/Rust in this pass. Signed-off-by: Saurabh Jain <saurabh.jain@getaxonflow.com>
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.
Ports the Decision Mode PEP (decide → fulfill → forward) contract into the Java SDK — the SDK analog of
platform/shared/pep(ADR-056, epic #2563). Tracking: #2571.Cross-SDK parity with the canonical Python (#211), Go (#181), and TypeScript (#241) PRs: JSON wire field names are byte-identical (snake_case), and constant VALUES match exactly (
redact_pii,request/response,text/plain,allow/deny/needs_approval, paths/api/v1/decide,/api/v1/mcp/check-input,/api/v1/mcp/check-output).What's added
AxonFlow.decide(DecideRequest)(+decideAsync) — the PDP step.POST /api/v1/decideover the SDK's existing HTTP Basic (org:license) auth; demo/wrong creds →AuthenticationException(401); adenyverdict is returned in the body (HTTP 200), not as an error.AxonFlow.fulfillRequest(DecideResponse, String)— discharges every request-phaseredact_piiobligation by round-tripping the statement through the engine'scheck-inputendpoint and returning engine-redacted content (FulfillResult: content +didRedact()). No local redaction anywhere.AxonFlow.decideAndFulfill(DecideRequest)(+ async) — the one-call path (DecideAndFulfillResult); fail-closed by construction.Pepconstants +Pep.hasRequestRedaction(List<Obligation>).DecideRequest(fluent builder),DecideResponse,Obligation,ObligationFulfillment,DecisionCallerIdentity,DecisionTarget.ObligationNotFulfillableException— the fail-closed signal (extendsAxonFlowException).content_typeonMCPCheckInputRequest(+content_typeoption onmcpCheckInput);redacted/redactedStatement/redactionEvaluatedonMCPCheckInputResponse;redactionEvaluatedonMCPCheckOutputResponse. Existing source-compat constructors preserved.Fail-closed (never returns the original statement)
fulfillRequestthrowsObligationNotFulfillableExceptionwhen: no request-phase fulfillment; advertisedcontent_typesexcludestext/plain; the endpoint is not the request-redaction path (foreign URLs rejected; absolute URLs accepted only when their path matches); the engine call fails / non-200; orredaction_evaluated == false.didRedactreflects whether the engine changed the content.Verification
Unit tests (34 new): decide parse + wire shape; every fail-closed branch (no-fulfillment, response-phase, unadvertised content-type, foreign endpoint, engine-error,
redaction_evaluated=false,redaction_evaluatedabsent); passthrough (no obligation, engine-found-nothing);decideAndFulfillallow/deny/unfulfillable;hasRequestRedaction; absolute-URL acceptance. New-code line coverage 99.4%.Full suite: 1302 tests, 0 failures; JaCoCo BUNDLE gates satisfied (LINE 0.782, BRANCH 0.550).
Wire-shape: validator green against the pinned community spec; baseline annotated for the acknowledged SDK-superset fields without bumping the pinned spec SHA (no
spec-pin-bumpneeded).Version: minor bump 8.4.0 → 8.5.0 (pom.xml + example poms + CHANGELOG); Version Alignment script passes.
runtime-e2e (
runtime-e2e/decide_fulfill_obligation/, NO mocks): run against the live enterprise agent —Neither
john.doe@example.comnor4111111111111111survives fulfillment.Deviations from spec
fulfillRequestreturns a smallFulfillResult(content +didRedact()) anddecideAndFulfillreturnsDecideAndFulfillResult(verdict + content + decision) — idiomatic Java for the spec's multi-value returns; semantics are identical.Refs #2563