Skip to content

feat(sheets): use office_sheet_file parent_type for imported office spreadsheets#1606

Open
xiongyuanwen-byted wants to merge 8 commits into
mainfrom
feat/sheets-upload-image-compatible
Open

feat(sheets): use office_sheet_file parent_type for imported office spreadsheets#1606
xiongyuanwen-byted wants to merge 8 commits into
mainfrom
feat/sheets-upload-image-compatible

Conversation

@xiongyuanwen-byted

@xiongyuanwen-byted xiongyuanwen-byted commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

Image uploads to a spreadsheet hard-coded parent_type=sheet_image at every entry point. Imported "office" spreadsheets carry a token prefixed with fake_office_, for which the drive backend requires parent_type=office_sheet_file. This PR funnels the parent_type selection through a single sheets-domain helper so the rule lives in one place and every image-upload path stays consistent.

Changes

  • Add sheetMediaParentType(token) in the sheets domain: returns office_sheet_file for fake_office_-prefixed tokens, otherwise sheet_image. Single source of truth for the mapping.
  • Add an uploadSheetImage(...) collector that builds the DriveMediaUploadAllConfig (including parent_type) once, replacing the per-call-site hand-rolled configs.
  • Route both main-domain image entries through the collector — float-image local upload and +cells-set-image — covering Execute and the dry-run preview body/desc.
  • Cover the backward +media-upload entry: single-part, multipart (>20MB), and both dry-run bodies. backward is a separate package and an intentional verbatim mirror of shortcuts/sheets/, so it keeps its own copy of the helper rather than importing the main domain (avoids a cross-package dependency and preserves the mirror).
  • Leave the shared common.UploadDriveMediaAllTyped upload layer untouched — the fake_office_ rule is sheets-specific and must not leak into mail/slides/doc/drive/base.

Test Plan

  • Unit tests pass (go test ./shortcuts/sheets/...)
  • New tests: pure-function TestSheetMediaParentType (6 cases incl. prefix-only and mid-string non-match), main-domain dry-run TestCellsSetImage_DryRunOfficeParentType, and backward real-multipart-body TestSheetMediaUploadExecuteOfficeParentType asserting office_sheet_file + parent_node actually go out on the wire
  • gofmt clean; golangci-lint run --new-from-rev=HEAD reports 0 new issues
  • Manual local verification confirms the lark-cli <domain> <command> flow works as expected

Related Issues

  • None

Summary by CodeRabbit

  • Bug Fixes

    • Fixed sheet image and media uploads to automatically choose the correct Drive upload destination type for native vs imported/office-style spreadsheets, with parent_node matching the provided spreadsheet token.
    • Ensured consistency between dry-run and execute for both floating images and embedded cell image uploads.
  • Tests

    • Added unit and e2e coverage for office-style uploads, including multipart form parent_type/parent_node assertions and dry-run validation.
    • Added execute-path tests and local file-open error handling coverage.

…preadsheets

Image uploads to a spreadsheet hard-coded parent_type=sheet_image at every
entry point. Imported office spreadsheets carry a token prefixed with
fake_office_ and the drive backend requires parent_type=office_sheet_file
for them.

Funnel the selection through a single sheetMediaParentType(token) helper and
an uploadSheetImage collector in the sheets domain so the rule lives in one
place instead of being duplicated per call site. Cover the float-image and
+cells-set-image entries (execute + dry-run) and the backward +media-upload
entry (single-part, multipart, and both dry-run bodies). The common upload
layer is left untouched since the fake_office_ rule is sheets-specific.
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Spreadsheet image uploads now derive Drive parent types from spreadsheet tokens, including fake_office_ imported sheets. Shared upload helpers are reused across float-image and cell-image paths, with tests covering native and office-token behavior.

Changes

Office spreadsheet image uploads

Layer / File(s) Summary
Token mapping and upload helper
shortcuts/sheets/backward/lark_sheets_float_images.go, shortcuts/sheets/helpers.go, shortcuts/sheets/sheet_media_parent_type_test.go
sheetMediaParentType routes fake_office_ spreadsheet tokens to office_sheet_file, uploadSheetImage passes the computed ParentType and ParentNode, and tests cover native, wiki-resolved, empty, and office-prefixed tokens plus multipart request fields.
SheetMediaUpload wiring
shortcuts/sheets/backward/lark_sheets_float_images.go, shortcuts/sheets/backward/lark_sheets_sheet_media_upload_test.go
SheetMediaUpload dry-run and uploadSheetMediaFile execution use token-derived parent_type, and office-token tests check the multipart upload body and parent node.
Float image shortcut
shortcuts/sheets/lark_sheet_object_crud.go
newFloatImageWriteShortcut and uploadFloatImageIfLocal use token-derived parent_type and the shared upload helper for local image uploads.
CellsSetImage upload flow
shortcuts/sheets/lark_sheet_write_cells.go, shortcuts/sheets/lark_sheet_write_cells_test.go
CellsSetImage derives parent_type from the spreadsheet token in dry-run, delegates local uploads to uploadSheetImage, and the office-token dry-run test checks the upload request and call count.
CLI dry-run coverage
tests/cli_e2e/sheets/sheets_image_upload_dryrun_test.go
The e2e dry-run test covers native and office-token variants of +media-upload and +cells-set-image and checks the emitted request fields.

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested Reviewers

  • liangshuo-1
  • fangshuyu-768

Poem

A bunny peeks at sheets all day,
With office tokens finding their way.
One helper hops through upload trails,
And parent types land without fails.
🐇✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.17% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately summarizes the main change to spreadsheet image uploads.
Description check ✅ Passed The description matches the template with Summary, Changes, Test Plan, and Related Issues, and clearly explains scope and verification.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/sheets-upload-image-compatible

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.

@github-actions github-actions Bot added domain/ccm PR touches the ccm domain size/M Single-domain feat or fix with limited business impact labels Jun 26, 2026
@coderabbitai

coderabbitai Bot commented Jun 26, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
{"name":"HttpError","status":500,"request":{"method":"PATCH","url":"https://api.github.com/repos/larksuite/cli/issues/comments/4807248833","headers":{"accept":"application/vnd.github.v3+json","user-agent":"octokit.js/0.0.0-development octokit-core.js/7.0.6 Node.js/24","content-type":"application/json; charset=utf-8"},"body":{"body":"<!-- This is an auto-generated comment: summarize by coderabbit.ai -->\n<!-- review_stack_entry_start -->\n\n[![Review Change Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/larksuite/cli/pull/1606?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)\n\n<!-- review_stack_entry_end -->\n<!-- This is an auto-generated comment: review in progress by coderabbit.ai -->\n\n> [!NOTE]\n> Currently processing new changes in this PR. This may take a few minutes, please wait...\n> \n> <details>\n> <summary>⚙️ Run configuration</summary>\n> \n> **Configuration used**: defaults\n> \n> **Review profile**: CHILL\n> \n> **Plan**: Pro\n> \n> **Run ID**: `0fd976e1-92d5-4183-aa7f-ddc2df37ac98`\n> \n> </details>\n> \n> <details>\n> <summary>📥 Commits</summary>\n> \n> Reviewing files that changed from the base of the PR and between d9330b7ab3dcd6de2fd2944517cc5758cc47f55c and 2f91b5f50ff01f761b92fe0c0923e7c0b53058cb.\n> \n> </details>\n> \n> <details>\n> <summary>📒 Files selected for processing (7)</summary>\n> \n> * `shortcuts/sheets/backward/lark_sheets_float_images.go`\n> * `shortcuts/sheets/backward/lark_sheets_sheet_media_upload_test.go`\n> * `shortcuts/sheets/helpers.go`\n> * `shortcuts/sheets/lark_sheet_object_crud.go`\n> * `shortcuts/sheets/lark_sheet_write_cells.go`\n> * `shortcuts/sheets/lark_sheet_write_cells_test.go`\n> * `shortcuts/sheets/sheet_media_parent_type_test.go`\n> \n> </details>\n> \n> ```ascii\n>  _________________________________________\n> < 💣 Deploying bug fixes in 3... 2... 1... >\n>  -----------------------------------------\n>   \\\n>    \\   \\\n>         \\ /\\\n>         ( )\n>       .( o ).\n> ```\n\n<!-- end of auto-generated comment: review in progress by coderabbit.ai -->\n\n<!-- finishing_touch_checkbox_start -->\n\n<details>\n<summary>✨ Finishing Touches</summary>\n\n<details>\n<summary>📝 Generate docstrings</summary>\n\n- [ ] <!-- {\"checkboxId\": \"7962f53c-55bc-4827-bfbf-6a18da830691\"} --> Create stacked PR\n- [ ] <!-- {\"checkboxId\": \"3e1879ae-f29b-4d0d-8e06-d12b7ba33d98\"} --> Commit on current branch\n\n</details>\n<details>\n<summary>🧪 Generate unit tests (beta)</summary>\n\n- [ ] <!-- {\"checkboxId\": \"f47ac10b-58cc-4372-a567-0e02b2c3d479\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Create PR with unit tests\n- [ ] <!-- {\"checkboxId\": \"6ba7b810-9dad-11d1-80b4-00c04fd430c8\", \"radioGroupId\": \"utg-output-choice-group-unknown_comment_id\"} -->   Commit unit tests in branch `feat/sheets-upload-image-compatible`\n\n</details>\n\n</details>\n\n<!-- finishing_touch_checkbox_end -->\n<!-- tips_start -->\n\n---\n\nThanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=larksuite/cli&utm_content=1606)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.\n\n<details>\n<summary>❤️ Share</summary>\n\n- [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai)\n- [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai)\n- [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai)\n- [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)\n\n</details>\n\n\n<sub>Comment `@coderabbitai help` to get the list of available commands.</sub>\n\n<!-- tips_end -->"},"request":{"retryCount":3,"signal":{},"retries":3,"retryAfter":16}}}

@codecov

codecov Bot commented Jun 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.48148% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.66%. Comparing base (af9835c) to head (6be4744).
⚠️ Report is 10 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/sheets/lark_sheet_object_crud.go 0.00% 3 Missing ⚠️
...rtcuts/sheets/backward/lark_sheets_float_images.go 88.88% 1 Missing ⚠️
shortcuts/sheets/lark_sheet_write_cells.go 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1606      +/-   ##
==========================================
+ Coverage   74.59%   74.66%   +0.06%     
==========================================
  Files         793      806      +13     
  Lines       79069    81391    +2322     
==========================================
+ Hits        58985    60769    +1784     
- Misses      15700    16089     +389     
- Partials     4384     4533     +149     

☔ 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.

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/sheets-upload-image-compatible -y -g

@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/sheets/backward/lark_sheets_float_images.go (1)

65-98: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Use the token-derived parent type in the single-part dry-run branch.

The multipart --dry-run preview was updated, but the small-file /medias/upload_all preview still hardcodes sheet_image. For fake_office_* tokens, +media-upload --dry-run will therefore show the wrong request unless the file is >20MB. Please switch that branch to sheetMediaParentType(parentNode) as well, and add a small regression test for the office-token dry-run path.

Suggested fix
 		return dry.Desc("multipart/form-data upload").
 			POST("/open-apis/drive/v1/medias/upload_all").
 			Body(map[string]interface{}{
 				"file_name":   fileName,
-				"parent_type": sheetImageParentType,
+				"parent_type": sheetMediaParentType(parentNode),
 				"parent_node": parentNode,
 				"size":        "<file_size>",
 				"file":        "@" + filePath,
 			}).
 			Set("spreadsheet_token", parentNode)
🤖 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/sheets/backward/lark_sheets_float_images.go` around lines 65 - 98,
The single-part dry-run preview in the sheet image upload path still hardcodes
the parent type instead of using the token-derived value. Update the
`/medias/upload_all` branch in the same function that builds the dry-run request
to use `sheetMediaParentType(parentNode)` just like the multipart path, so
`fake_office_*` tokens render the correct request; then add a regression test
covering the office-token dry-run case for the single-part path.
🤖 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/sheets/backward/lark_sheets_float_images.go`:
- Around line 65-98: The single-part dry-run preview in the sheet image upload
path still hardcodes the parent type instead of using the token-derived value.
Update the `/medias/upload_all` branch in the same function that builds the
dry-run request to use `sheetMediaParentType(parentNode)` just like the
multipart path, so `fake_office_*` tokens render the correct request; then add a
regression test covering the office-token dry-run case for the single-part path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0fd976e1-92d5-4183-aa7f-ddc2df37ac98

📥 Commits

Reviewing files that changed from the base of the PR and between d9330b7 and 2f91b5f.

📒 Files selected for processing (7)
  • shortcuts/sheets/backward/lark_sheets_float_images.go
  • shortcuts/sheets/backward/lark_sheets_sheet_media_upload_test.go
  • shortcuts/sheets/helpers.go
  • shortcuts/sheets/lark_sheet_object_crud.go
  • shortcuts/sheets/lark_sheet_write_cells.go
  • shortcuts/sheets/lark_sheet_write_cells_test.go
  • shortcuts/sheets/sheet_media_parent_type_test.go

@github-actions

github-actions Bot commented Jun 26, 2026

Copy link
Copy Markdown

PR Quality Summary

CI did not complete successfully. Use the failed check links below to decide whether this PR needs a code change or a rerun.

Failed checks

The dry-run tests never reached the Execute upload path, leaving
uploadSheetImage at 0% and dragging codecov/patch to 50% (below the 60%
gate). Add an Execute-level test that drives uploadSheetImage through a real
multipart request and asserts the wire parent_type per token (native ->
sheet_image, fake_office_ -> office_sheet_file), plus a file-open error case.
Patch coverage now ~83%.

@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.

Actionable comments posted: 2

🤖 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.

Inline comments:
In `@shortcuts/sheets/sheet_media_parent_type_test.go`:
- Around line 109-117: Strengthen TestUploadSheetImage_FileOpenError so it
verifies the exact file-open failure returned by uploadSheetImage, not just that
an error occurred. In the test, assert the typed problem metadata with
errs.ProblemOf (category, subtype, and param) and confirm the original cause is
preserved. Also add an explicit assertion that the upload path was never reached
by proving no upload request was issued, using the uploadSheetImage test
runtime/setup to check the endpoint was not hit.
- Around line 150-156: The multipart body reader in the test helper is
swallowing parse and read failures, which can let malformed uploads pass with
partial data. Update the helper around reader.NextPart() and buf.ReadFrom(part)
to explicitly handle errors: treat only EOF as the loop terminator, and fail the
test immediately on any other NextPart() or ReadFrom() error. Use the multipart
parsing logic in sheet_media_parent_type_test.go to ensure the accumulated body
always reflects a fully valid upload payload.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cea3fccf-10ad-4bca-bd1f-19c04882881c

📥 Commits

Reviewing files that changed from the base of the PR and between 2f91b5f and 00f7bca.

📒 Files selected for processing (1)
  • shortcuts/sheets/sheet_media_parent_type_test.go

