Question 180
A codebase search for getInvoice shows references in many files, but the runtime invocation is hidden behind re-exported wrappers. The engineer wants to trace the real implementation without changing code. Which THREE investigative steps are appropriate? (SELECT THREE)
Explanation
Correct Answers
Grep can reveal which files define, call, or re-export the symbol, providing concrete paths for following the chain. It is the efficient content-discovery step when package names alone are insufficient. The resulting matches should be interpreted carefully because comments and type declarations can resemble runtime references. This information narrows the set of files that require a deeper Read. It does not, by itself, prove which function eventually executes.
Search hits provide only fragments of the execution path. Reading the function body, imported dependencies, and control-flow context makes it possible to distinguish a public wrapper from the actual implementation. Targeted reads also reveal argument transformations and error paths that could alter runtime behavior. The investigation should cite these observed modules instead of assuming the first textual match is the operational endpoint.
Re-export layers can conceal a function's location even after finding the public symbol. Following the chain through intermediary modules establishes which implementation is imported at runtime and which wrappers alter parameters or results. Combine the links found by Grep with file context from Read, documenting the path for later review. This step is distinct from mere symbol discovery: it resolves the actual dependency chain, avoiding a mistaken patch to a forwarding export.
Incorrect Answers
The engineer asked for tracing rather than changing code. Creating another function could shadow the existing implementation and make investigation harder. The next steps should be read-only and based on current source evidence. Investigation must use the present implementation as evidence.
Deleting files is destructive and would modify the module graph that is being investigated. The engineer has not authorized changes and duplicate-looking exports may be intentional. Read the import/export chain instead of altering it. The observed graph should be documented, not changed.
File naming conventions are not a reliable indicator of execution order or symbol resolution. The shortest path may only expose the public API. Tracing should follow source imports to the real implementation rather than using superficial file attributes. Imports, not filename length, determine binding.