Skip to content

feat(sheet): add verified native image batch writes - #181

Merged
riba2534 merged 2 commits into
riba2534:mainfrom
lishuai-0:feat/sheet-native-image-batch
Sep 22, 2026
Merged

riba2534 merged 2 commits into
riba2534:mainfrom
lishuai-0:feat/sheet-native-image-batch

Conversation

@lishuai-0

Copy link
Copy Markdown

Background

Writing remote images into Feishu Sheets currently requires callers to orchestrate several low-level commands. A common failure mode is writing =IMAGE(url) through the V2 values API: it can be stored as text/link, and even a V3 formula may evaluate to #ERROR when Feishu cannot fetch the remote URL. Callers can therefore report success while no image is actually rendered.

Changes

Add feishu-cli sheet image write-batch with a manifest interface:

[
  {"cell":"B2","url":"https://example.com/1.jpg"},
  {"cell":"B3","path":"/tmp/2.png","name":"product-2.png"}
]

The command:

  • accepts HTTPS URLs or local image paths;
  • validates target cells, duplicate targets, MIME type, regular-file status, and configurable size limits;
  • blocks credentials in URLs and private/loopback/link-local destinations, including DNS rebinding at connect time;
  • downloads/writes with bounded concurrency and retries;
  • writes native Sheet image values instead of IMAGE() formulas;
  • reads targets back through the V3 rich-value API;
  • succeeds only when every target is type=image with an image_token;
  • returns stable per-cell JSON outcomes and exits non-zero for partial failures.

The feishu-cli-data Sheet workflow now recommends this command for all batch image writes.

Verification

  • gofmt -l cmd internal — clean
  • go test ./... — pass
  • go vet ./... — pass
  • make check-skills — pass
  • Built binary smoke test against a real Feishu Sheet:
    • wrote one local image with sheet image write-batch
    • result: written=1, failed=0, verified=true
    • sheet read-rich returned type=image with a non-empty image_token

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@lishuai-0
lishuai-0 force-pushed the feat/sheet-native-image-batch branch 2 times, most recently from 8b06a09 to 1dd6b03 Compare September 22, 2026 03:34
- add 'sheet image write-batch' command with manifest input (file, stdin '-', inline JSON)
- upgrade 'sheet image write-image' command to support HTTPS URLs and -o json output
- decouple core business and orchestration logic into internal/client/sheets_image_batch.go
- enforce native values_image writes with mandatory V3 read-rich image_token verification
- integrate DoVoidWithRetry with rate-limit detection and full jitter backoff
- eliminate SSRF TOCTOU via net.Dialer.Control socket-level IP/Port filtering
- support corporate proxy environments with IP:Port exemption for HTTP/HTTPS/SOCKS5
- add eventual consistency polling retry for replication lag and support merged cell regions
- forbid =IMAGE(...) formula and markdown image syntax in sheet skills
- add comprehensive unit tests, update README quick reference, and add CHANGELOG entry
@lishuai-0
lishuai-0 force-pushed the feat/sheet-native-image-batch branch from 1dd6b03 to 68ad8a2 Compare September 22, 2026 08:21
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.

3 participants