Skip to content

fix(riviere-extract-ts): skip bare function calls in traceCallExpression - #308

Merged
NTCoding merged 2 commits into
mainfrom
fix/trace-call-expression-bare-function-strict-mode
Apr 14, 2026
Merged

NTCoding merged 2 commits into
mainfrom
fix/trace-call-expression-bare-function-strict-mode

Conversation

@NTCoding

@NTCoding NTCoding commented Apr 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • traceCallExpression lacked the property-access guard that processCallExpression has
  • When deep-tracing through non-component code, bare function calls (e.g. fetch(url)) have no receiver object, causing ConnectionDetectionError to be thrown in strict mode (the default when allowIncomplete is not set)
  • Fix: add the same !Node.isPropertyAccessExpression(...) early return that processCallExpression already uses

Root cause

processCallExpression (direct component method scanner) guards against bare calls:

if (!Node.isPropertyAccessExpression(callExpr.getExpression())) {
  return
}

traceCallExpression (deep-trace path through non-component code) was missing this guard. When it encountered fetch(url), getReceiverExpression returned undefined, and with strict: true the code threw instead of skipping.

Test plan

  • Added regression test: bare fetch() in a non-component class body does not throw in strict mode and the component connection is still detected
  • Added coverage test: any-typed receiver call in traced non-component body is skipped cleanly
  • All existing tests pass, 100% coverage maintained

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved call graph detection to correctly handle edge cases involving bare function calls followed by typed method invocations, ensuring proper relationship linking.
    • Enhanced analysis robustness when call expressions are made through untyped helper references, while maintaining accurate detection of subsequent typed method calls.

traceCallExpression lacked the property-access guard that processCallExpression
has. When deep-tracing through non-component code, bare function calls (e.g.
global fetch()) had no receiver, causing ConnectionDetectionError to be thrown
in strict mode (the default).

Adds the same early return guard as processCallExpression and two regression
tests: one confirming no throw in strict mode, one covering the any-typed-
receiver path.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Deploying living-architecture with  Cloudflare Pages  Cloudflare Pages

Latest commit: a50836c
Status: ✅  Deploy successful!
Preview URL: https://ac36b569.living-architecture.pages.dev
Branch Preview URL: https://fix-trace-call-expression-ba.living-architecture.pages.dev

View logs

@coderabbitai

coderabbitai Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@NTCoding has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 44 minutes and 51 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 44 minutes and 51 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7ebc9e50-b590-48ac-96b5-3fdaa7936b7c

📥 Commits

Reviewing files that changed from the base of the PR and between d40c783 and a50836c.

📒 Files selected for processing (1)
  • packages/riviere-extract-ts/project.json
📝 Walkthrough

Walkthrough

The changes add coverage tests for call graph tracing behavior and introduce an early guard in traceCallExpression that filters out non-PropertyAccessExpression call expressions, preventing unnecessary type resolution logic from executing for incompatible call expression types.

Changes

Cohort / File(s) Summary
Call Graph Tracing Tests
packages/riviere-extract-ts/src/features/extraction/domain/connection-detection/call-graph/build-call-graph.coverage.spec.ts
Adds two coverage tests validating call graph behavior when encountering bare function calls and any-typed helper calls. Verifies that typed method calls still produce correct links while untyped calls are skipped.
Trace Calls Implementation
packages/riviere-extract-ts/src/features/extraction/domain/connection-detection/call-graph/trace-calls.ts
Introduces early guard in traceCallExpression to return immediately unless the call expression is a PropertyAccessExpression, preventing downstream type resolution for incompatible call types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 Through call graphs we hop with care,
A guard ensures we filter fair,
Property paths we trace with glee,
While bare calls pass so wild and free,
The graph grows strong and crystal clear! 🌳✨

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a guard to skip bare function calls in traceCallExpression, which is the core fix addressing the missing property-access check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/trace-call-expression-bare-function-strict-mode

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

The dependsOn referenced '@living-architecture/riviere-role-enforcement:build'
(npm package name) but NX resolves project references by NX project name.
NX silently ignores unresolvable references, so riviere-role-enforcement:build
never ran in CI, leaving dist/index.js absent when role-check executed.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@sonarqubecloud

Copy link
Copy Markdown

@NTCoding
NTCoding merged commit 5c0c94f into main Apr 14, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant