mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 14:10:49 -05:00
graphql-java (~3.8MB with transitive deps) was an unconditional dependency, so it and its schema/execution/parser classes were reachable in every native image regardless of whether AppSync was ever used (issue #2917), the same systemic pattern already fixed for Kubernetes (#2914) and Kafka (#2916). Schema parsing and query execution now run in floci/floci-sidecar-graphql, published from floci-io/floci-sidecars, the same model #3799 already moved Cedar onto: GraphqlSidecarManager lazily starts the pinned image and checks the contract version it reports on /health, refusing a sidecar speaking another contract major with a message naming the image and the variable to change. GraphqlSidecarClient talks to it over plain HTTP. graphql-java is no longer a dependency of this repository at all, not even test-scoped: its schema/execution/parser classes, the query planner, and the 17 AWS scalar coercions now live entirely in the sidecar's own repository. The sidecar itself carries zero AppSync-specific knowledge, and zero AWS vocabulary: its scalars are generic named coercion kinds a caller maps its own scalar names onto, so SidecarSchemaCompiler now sends a scalars mapping (AWSDateTime -> date-time, and so on for all 17) alongside every SDL, or AWS scalar validation would silently degrade to pass-through coercion. It exposes three endpoints: schema validate/compile, a query planner that lists every (typeName, fieldName) coordinate a query would visit plus the directives on each (with zero interpretation of what they mean), and execute, which accepts an opaque denyFields list and nulls those coordinates out with the caller-supplied error. All @aws_auth/IAM/ Cognito/Lambda-authorizer interpretation stays in Floci (SidecarFieldAuthorizationPlanner, AppSyncAuthRequirements), computed from the planner's output before /v1/execute is ever called, so a query the planner can't fully analyze fails closed (refuses the request) instead of silently running unauthorized. SidecarSchemaCompiler replaces AppSyncSchemaParser: it still injects AppSync's directive declarations and the 17 scalar type declarations into the customer's SDL (pure string work) before handing the SDL to the sidecar. While the scalar coercion logic was still being ported to the sidecar's repository, testing surfaced a real bug: every scalar's parseLiteral() delegated to parseValue(), which throws CoercingParseValueException; graphql-java's literal validator only catches CoercingParseLiteralException, so an invalid literal argument (as opposed to an invalid variable) escaped as an unhandled exception instead of a spec-correct GraphQL ValidationError. Fixed in the sidecar before it was ever published. QueryRegistry, QueryExecutor, AuthFieldWrapper, AuthorizationDataFetcher's live DataFetcher wrapper, and AppSyncFieldUnauthorizedException are deleted: their in-process execution role no longer exists. The directive interpretation half of AuthorizationDataFetcher survives as AppSyncAuthRequirements, now taking generic data instead of live graphql-java objects, shared rather than duplicated. Verified end to end against the published image: pulled floci/floci-sidecar-graphql:0.2.0 fresh and ran the full AppSync suite (190 integration tests across schema lifecycle, auth, and execution) through the real GraphqlSidecarManager, including the sidecar starting and stopping as a real sibling container over the mounted Docker socket.