feat(group): add rule-based HTTP contract mappings#703
Closed
JaysonAlbert wants to merge 4 commits into
Closed
Conversation
|
Someone is attempting to deploy a commit to the NexusCore Team on Vercel. A member of the Team first needs to authorize it. |
Collaborator
|
I believe we have already tackled with this task, right @ivkond ? Your PRs are handling this case? If so please close this PR and the releated issue. |
Collaborator
|
Please submit a new PR if this is still relevant |
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
Fixes #701.
This PR adds rule-based HTTP contract mappings for repository groups so frontend gateway URLs can be linked to backend service routes even when their paths do not literally match.
It also includes the request-like client support needed to make the flow work on real-world frontends that use wrappers such as
request(...)/request.get(...)instead of plainfetchoraxios.What changed
Group-level HTTP mappings
http_mappingstogroup.yamlfromto.repo/to.servicemethodsmatchwhenrewritepath-to-regexpfor matching, param extraction, and path generationmatchType: manifestGroup YAML persistence
group.yamlas a snake_case configuration formathttpMappingsback tohttp_mappingswhengroup add/group removerewrite the fileCross-link bookkeeping
fromContractId/toContractIdRequest-like frontend HTTP consumers
request('/api/...')request('/api/...', { method: 'POST' })request.get('/api/...')request.post('/api/...')HttpRouteExtractorsource-scan fallback sogroup synccan still extract HTTP consumers even when noFETCHESgraph edges are presentWhy this shape
A per-endpoint manifest link model is too heavy for enterprise setups where frontend traffic goes through a gateway namespace such as:
/api/titans/<service>/<version>/...and backend services expose internal routes such as:
/tradeflow/.../margin/.../orders/...With rule-based mappings, one service-level rule can cover many endpoints while keeping matching deterministic and auditable.
The YAML-format fix is intentionally strict:
group.yamlis treated as a user-facing config surface, so the persisted format should stay stable and explicit rather than drifting toward internal TypeScript field names.Validation
Ran:
I also validated this against a real
libra-client + libra-server + libra-tradinggroup locally:0HTTP cross-linkshttp_mappingsand request-like consumer extraction:407manifest cross-linkstradingpaths now link intobackend/libra-tradingas wellNotes
linksbehavior is preservedgroup.yaml's persisted mapping key ishttp_mappings