Skip to content

change props log info to debug - #1228

Merged
snakajima merged 1 commit into
receptron:mainfrom
isamu:changePropsLog
Sep 15, 2025
Merged

snakajima merged 1 commit into
receptron:mainfrom
isamu:changePropsLog

Conversation

@isamu

@isamu isamu commented Sep 15, 2025 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes
    • Fixed nested data retrieval to correctly return values from deep properties, improving reliability of data-dependent features.
  • Chores
    • Reduced log noise by changing missing nested data messages from info to debug.
  • Style
    • Minor formatting cleanup with no user-facing impact.

@isamu
isamu requested a review from snakajima September 15, 2025 19:07
@coderabbitai

coderabbitai Bot commented Sep 15, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

Adjusted logging from info to debug for missing nested data, added an explicit return in the base case of a recursive data retrieval helper to propagate values, and inserted a non-functional extra newline in the function definition area.

Changes

Cohort / File(s) Summary
Data source utilities
packages/graphai/src/utils/data_source.ts
- Changed log level: info → debug for missing nested data
- Added return in base-case to propagate retrieved value in recursion
- Inserted an extra blank line after function declaration

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Caller
  participant DS as data_source.ts
  participant Logger

  Caller->>DS: getDataFromSource(source, propPath)
  activate DS
  alt propPath has multiple segments
    DS->>DS: innerGetDataFromSource(nextObj, remainingPath)
    note right of DS: Recurses until base case
  else base case (one segment)
    DS->>DS: retrieve value
    note over DS: Explicitly return value
  end
  opt missing nested data
    DS-->>Logger: debug("Missing nested data at ...")
  end
  DS-->>Caller: value or undefined
  deactivate DS
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I burrow through keys in a tidy stack,
Hop-hop recursion, I bring the value back.
Whispered logs, not loud—just debug’s tune,
A trail of crumbs beneath the data moon.
One hop, two hops—return with cheer,
The carrot of truth now crystal clear.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title "change props log info to debug" succinctly and accurately describes the primary change in this PR—switching GraphAILogger.info(...) to GraphAILogger.debug(...) in packages/graphai/src/utils/data_source.ts—while the other edits are minor (an extra newline and a propagated return). It is concise, specific, and meaningful for a teammate scanning history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
packages/graphai/src/utils/data_source.ts (3)

42-48: Short‑circuit when lookup fails to avoid redundant recursion and duplicate logs.

If a segment isn’t found, we currently recurse into undefined and log again for each remaining segment. Early‑return instead and treat null as a miss for consistency.

-    if (ret === undefined) {
-      GraphAILogger.debug(`prop: ${propIds.join(".")} is not hit`);
-    }
-    if (propIds.length > 1) {
-      return innerGetDataFromSource(ret, propIds.slice(1), propFunctions);
-    }
-    return ret;
+    if (propIds.length > 1) {
+      if (isNull(ret)) {
+        GraphAILogger.debug(`prop not found: ${propIds.join(".")}`);
+        return undefined;
+      }
+      return innerGetDataFromSource(ret, propIds.slice(1), propFunctions);
+    }
+    return ret;

37-41: Type-safety: allow undefined input and guard before dereferencing.

We can pass undefined into this function via the recursive call; reflect that in the signature and guard up front.

-const innerGetDataFromSource = (result: ResultData, propIds: string[] | undefined, propFunctions: PropFunction[]): ResultData | undefined => {
-
+const innerGetDataFromSource = (result: ResultData | undefined, propIds: string[] | undefined, propFunctions: PropFunction[]): ResultData | undefined => {
+  if (isNull(result)) {
+    return undefined;
+  }

38-38: Nit: remove stray blank line.

Keeps the function header tight and consistent with the file’s style.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db9527c and fca1872.

📒 Files selected for processing (1)
  • packages/graphai/src/utils/data_source.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
packages/graphai/src/utils/data_source.ts (3)
packages/graphai/lib/utils/data_source.js (2)
  • propId (39-39)
  • getNestedData (7-36)
packages/graphai/src/utils/prop_function.ts (1)
  • propFunctions (157-157)
packages/graphai/src/index.ts (1)
  • GraphAILogger (52-52)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build (22.x)
  • GitHub Check: build (24.x)
🔇 Additional comments (1)
packages/graphai/src/utils/data_source.ts (1)

43-43: Good call: downgrade noisy log to debug.

Switching missing-path logs from info to debug reduces noise without losing diagnosability.

@snakajima
snakajima merged commit 2e4b70d into receptron:main Sep 15, 2025
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.

2 participants