Skip to content

fix: parsing empty whiteboard#1391

Merged
syh-cpdsss merged 1 commit into
mainfrom
fix/query_empty_whiteboard
Jun 11, 2026
Merged

fix: parsing empty whiteboard#1391
syh-cpdsss merged 1 commit into
mainfrom
fix/query_empty_whiteboard

Conversation

@syh-cpdsss

@syh-cpdsss syh-cpdsss commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

Fixed a minor problem inrtoduced in PR#1236(#1236) that causing querying empty whiteboard emiting errors.

Summary by CodeRabbit

  • Refactor

    • Deferred strict presence checks for whiteboard node data so incomplete responses are handled later in processing.
  • Bug Fixes

    • Responses missing node listings are now treated as an empty whiteboard; the command succeeds and displays a "whiteboard is empty" message instead of an error.
  • Tests

    • Added test coverage confirming missing-node responses are accepted and report an empty whiteboard.

@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label Jun 11, 2026
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8531fe86-adcc-4026-af32-0cbd2cd087d4

📥 Commits

Reviewing files that changed from the base of the PR and between 4b39b03 and cc26d67.

📒 Files selected for processing (2)
  • shortcuts/whiteboard/whiteboard_query.go
  • shortcuts/whiteboard/whiteboard_query_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • shortcuts/whiteboard/whiteboard_query.go

📝 Walkthrough

Walkthrough

Removes explicit error on missing data.nodes in fetchWhiteboardNodes; test suite updated to remove the missing-nodes invalid case and add a test asserting missing nodes is treated as an empty whiteboard with a corresponding message.

Changes

Whiteboard nodes field validation

Layer / File(s) Summary
fetchWhiteboardNodes lookup change
shortcuts/whiteboard/whiteboard_query.go
fetchWhiteboardNodes changes data["nodes"] lookup from a presence-checked access that returned wbInvalidResponse to an unchecked assignment, deferring missing-node detection to later logic.
Remove missing-nodes invalid case in tests
shortcuts/whiteboard/whiteboard_query_test.go
Deleted the table case that treated a missing nodes field as an invalid response in TestFetchWhiteboardNodes_InvalidResponseTypedError.
Add test: missing nodes treated as empty
shortcuts/whiteboard/whiteboard_query_test.go
Adds TestFetchWhiteboardNodes_MissingNodesIsEmpty which mocks a /nodes response without nodes, asserts success, and checks stdout for the “whiteboard is empty” message.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

size/M

Suggested reviewers

  • ZKHelloworld
  • zkh-bytedance

Poem

I nibble at the whitespace lines,
A missing node — no alarms this time.
The board is empty, still I cheer,
A quiet map, the path is clear.
🐇✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description is minimal but addresses the core issue. However, it lacks the structured sections from the template including detailed Summary, Changes list, Test Plan with checkboxes, and Related Issues. Expand the description to follow the template structure: add a detailed summary, itemize changes, confirm test verification with checkboxes, and explicitly note PR#1236 under Related Issues.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: parsing empty whiteboard' directly aligns with the main change: modifying how fetchWhiteboardNodes handles missing nodes field to treat it as empty rather than an error.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/query_empty_whiteboard

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

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
shortcuts/whiteboard/whiteboard_query.go (1)

187-194: ⚠️ Potential issue | 🔴 Critical

Fix TestFetchWhiteboardNodes_InvalidResponseTypedError for the “missing nodes” case

  • fetchWhiteboardNodes now treats absent data.nodes as an empty board (returns &wbNodesResp{} with Data.Nodes == nil), since it only validates data.nodes when present.
  • shortcuts/whiteboard/whiteboard_query_test.go still has a "missing nodes" case (data: map[string]interface{}{}) that calls assertInvalidResponse(t, err) and expects errs.SubtypeInvalidResponse, so it will fail.
  • Update the "missing nodes" test to expect success/empty handling (consistent with the existing empty-board shortcut tests).
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@shortcuts/whiteboard/whiteboard_query.go` around lines 187 - 194, Update the
test case inside TestFetchWhiteboardNodes_InvalidResponseTypedError for the
"missing nodes" scenario to expect success/empty handling instead of an
invalid-response error: call fetchWhiteboardNodes and assert it returns a nil
error (or success) and a &wbNodesResp{}-like response where Data.Nodes == nil
(i.e., treat absent data["nodes"] as an empty board), replacing the current
assertInvalidResponse/errs.SubtypeInvalidResponse expectation.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@shortcuts/whiteboard/whiteboard_query.go`:
- Around line 187-194: Update the test case inside
TestFetchWhiteboardNodes_InvalidResponseTypedError for the "missing nodes"
scenario to expect success/empty handling instead of an invalid-response error:
call fetchWhiteboardNodes and assert it returns a nil error (or success) and a
&wbNodesResp{}-like response where Data.Nodes == nil (i.e., treat absent
data["nodes"] as an empty board), replacing the current
assertInvalidResponse/errs.SubtypeInvalidResponse expectation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3342ea67-be83-42fa-a74f-1551370aa6fc

📥 Commits

Reviewing files that changed from the base of the PR and between 6d8dc40 and 4b39b03.

📒 Files selected for processing (1)
  • shortcuts/whiteboard/whiteboard_query.go

@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@cc26d6781e16e22f97eec63cdeaffa674db4856f

🧩 Skill update

npx skills add larksuite/cli#fix/query_empty_whiteboard -y -g

Change-Id: I10082f89c36ed77e77e1d016be263e0f7369b7b3
@syh-cpdsss syh-cpdsss force-pushed the fix/query_empty_whiteboard branch from 4b39b03 to cc26d67 Compare June 11, 2026 03:06
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.74%. Comparing base (6d8dc40) to head (cc26d67).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1391      +/-   ##
==========================================
- Coverage   72.74%   72.74%   -0.01%     
==========================================
  Files         730      730              
  Lines       69031    69029       -2     
==========================================
- Hits        50220    50218       -2     
  Misses      15037    15037              
  Partials     3774     3774              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@syh-cpdsss syh-cpdsss merged commit 483043c into main Jun 11, 2026
21 checks passed
@syh-cpdsss syh-cpdsss deleted the fix/query_empty_whiteboard branch June 11, 2026 03:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants