Repository navigation
docs(dynamic-kind): clarify Track A resolved calls never surface via roles --dynamic - #2448
Merged
Merged
Conversation
…roles --dynamic (#2270) Investigated whether resolved Track A dynamic calls (computed-literal, value-ref, dispatch-table) should persist dynamic_kind on their edge row so codegraph roles --dynamic can surface them, per an assumption in issue #2042 that extractor-level dynamicKind tagging implies that visibility. Confirmed empirically (both engines agree) that the current behavior — Track A calls resolve into ordinary edges with dynamic_kind=NULL, only flag-only Track B sink edges ever persist dynamic_kind — is the correct, intended architecture per ADR-002's own text: roles --dynamic exists to surface calls that would otherwise be silently dropped, and a resolved Track A call was never at risk of that. It is also not safe to change by threading dynamicKind through resolved edges too: incremental.ts/native-orchestrator.ts already use dynamic_kind IS NULL (alongside technique IS NULL) to find edges due a technique backfill — repurposing the column for Track A would silently exclude those edges from it. Documents this explicitly (DynamicKind's doc comment in types.ts, dynamicCallsData's in roles.ts) and adds a dual-engine regression test locking in the contract, so a future well-intentioned "fix" can't silently reintroduce the technique-backfill regression this avoids. docs check acknowledged: doc-comment clarification only, no CLI, language support, or architecture-table changes.
Contributor
Greptile SummaryThis PR documents that resolved Track A dynamic calls do not persist
Confidence Score: 5/5The PR appears safe to merge because it changes only documentation and focused regression coverage, with no actionable defects identified. The documented Track A and Track B persistence behavior matches the current full, incremental, WASM, and native paths, and the new tests use established isolated integration-test conventions. Important Files Changed
Reviews (1): Last reviewed commit: "docs(dynamic-kind): clarify Track A reso..." | Re-trigger Greptile |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Issue #2270 found (empirically, across every language, including JS's own reference implementation) that Track A resolved dynamic calls (
computed-literal,value-ref,dispatch-table, resolvedreflection) never persistdynamic_kindon their edge row — only flag-only Track B sink edges do. This traces back to an assumption in issue #2042 that extractor-leveldynamicKindtagging implies visibility viacodegraph roles --dynamic. The issue asked to decide between two directions: threaddynamicKindthrough resolved edges too, or explicitly document the current scope.Investigation
Re-read ADR-002 (
docs/architecture/decisions/002-dynamic-call-resolution.md) closely. Its own text already scopescodegraph roles --dynamicto flagged (Track B) calls specifically: "visible in the graph, queryable viacodegraph roles --dynamic, but never polluting normal precision metrics" — describing Track B, not Track A. The CLI help text (--dynamic', 'Show flagged dynamic call sites...') anddynamicCallsData's pre-existing doc comment ("flagged dynamic call sink edges") already say the same. The ADR, CLI help, and function-level docs were all already accurate — the confusion originated in issue #2042's own framing, not in the codebase's documentation.Checked whether threading
dynamicKindthrough resolved edges (the other option) would be safe: it is not, without further changes.incremental.tsandnative-orchestrator.tsboth already usedynamic_kind IS NULL(alongsidetechnique IS NULL) as the signal for "plain edge not yet backfilled with atechniquevalue." Making Track A resolved edges also carrydynamic_kindwould silently exclude them from that backfill — a real, wide-blast-radius side effect for what is fundamentally a diagnostic nice-to-have, not a bug fix.Verified on both engines (fresh builds, direct DB inspection) that
obj["foo"]()resolving successfully producesdynamic=1, dynamic_kind=NULL, confidence=1identically on WASM and native — confirming this is a consistent, intentional, dual-engine-agreed design, not a parity gap.Fix
No functional code change (
diff-impactconfirms zero function-level changes). This closes the issue by:DynamicKind's doc comment (src/types.ts) anddynamicCallsData's doc comment (src/domain/analysis/roles.ts), including thetechnique-backfill risk that makes the "just thread it through" alternative unsafe.tests/integration/issue-2270-track-a-dynamic-kind-scope.test.ts) that locks in the current behavior as an explicit, tested contract — so a future well-intentioned attempt to "fix" this can't silently reintroduce thetechnique-backfill regression without a test forcing a conscious decision.Testing
dynamic_kind=NULL, and it's correctly excluded from thedynamic_kind IS NOT NULLquerycodegraph roles --dynamicuses.node scripts/parity-compare.mjs: 42/42 fixtures identical across engines.npm run lint/cargo fmt --check: clean.Closes #2270