Comment thread shortcuts/sheets/sheet_media_parent_type_test.go
Comment thread shortcuts/sheets/sheet_media_parent_type_test.go Outdated
Body(map[string]interface{}{
"file_name": fileName,
"parent_type": sheetImageParentType,
"parent_type": sheetMediaParentType(parentNode),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This fixes the multipart dry-run preview, but the small-file dry-run branch just below still hard-codes sheetImageParentType in the upload_all body. For fake_office_... spreadsheet tokens, that preview will show sheet_image even though execute sends office_sheet_file, which makes dry-run output misleading. Could we use sheetMediaParentType(parentNode) in the small-file branch as well, and add a small-file dry-run test for a fake_office_... token?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 903c60a. The small-file upload_all branch now also uses sheetMediaParentType(parentNode), so dry-run and Execute agree on office_sheet_file for fake_office_-prefixed tokens. Added TestSheetMediaUploadDryRunSmallFileOfficeParentType to pin it — asserts the output contains "office_sheet_file" and not "sheet_image". Thanks for catching this.

Body(map[string]interface{}{
"file_name": fileName,
"parent_type": sheetImageParentType,
"parent_type": sheetMediaParentType(parentNode),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The multipart dry-run now uses sheetMediaParentType(parentNode), but the small-file upload_all dry-run branch just below still emits parent_type: sheetImageParentType. For fake_office_... tokens that preview remains wrong even though Execute uses office_sheet_file, so agents/users following --dry-run will copy the bad request body.

Please mirror this helper in the upload_all body as well and add a fake_office_ small-file dry-run test.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done in 903c60a. The small-file upload_all body now mirrors the multipart branch via sheetMediaParentType(parentNode), and TestSheetMediaUploadDryRunSmallFileOfficeParentType covers the fake_office_ small-file dry-run. Thanks for the catch.

…parent_type

The backward +media-upload multipart dry-run already used
sheetMediaParentType(parentNode), but the small-file upload_all branch
still hard-coded sheet_image. For fake_office_-prefixed tokens that
preview disagreed with Execute (which sends office_sheet_file), so
agents/users copying the dry-run body got a wrong request.

Also strengthen the main-domain uploadSheetImage tests per code review:
assert typed validation metadata (errs.ProblemOf category/subtype) and
fs.ErrNotExist cause preservation on file-open failure (no stub
registered, so any real upload call would surface as a non-validation
category and trip the assertion), and stop the multipart test helper
from silently swallowing NextPart / ReadFrom errors.
AGENTS.md requires a dry-run E2E for every shortcut request-shape
change. The office_sheet_file fix touched three image-upload entries
(+media-upload, +cells-set-image, +create-float-image) but had no
cli_e2e coverage. The new test runs --dry-run for native and
fake_office_ tokens across +media-upload and +cells-set-image and
asserts api.0 is POST /open-apis/drive/v1/medias/upload_all with
parent_type=sheet_image (native) or office_sheet_file (office) and
parent_node equal to the spreadsheet token, so a drift back to a
hard-coded parent_type would fail before merge.
The wiki-resolved-token fixture "Xyz0wABC123def" tripped Gitleaks'
generic high-entropy rule. Swap it for "shtcnWikiResolvedFixture",
which matches the sht-prefixed style the rest of the table already
uses and is obviously not a real credential.

@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.

🧹 Nitpick comments (1)
tests/cli_e2e/sheets/sheets_image_upload_dryrun_test.go (1)

18-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Align the test comment with the cases actually exercised.

Lines 23-25 say this test covers sheets +create-float-image, but the table only exercises +media-upload and +cells-set-image. Please either add the float-image dry-run cases here or narrow the comment so this file does not overstate its coverage.

🤖 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 `@tests/cli_e2e/sheets/sheets_image_upload_dryrun_test.go` around lines 18 -
25, The test comment in TestSheets_ImageUploadDryRunParentType overstates the
covered image-upload surfaces by mentioning sheets +create-float-image even
though the table only exercises sheets +media-upload and sheets
+cells-set-image. Either add the missing float-image dry-run cases to this test,
or update the comment so it only describes the scenarios actually covered by the
existing table and helper setup.
🤖 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.

Nitpick comments:
In `@tests/cli_e2e/sheets/sheets_image_upload_dryrun_test.go`:
- Around line 18-25: The test comment in TestSheets_ImageUploadDryRunParentType
overstates the covered image-upload surfaces by mentioning sheets
+create-float-image even though the table only exercises sheets +media-upload
and sheets +cells-set-image. Either add the missing float-image dry-run cases to
this test, or update the comment so it only describes the scenarios actually
covered by the existing table and helper setup.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bf244a9b-2e5c-4751-8ced-e99dee541a4f

📥 Commits

Reviewing files that changed from the base of the PR and between 903c60a and 194627e.

📒 Files selected for processing (2)
  • shortcuts/sheets/sheet_media_parent_type_test.go
  • tests/cli_e2e/sheets/sheets_image_upload_dryrun_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • shortcuts/sheets/sheet_media_parent_type_test.go

Gitleaks' generic high-entropy rule still flagged the 24-char fixture
token after the rename; tag the line with the standard inline allow
comment so the rule lets it through. Verified locally with gitleaks
8.30.1: "no leaks found".
quality-gate's generic_credential rule rejected the const nativeToken /
officeToken assignments in the new image-upload dry-run E2E (variable
name ends in "Token"). Drop the consts and inline the fixture strings,
matching every other sheets dry-run E2E.

The wiki-resolved fixture also still tripped Gitleaks 8.24.3 on CI
despite the //gitleaks:allow tag (the action's older bundled binary
does not honor it on this rule). Swap the high-entropy string for a
dash-separated form so the rule no longer fires; verified locally with
gitleaks 8.30.1.
The wiki-resolved spreadsheet-token case kept tripping gitleaks'
generic-api-key rule (entropy 3.8 over the 25-char fixture). The
"native spreadsheet token" and "prefix mid-string is not matched"
cases already cover the same non-fake_office_ → sheet_image branch,
so the case is redundant. Removing it lets the security gate pass
without a config carveout.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/ccm PR touches the ccm domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants