feat(P1): 统一运行时依赖图 Graph;dixhttp 快照缓存 - #60
Merged
Merged
Conversation
…aph rebuild Declare edges (output type -> flattened input types) are maintained on Provide inside the new Graph; isCycle projects the adjacency read-only. Struct-output parent types now also carry their field dependencies — the old rebuild missed those cycles. detectCycle semantics unchanged (sorted deterministic traversal, trimmed paths, all lock tests pass unchanged). Also fixes GetFnName panicking on zero reflect.Value (provider nodes may carry no fn).
ProviderDetails/objects reflection and the full projection happen once per graph version; warm unfiltered requests return the same snapshot (5.2us, 13 allocs — JSON encode only), filtered views rebuild from cached inputs without reflection. GetProviderDetails/GetObjects call sites in stats/packages/type/package handlers now share the cache.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
概要
按 spec 第 3 节实施 P1(实施计划:
docs/superpowers/plans/2026-09-04-p1-graph-model.md):dixinternal/graph.go(新):运行时依赖图 Graph——节点(Type/Provider/Object)+ 边(Declared 声明依赖 / Produced 产物 / Resolved 执行计数)+ 版本号;读写锁保护(dixhttp 并发读安全);线性 searchNodes 检索(P4 倒排的地基)。extractDependencyData方法删除,改为纯函数buildDependencyData。附带修复
GetFnName对零值 reflect.Value 调 IsNil 会 panic(provider 节点可不带 fn)——补 IsValid 防护(并发测试抓到)。验证
BenchmarkHandleDependenciesWarm热请求 5.2µs / 13 allocs(仅 JSON 编码,零反射;此前每请求全量 FuncForPC + GetObjects)task test(含 example race)+task lint0 issues