feat(resolution): index GoFrame g.Meta routes, link to controller methods (#747)#803
Open
maxmilian wants to merge 1 commit into
Open
feat(resolution): index GoFrame g.Meta routes, link to controller methods (#747)#803maxmilian wants to merge 1 commit into
maxmilian wants to merge 1 commit into
Conversation
…hods (colbymchenry#747) GoFrame binds routes reflectively — the path/method live in a g.Meta struct tag on the request type, and the handler is the controller method named after that type with the Req suffix dropped (ChatReq -> Chat). So there was no literal route string and no call edge: route questions could only be answered lexically. Extend goResolver.extract to read the g.Meta tag (path: + method:, defaulting to ANY when method is absent) into a route node and link it to the controller method by the naming convention. Route node and its method edge are emitted together — a g.Meta whose type doesn't follow the …Req convention is skipped rather than left as an orphan route node. Only the relative path: from the tag is captured; joining the s.Group("/api", …) prefix is left to a follow-up. Follow-up to colbymchenry#720 (structural coverage, distinct from the ranking fix).
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.
Follow-up to #720 (suggestion #3 — structural route coverage, distinct from the ranking fix). Closes #747.
Why
GoFrame binds routes reflectively, so there's no literal
/chatstring and no call edge from path → controller method:Today "where is this route registered / which method handles it" can only be answered lexically — route-registration symbols have nothing to win on.
What
Extend
goResolver.extract(src/resolution/frameworks/go.ts) with a GoFrame pass:g.Metastruct tag (path:+method:, defaulting toANYwhenmethod:is absent) → aroutenode, identical in shape to the existing Gin/mux route nodes, andReqsuffix dropped,ChatReq→Chat) via areferencesedge — same shape as the existing route→handler edges.The route node and its method edge are emitted together: a
g.Metawhose type doesn't follow the…Reqconvention (or has nopath:) is skipped rather than left as an orphan route node, per the "partial coverage is worse than none" guidance.Scope / follow-ups (intentional)
path:from the tag is captured (/chat), not thes.Group("/api", …)prefix that GoFrame prepends. The route node + method edge are still complete and useful; joining the group prefix (cross-file) is a clean follow-up.referencesedge resolves through the same name-resolution path as the existing Gin/mux route handlers. There's no GoFrame-specificresolve()pattern, so a method name resolves like any PascalCase ref; a dedicated method-kind resolution pattern is possible follow-up hardening (same risk profile as today's route-handler refs).Tests
Two unit cases added to
goResolver.extractin__tests__/frameworks.test.ts(mirroring the existing Gin/mux/Rust route-extraction tests):g.Metawithmethod:"post"→POST /chat+Chatedge; method-lessg.Meta→ANY /list+Listedge. Both assert the edge binds to the route node id.Validation
npm run build— clean (tsc).npx vitest run __tests__/frameworks.test.ts— 96 passed, no existing route tests broken.codegraph/CLAUDE.mdif you want it in the PR.