[Endpoints BDD 2/5] Codegen baseline BDD Resolver - #7303
Draft
alextwoods wants to merge 1 commit into
Draft
Conversation
alextwoods
force-pushed
the
alexwoo/endpoints-bdd-pr2
branch
from
August 21, 2026 19:46
ad75759 to
cd84f83
Compare
alextwoods
force-pushed
the
alexwoo/endpoints-bdd-pr2
branch
from
August 21, 2026 19:53
cd84f83 to
ecfe0b1
Compare
Base automatically changed from
alexwoo/endpoints-bdd-pr1
to
feature/master/endpoints-bdd
August 21, 2026 20:28
alextwoods
force-pushed
the
alexwoo/endpoints-bdd-pr2
branch
3 times, most recently
from
August 21, 2026 21:36
d82c3d1 to
faff5ae
Compare
Implement the BDD endpoint resolver code generation visitors that transform a Binary Decision Diagram into a Java endpoint provider. Code generation visitors: - BddEndpointProviderSpec: main spec emitting the provider class with nodeP/nodeN method dispatch — each BDD node becomes a method returning Endpoint directly (null = no match, throw = error) - BddResultCodeGeneratorVisitor: traverses the BDD node graph and emits node methods with condition checks and edge traversal - ConditionFnCodeGeneratorVisitor: emits condition evaluations (isSet, booleanEquals, stringEquals, function calls, getAttr) - ResultFnCodeGeneratorVisitor: emits endpoint construction and error results from BDD result nodes - AssignTypeInferringVisitor: infers types for BDD register variables from the condition/result expressions - RegistryInfo: metadata for BDD registers (name, type, index) Wiring: - EndpointProviderTasks: when EndpointBddModel is present, generate BddEndpointProvider instead of rules-based provider The generated resolver uses direct method dispatch per BDD node, with simple conditions inlined as ternary expressions for branch-predictor-friendly code paths.
alextwoods
force-pushed
the
alexwoo/endpoints-bdd-pr2
branch
from
August 21, 2026 22:37
faff5ae to
0c21e3b
Compare
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.
[Endpoints BDD 2/5] Codegen baseline BDD Resolver
This PR is 2/5 for the Endpoints BDD. This is part of a Github PR Stack - to see all of the PRs in the stack, see the "2/5" at the top of the PR.
Note: This PR merges to the feature/master/endpoints-bdd feature branch and NOT to master.
Modifications
Adds code generation visitors that transform a BDD (Binary Decision Diagram) endpoint model into a Java endpoint provider. When an
endpoint-bdd-1.jsonis present in a service's codegen-resources, the codegen emits a BDD-based resolver instead of the tree-based rules resolver. Each BDD node becomes a method that evaluates its condition and branches to child nodes or results, returningEndpointdirectly. The generated resolver is validated end-to-end against 32 Connect endpoint test cases incodegen-generated-classes-test.Changes by area:
bdd/BddEndpointProviderSpec— Main spec: builds the evaluator inner class with per-call allocation, emitsnodeP<i>methods for each BDD node,cond<i>for complex conditions, andresult<i>for endpoint/error leaves. Gates on BDD model presence (no customization flag required).bdd/BddResultCodeGeneratorVisitor— Walks the result RuleModel expressions to emit endpoint construction (URL, headers, auth scheme attributes) or error throws.bdd/ConditionFnCodeGeneratorVisitor— Emits condition evaluation code: function calls (awsPartition, substring, isValidHostLabel, etc.), getAttr member access, and assigns to evaluator registers.bdd/AssignTypeInferringVisitor— Infers types for BDD register variables from condition/result expressions so the evaluator fields can be declared with concrete types.bdd/RegistryInfo— Metadata per BDD register: Java field name, type, source expression, nullability, and whether it maps to an endpoint parameter.EndpointProviderTasks— Wiring: selectsBddEndpointProviderSpecwhen BDD model is present, compiled rules otherwise.ClientTestModels+ test fixtures — AddsqueryServiceModelsWithBddEndpoints(S3 BDD) andqueryServiceModelsWithSimpleBddEndpoints(simple regional service-like BDD) with corresponding JSON fixtures.BddEndpointProviderSpecTest— Golden-file fixture test against the small BDD, plus assertion tests for dynamic auth scheme codegen and the fail-fast on missing S3Express customization.test/codegen-generated-classes-test/bddendpoints— New test service with Connect's BDD + endpoint tests; auto-generated provider test validates all 32 endpoint test cases pass at runtime.Testing
Codegen unit tests that use golden cases
TokenizerTest— 9 cases covering template expression tokenization including hyphen and negative-index edge casesBddEndpointsEndpointProviderTests(codegen-generated-classes-test, auto-generated)Screenshots (if appropriate)
License