feat(negotiation): complete proposal refinement API gaps - #38
Open
garvitkaushik-123 wants to merge 3 commits into
Open
feat(negotiation): complete proposal refinement API gaps#38garvitkaushik-123 wants to merge 3 commits into
garvitkaushik-123 wants to merge 3 commits into
Conversation
Introduces the `negotiation` package across adcp, adcp-server, and adcp-testing modules for the refine_proposals tool surface (AdCP 3.2). Client (adcp module): - Sealed RefinementResult with four outcomes (revised/partial/finalized/unable) supporting exhaustive pattern matching - Capability-aware RefineProposalsRequest builder enforcing batch size ceilings, unique proposal IDs, and finalize-only homogeneity - Three typed constraints from the 3.2 delta: CpmConstraint, ImpressionsConstraint, FlightConstraint - TermsDigest utility implementing RFC 8785 JCS canonicalization for SHA-256 digest computation and verification - ResponseVerifier checking result ordering, lineage (parent_proposal_id), finalize atomicity, outcome structural constraints, partial invariant, unique alternatives, and digest integrity - AdcpClient.refineProposals() convenience method - UnsupportedRefinementDetails for typed UNSUPPORTED_FEATURE error recovery - RefinementCapability with product_changes dimension key (post-rename) Server (adcp-server module): - ProposalHandler interface with capability declaration, batch preflight hook, and refine callback — commercial decisions stay in the application Testing (adcp-testing module): - NegotiationFixtures with factory methods for common scenarios: single revise, batch finalize, constraint objects, draft/committed proposals Covers the unsatisfied_constraints-is-open-strings design, reason code precedence (constraint_unsatisfiable > commercially_declined), lineage verification, and the hold_unavailable/batch_aborted reason codes from the post-red-team protocol delta. Ref: adcontextprotocol#36
- TermsDigest: remove unused MAPPER field and three unused imports (JsonProcessingException, Iterator, Map) - TermsDigest: add @nullable to verify() digest parameter — the method handles null but the @NullMarked package default says non-null - TermsDigest: fix JCS exponent formatting — strip ".0" before 'e' so 1.0E-7 becomes "1e-7" per ES2015/RFC 8785 (was producing "1.0e-7") - TermsDigest: replace per-character OutputStreamWriter allocation in writeCanonicalString with direct String.valueOf(c).getBytes() - RefineProposalsRequest: remove unused Collections import and dead supportedDimensions builder field (stored but never validated) - AdcpClient: fix import ordering — negotiation imports grouped with other org.adcontextprotocol imports, not after slf4j - Add serialization round-trip test for RefinementResult - Add test coverage for JCS exponent edge cases
Add missing typed constraints, alternatives validation, and server-side successor utilities to close the proposal negotiation gaps tracked in adcontextprotocol/adcp#6556. - TotalBudgetConstraint: budget bounds (min/max/currency) per schema - RefinementConstraints: composite of all four constraint dimensions - ProposalRefinement: add constraints, productChanges, alternatives fields + builder; rename instructions→ask to match wire schema; enforce alternatives.count 2-10 (protocol max) - RefinementCapability: add maxAlternatives field - RefineProposalsRequest.Builder: validate alternatives against seller ceiling - ResponseVerifier: add verifyConstraintSatisfaction checking budget bounds and CPM ceiling on revised outcomes - ProposalSuccessor (server): stamp immutable successors with lineage and recomputed terms_digest - 15 new tests across constraints, alternatives, verification, and successor stamping Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
garvitkaushik-123
requested review from
MichielDean and
bokelley
as code owners
August 27, 2026 16:25
|
The automated review encountered an issue (possibly reached max turns, timed out, or failed to post the final This is an automated message from the Argus AI review workflow. |
Open
7 tasks
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.
Summary
TotalBudgetConstraint,RefinementConstraintscomposite type, and missingconstraints/productChanges/alternativesfields toProposalRefinement— closing the typed-constraint gap tracked in epic: make proposal negotiation easy to implement, teach, and verify adcp#6556verifyConstraintSatisfactiontoResponseVerifier— checks budget bounds and CPM ceiling on revised outcomesProposalSuccessorutility for stamping immutable successor proposals with lineage and recomputedterms_digestTest plan
./gradlew buildpasses (all 8 modules)./gradlew :adcp:test :adcp-server:test— all new and existing tests greenCloses adcontextprotocol/adcp#6556 (Java SDK track)
🤖 Generated with Claude Code