Skip to content

refactor!: fix P9 interface-shape lies in workflow and analytics (#350)#410

Merged
foxzool merged 3 commits into
mainfrom
fix/issue-350-interface-shape-lies
Jul 10, 2026
Merged

refactor!: fix P9 interface-shape lies in workflow and analytics (#350)#410
foxzool merged 3 commits into
mainfrom
fix/issue-350-interface-shape-lies

Conversation

@foxzool

@foxzool foxzool commented Jul 10, 2026

Copy link
Copy Markdown
Owner

Summary

Closes the remaining #350 (P9 interface-shape lies) work after platform/user were fixed earlier.

Migration

// workflow helpers
// before
let r = service.approve_task(action).await?;
if r.success { /* always true on Ok */ }

// after
service.approve_task(action).await?; // Ok = success

// analytics
// before
let s = AnalyticsService::new(config)?;
// after
let s = AnalyticsService::new(config);
// Prefer live search leaves: doc_wiki / schema / app / message / data_source

Test plan

  • cargo test -p openlark-workflow --all-features (incl. new wiremock success + error helpers)
  • cargo test -p openlark-analytics --all-features
  • cargo clippy -p openlark-workflow -p openlark-analytics -p openlark-client --all-targets --all-features -- -Dwarnings
  • cargo clippy -p openlark-workflow -p openlark-analytics --all-targets --no-default-features -- -Dwarnings
  • cargo fmt --all -- --check
  • CI green on this PR

Closes #350


Note

Medium Risk
Breaking public API changes in workflow helpers and analytics construction/search surface; behavior is more honest but callers must migrate off removed types and ? on AnalyticsService::new.

Overview
Breaking API honesty fixes (#350) for workflow and analytics, aligning with earlier platform/user Service::new corrections.

Workflow: approve_task, reject_task, and resubmit_task now return SDKResult<()> instead of always-true ApprovalTaskActionResult { success: true }. The helpers propagate real HTTP/leaf errors and drop the fake success field. Migration: use service.approve_task(...).await? instead of checking r.success.

Analytics: Removes search/v2/query and search/v2/user modules (always-Err stubs with dead setters; no verified Feishu endpoints). AnalyticsService::new changes from SDKResult<Self> to Self; openlark-client analytics init no longer uses ?. Callers should use live search leaves (doc_wiki, schema, app, message, data_source).

Docs, changelog, openspec, examples, and wiremock tests in openlark-workflow lock the new helper contract.

Reviewed by Cursor Bugbot for commit d26625c. Bugbot is set up for automated code reviews on this repo. Configure here.

@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_6ac7aa06-3b88-4762-9d68-9d6feae14771)

@foxzool
foxzool force-pushed the fix/issue-350-interface-shape-lies branch from 5ba13c3 to 89be444 Compare July 10, 2026 04:49
@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_bd43df38-6fd8-4b16-867f-7f310c6d606a)

@foxzool
foxzool force-pushed the fix/issue-350-interface-shape-lies branch from 89be444 to 563fff7 Compare July 10, 2026 05:14
@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_5f7105d4-8600-47d6-9b67-afb9e4a8ff79)

Workflow approve/reject/resubmit helpers returned ApprovalTaskActionResult
with success always true after discarding the real response. Return
SDKResult<()> instead so success/failure is only expressed by Result.

Analytics deleted search/v2 query and user runtime stubs that always
returned Err with dead setters (no verified Feishu endpoints; aligns with

Platform/user Service::new fixes already landed in #373/#360.
@foxzool
foxzool force-pushed the fix/issue-350-interface-shape-lies branch from 563fff7 to 2683a0a Compare July 10, 2026 05:50
@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_26ae3080-b8e6-4874-8a80-99bb1f792f01)

MSRV job copies .github/msrv/Cargo.lock and runs cargo check --locked;
workflow gained wiremock for approve helper e2e tests (#350).
@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_b163a5a9-02ec-4045-b1da-1e63c273e7fd)

- Assert approve/reject/resubmit hit the three Feishu paths via wiremock
- Propagate-error test uses neutral business code 99991400 and matches
  real leaf behavior (Validation on non-zero code without data)
- Clarify analytics stub migration: never wired, user search still absent
- Fix stale #308 alternative paths that pointed at deleted query/user
@cursor

cursor Bot commented Jul 10, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_ce9624ec-3873-40e0-a7ee-4690da2ee987)

@foxzool
foxzool merged commit 53bfdd9 into main Jul 10, 2026
136 of 169 checks passed
@foxzool
foxzool deleted the fix/issue-350-interface-shape-lies branch July 10, 2026 06: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.

[refactor] P9: 接口形状撒谎修正(workflow/platform/analytics/user 4 处)

1 participant