Repository navigation
fix: make RequestInterpreter stateless - #791
Conversation
|
No actionable comments were generated in the recent review. Summary
Change: Bug fix · Severity of issue fixed: Low Merge Risk:
|
There was a problem hiding this comment.
No issues found across 2 files
Architecture diagram
sequenceDiagram
participant Client as GraphQL Client
participant Schema as Schema
participant RI as RequestInterpreter
participant Ctx as InterpreterContext
participant VM as Validation Messages
Note over Client,VM: RequestInterpreter is instantiated per schema, requests create fresh context
Client->>RI: executeRequest(query)
RI->>RI: createExecutionPlan(operation)
RI->>Ctx: new InterpreterContext(fragments, variables)
Note over RI,Ctx: Context holds directives map and usedFragments set (per-request state)
RI->>RI: handleOperation()
Ctx->>Ctx: Track fragment usage
alt Fragment spread encountered
RI->>Ctx: get(FragmentSpreadNode)
Ctx->>Ctx: Check fragment stack for cycles
Ctx-->>RI: Return Execution.Fragment
Ctx->>Ctx: Record fragment as used
end
RI->>RI: handleSelectionField()
alt Field has directives
RI->>Ctx: findDirective(directiveNode)
Ctx-->>RI: Directive definition or error
alt Directive not found
Ctx-->>VM: Throw ValidationException
end
end
RI->>RI: Complete operation handling
RI->>Ctx: unusedFragments()
Ctx-->>RI: Fragments not used in this request only
alt Unused fragments found
RI-->>VM: Throw ValidationException("Found unused fragments")
VM-->>Client: Validation error
else All fragments used
RI-->>Client: Execution plan
end
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #791 +/- ##
=======================================
Coverage 85.26% 85.26%
=======================================
Files 148 148
Lines 5082 5083 +1
Branches 886 886
=======================================
+ Hits 4333 4334 +1
Misses 448 448
Partials 301 301 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Resolves #790