Skip to content

feat: add apps database sync shortcuts for Base-to-database import - #2251

Merged
jinjiuzhe merged 14 commits into
mainfrom
feat/data-sync-openapi-cli
Aug 11, 2026
Merged

feat: add apps database sync shortcuts for Base-to-database import#2251
jinjiuzhe merged 14 commits into
mainfrom
feat/data-sync-openapi-cli

Conversation

@jinjiuzhe

@jinjiuzhe jinjiuzhe commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add the apps +db-sync-* shortcut family for Base-to-database sync: preview, create (batch/streaming), list, get, enable/disable, update, delete. This lets AI agents import a Base table into a Miaoda app database and manage the resulting sync tasks, with validation
and error hints tuned so agents recover from common failures without guessing.

Changes

  • Add apps +db-sync-create/list/get/enable/disable/update/delete shortcuts under shortcuts/apps/ (env in request body, POST for enable/disable/delete, task_id/config in body).
  • source contract: reject create locally when source.base_url has no ?table= and source.table.name is empty (point at base +table-list); document that source.table.name takes precedence over the base_url token.
  • Error guidance: online-DDL hint for code 500002776 + subcode k_dl_4000001 (multi-env apps must create on --environment dev); 500002783 hint to add a unique text column via +db-execute before retrying.
  • field_maps on create: allow omitted or empty so the server auto-matches and creates the task; update still requires an enabled mapping; reject an all-disabled or non-array field_maps.
  • Environment default: db-sync commands use online when --environment is omitted; help text, comments, and skill docs aligned.
  • Docs and tests: skills/lark-apps/references/lark-apps-db.md, unit contracts in shortcuts/apps/db_common_test.go and apps_db_sync_create_update_test.go, dry-run E2E in tests/cli_e2e/apps/apps_db_sync_dryrun_test.go.

Test Plan

  • make unit-test passed (go test ./shortcuts/apps/...)
  • validate passed (build + vet + unit + integration)
  • dry-run E2E passed (tests/cli_e2e/apps db-sync suite)
  • acceptance-reviewer passed
  • manual verification: lark-cli apps +db-sync-create ... --dry-run confirmed create without field_maps passes and CLI does not inject field_maps; update without field_maps is rejected

Related Issues

N/A

Summary by CodeRabbit

  • New Features
    • Added commands to create, list, inspect, update, enable, disable, and delete Base-to-database synchronization tasks.
    • Added preview and dry-run workflows, configuration validation, environment selection, filtering, pagination, and formatted task details.
    • Added support for batch and streaming task management, source-table resolution, and actionable synchronization error guidance.
  • Documentation
    • Documented synchronization workflows, configuration rules, lifecycle behavior, and recovery guidance.
  • Tests
    • Added comprehensive coverage for validation, requests, previews, outputs, confirmations, and error handling.

jinjiuzhe and others added 10 commits August 4, 2026 16:28
Add Base-to-database sync shortcuts for preview, create, list, get, enable, disable, update, and delete flows.

Cover OpenAPI request contracts, typed sync error classification, dry-run E2E coverage, and lark-apps skill guidance.

Co-authored-by: TRAE CLI <noreply@bytedance.com>
The enable/disable/delete/update sync commands placed task_id (and
update's config) in query params, but the OpenAPI contract binds these
fields via api.json (request body). BOE testing returned
"field validation failed" (99992402) because the body was empty.

Move task_id to the request body for enable/disable/delete, and move
both task_id and config to the body for update. Dry-run previews now
render these under body, and unit tests pin the body binding so a
regression to query params fails.
The delete command issued an HTTP DELETE to db/sync_del, but the
action-style endpoint is registered as POST (like sync_create and
sync_disable). The method mismatch made the gateway return a plaintext
404, surfacing as "API returned a non-object JSON response".

Switch the request and dry-run preview to POST, and pin the method in
the delete unit tests so a regression to DELETE fails.
The +db-sync-create and +db-sync-update endpoints read env from the
request body (peer of config/preview/task_id), not the query string.
Placing env in query params left the body env empty, so the server
treated every request as online and rejected DDL operations
(code 500002776: forbid ddl/dcl operation in online env), making it
impossible to create/update sync tasks against a dev environment.

Move env into the request body via a new dbEnvBody helper that mirrors
dbEnvParams' omit-empty contract, so unset env still lets the server
auto-select the branch. Pin the contract in unit and e2e dry-run tests
by asserting body.env and that env is absent from query params.
The enable/disable/delete dry-run e2e still asserted the pre-migration
wire shape: delete on DELETE and task_id in query params. The shortcuts
now POST these actions with task_id in the request body (commits moving
task_id and the delete verb), so the stale assertions failed against a
current binary.

Assert POST + body.task_id and that task_id is absent from query params,
pinning the same body-over-query contract the env fix established.
Refine +db-sync-create/update validation, error hints, and docs so AI
agents recover from common Base-to-database sync failures without guessing:

- source.table.name: document that a user-named table must be set, name
  takes precedence over the base_url ?table= token; fix test fixtures that
  used a fictional source.table.url instead of source.base_url.
- Preflight source table locate: reject create locally when base_url has no
  ?table= and source.table.name is empty, pointing at base +table-list.
- Online DDL ban: attach a precise hint for code 500002776 + subcode
  k_dl_4000001 telling multi-env apps to create tables on --environment dev.
- Missing record-id column: extend the 500002783 hint to add a unique text
  column via +db-execute before retrying.
- Optional field_maps on create: allow omitted or empty field_maps so the
  server auto-matches and creates the task; keep update requiring an enabled
  mapping and still reject an all-disabled array.
- Environment default: db-sync commands use online when --environment is
  omitted; align help text, comments, and skill docs.
@jinjiuzhe
jinjiuzhe requested a review from liangshuo-1 as a code owner August 10, 2026 03:58
@CLAassistant

CLAassistant commented Aug 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the size/L Large or sensitive change across domains or core paths label Aug 10, 2026
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Added seven Apps database-sync shortcuts for creation, inspection, listing, updates, lifecycle operations, and deletion. Added shared configuration validation, API error guidance, Spark error metadata, end-to-end tests, registration, and workflow documentation.

Changes

Database synchronization

Layer / File(s) Summary
Sync contracts and validation
internal/errclass/*, shortcuts/apps/db_common.*
Added endpoint builders, environment handling, configuration validation, source-table checks, field-map rules, error hints, and Spark error classifications.
Create and update workflows
shortcuts/apps/apps_db_sync_create.go, shortcuts/apps/apps_db_sync_update.go, shortcuts/apps/apps_db_sync_create_update_test.go
Added preview, commit, update, confirmation, request-body, resolved-config, task-summary, and validation flows.
List and get task workflows
shortcuts/apps/apps_db_sync_list.go, shortcuts/apps/apps_db_sync_get.go, shortcuts/apps/apps_db_sync_list_get_test.go
Added task listing, filtering, pagination, retrieval, formatted output, warnings, and not-found hints.
Task lifecycle operations
shortcuts/apps/apps_db_sync_operate.go, shortcuts/apps/apps_db_sync_operate_test.go
Added enable, disable, and delete commands with dry-run support, confirmation rules, execution output, and error hints.
Registration and workflow coverage
shortcuts/apps/shortcuts.go, shortcuts/apps/shortcuts_test.go, tests/cli_e2e/apps/apps_db_sync_dryrun_test.go, skills/lark-apps/*
Registered the commands, updated shortcut counts, added end-to-end request tests, and documented synchronization workflows and restrictions.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant AppsDBSyncCreate
  participant DataSyncAPI
  participant Output
  CLI->>AppsDBSyncCreate: validate config and flags
  AppsDBSyncCreate->>DataSyncAPI: submit preview or create request
  DataSyncAPI-->>AppsDBSyncCreate: return resolved config or task response
  AppsDBSyncCreate->>Output: write config or print task summary
Loading

Suggested reviewers: liangshuo-1

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.87% 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 clearly summarizes the main change: adding Apps database sync shortcuts for Base-to-database import.
Description check ✅ Passed The description covers the summary, changes, test plan, and related issues, with detailed scope and verification results.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/data-sync-openapi-cli

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.

@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: 4

🧹 Nitpick comments (5)
shortcuts/apps/db_common.go (1)

554-576: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Classify a non-object field_maps element as invalid, not disabled.

The loop skips any element that is not a map[string]interface{}. An array such as ["a", "b"] therefore returns dbSyncFieldMapsDisabled, and the caller reports "has mappings but all are disabled". That message does not describe the fault. Return dbSyncFieldMapsInvalid for a non-object element.

♻️ Proposed refactor
 	for _, item := range items {
 		mapping, ok := item.(map[string]interface{})
 		if !ok {
-			continue
+			return dbSyncFieldMapsInvalid
 		}
🤖 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/apps/db_common.go` around lines 554 - 576, Update classifyFieldMaps
so any non-map element encountered in the items loop immediately returns
dbSyncFieldMapsInvalid; preserve the existing handling for valid mappings and
disabled entries.
shortcuts/apps/apps_db_sync_list_get_test.go (1)

23-33: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Reuse dbSyncFirstDryRunAPI instead of indexing env.API[0].

The dry-run tests index env.API[0] directly at Lines 27, 53, and 181. If the envelope carries no API entry, the test panics with an index-out-of-range error instead of reporting the missing call. dbSyncFirstDryRunAPI in shortcuts/apps/apps_db_sync_create_update_test.go already checks the count and reports the raw stdout. Both files are in package apps, so the helper is reachable.

🤖 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/apps/apps_db_sync_list_get_test.go` around lines 23 - 33, Update
the dry-run tests in apps_db_sync_list_get_test.go to use the existing
dbSyncFirstDryRunAPI helper instead of indexing env.API[0] at the referenced
assertions. Preserve the current method, URL, and parameter checks while relying
on the helper’s API-count validation and stdout diagnostics.
shortcuts/apps/db_common_test.go (1)

303-322: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Assert category and subtype in the shared validation helper.

The helper asserts Param and message text only. The coding guidelines require error-path tests to assert typed metadata (category, subtype, param) and to verify cause preservation. Add errs.ProblemOf assertions for Category and Subtype. Add a cause assertion for the malformed-JSON case at Line 127, where parseDBSyncConfigFlag attaches WithCause(err).

💚 Proposed addition
 	if validationErr.Param != "--config" {
 		t.Fatalf("Param = %q, want --config", validationErr.Param)
 	}
+	p, ok := errs.ProblemOf(err)
+	if !ok || p.Category != errs.CategoryValidation || p.Subtype != errs.SubtypeInvalidArgument {
+		t.Fatalf("problem = %+v, want validation/invalid_argument", p)
+	}

As per coding guidelines: "Error-path tests must assert typed metadata through errs.ProblemOf (category, subtype, and param) and verify cause preservation rather than relying only on message substrings."

🤖 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/apps/db_common_test.go` around lines 303 - 322, Update
assertDBSyncConfigValidation to inspect the typed problem via errs.ProblemOf and
assert the expected Category, Subtype, and Param instead of checking Param
directly. In the malformed-JSON test around parseDBSyncConfigFlag, assert that
the resulting validation error preserves the original parsing error as its
cause.

Source: Coding guidelines

shortcuts/apps/apps_db_sync_operate_test.go (1)

142-150: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Error-path tests assert message substrings instead of typed metadata. Both tests match on err.Error() text, so a wording change breaks them and a category or subtype regression does not. The package already provides typed helpers (requireAppsProblem, requireAppsValidationProblem, errs.ProblemOf).

  • shortcuts/apps/apps_db_sync_operate_test.go#L142-L150: replace the "requires confirmation" substring check with requireAppsProblem(t, err, errs.CategoryConfirmation) and an errs.SubtypeConfirmationRequired assertion.
  • shortcuts/apps/apps_db_sync_list_get_test.go#L86-L97: assert the typed problem category and subtype plus the failing parameter for the invalid --mode value, and keep the enum text check as a secondary assertion.

As per coding guidelines: "Error-path tests must assert typed metadata through errs.ProblemOf (category, subtype, and param) and verify cause preservation rather than relying only on message substrings."

🤖 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/apps/apps_db_sync_operate_test.go` around lines 142 - 150, Update
TestAppsDBSyncDeleteRequiresConfirmation in
shortcuts/apps/apps_db_sync_operate_test.go:142-150 to validate the typed
confirmation problem with requireAppsProblem and errs.CategoryConfirmation, then
assert errs.SubtypeConfirmationRequired instead of matching err.Error(). Update
the invalid --mode test in shortcuts/apps/apps_db_sync_list_get_test.go:86-97 to
assert category, subtype, and failing parameter through the existing typed
helpers/errs.ProblemOf, preserve the enum-text check as a secondary assertion,
and verify cause preservation as required by the error-path testing guidelines.

Source: Coding guidelines

shortcuts/apps/apps_db_sync_create.go (1)

123-138: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use ResolvePath to report the saved output path.

FileIO.Save returns fileio.SaveResult, whose current API only exposes written bytes through Size(), not the destination path. Report the canonical path after saving, as the interface comment suggests with FileIO.ResolvePath. Drop the dead saved assignment if the result stays unused.

🤖 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/apps/apps_db_sync_create.go` around lines 123 - 138, After the
successful FileIO.Save call in the output handling flow, call
rctx.FileIO().ResolvePath with output and report the resolved canonical path in
the preview output. Remove the unused saved variable and retain the existing
validation error handling for Save failures.
🤖 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/apps/apps_db_sync_get.go`:
- Around line 88-93: Update the batch rendering in the surrounding function to
pass schema_only through the existing dashIfEmpty helper instead of fmt.Sprint,
and revise dbSyncSummary to render map entries as deterministic key=value pairs
using sorted keys; add the required sort import and preserve the existing
summary behavior for empty or non-map values.

In `@shortcuts/apps/db_common.go`:
- Around line 449-467: Update the field_maps validation around classifyFieldMaps
so dbSyncFieldMapsInvalid is rejected regardless of requireFieldMaps, including
preview calls to parseDBSyncConfigFlag. Keep the existing disabled and absent
mapping policy checks conditional on requireFieldMaps, while ensuring malformed
values such as objects or null are reported immediately.

In `@skills/lark-apps/references/lark-apps-db.md`:
- Line 40: Update the high-risk operations guidance at
skills/lark-apps/references/lark-apps-db.md:40-40 to require --yes for
+db-sync-create only when it performs creation, excluding --preview; likewise
update the agent rule at skills/lark-apps/references/lark-apps-db.md:275-275 to
explicitly preserve this preview exception.

In `@tests/cli_e2e/apps/apps_db_sync_dryrun_test.go`:
- Around line 197-224: Strengthen the validation tests in
TestAppsDBSyncCreate...RequiresSourceTable and the preceding singular-field-map
test to assert exit code 2, empty stdout, and the structured stderr envelope.
Validate category and subtype via errs.ProblemOf, extract Param with errors.As
into *errs.ValidationError, and assert the original cause is preserved. Avoid
accepting diagnostics from either stream or relying only on message fragments.

---

Nitpick comments:
In `@shortcuts/apps/apps_db_sync_create.go`:
- Around line 123-138: After the successful FileIO.Save call in the output
handling flow, call rctx.FileIO().ResolvePath with output and report the
resolved canonical path in the preview output. Remove the unused saved variable
and retain the existing validation error handling for Save failures.

In `@shortcuts/apps/apps_db_sync_list_get_test.go`:
- Around line 23-33: Update the dry-run tests in apps_db_sync_list_get_test.go
to use the existing dbSyncFirstDryRunAPI helper instead of indexing env.API[0]
at the referenced assertions. Preserve the current method, URL, and parameter
checks while relying on the helper’s API-count validation and stdout
diagnostics.

In `@shortcuts/apps/apps_db_sync_operate_test.go`:
- Around line 142-150: Update TestAppsDBSyncDeleteRequiresConfirmation in
shortcuts/apps/apps_db_sync_operate_test.go:142-150 to validate the typed
confirmation problem with requireAppsProblem and errs.CategoryConfirmation, then
assert errs.SubtypeConfirmationRequired instead of matching err.Error(). Update
the invalid --mode test in shortcuts/apps/apps_db_sync_list_get_test.go:86-97 to
assert category, subtype, and failing parameter through the existing typed
helpers/errs.ProblemOf, preserve the enum-text check as a secondary assertion,
and verify cause preservation as required by the error-path testing guidelines.

In `@shortcuts/apps/db_common_test.go`:
- Around line 303-322: Update assertDBSyncConfigValidation to inspect the typed
problem via errs.ProblemOf and assert the expected Category, Subtype, and Param
instead of checking Param directly. In the malformed-JSON test around
parseDBSyncConfigFlag, assert that the resulting validation error preserves the
original parsing error as its cause.

In `@shortcuts/apps/db_common.go`:
- Around line 554-576: Update classifyFieldMaps so any non-map element
encountered in the items loop immediately returns dbSyncFieldMapsInvalid;
preserve the existing handling for valid mappings and disabled entries.
🪄 Autofix

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 Plus

Run ID: cb387b2c-8b7c-4298-834f-9754c16b6479

📥 Commits

Reviewing files that changed from the base of the PR and between 199762b and 2c6cd0c.

📒 Files selected for processing (17)
  • internal/errclass/codemeta_spark.go
  • internal/errclass/codemeta_spark_test.go
  • shortcuts/apps/apps_db_sync_create.go
  • shortcuts/apps/apps_db_sync_create_update_test.go
  • shortcuts/apps/apps_db_sync_get.go
  • shortcuts/apps/apps_db_sync_list.go
  • shortcuts/apps/apps_db_sync_list_get_test.go
  • shortcuts/apps/apps_db_sync_operate.go
  • shortcuts/apps/apps_db_sync_operate_test.go
  • shortcuts/apps/apps_db_sync_update.go
  • shortcuts/apps/db_common.go
  • shortcuts/apps/db_common_test.go
  • shortcuts/apps/shortcuts.go
  • shortcuts/apps/shortcuts_test.go
  • skills/lark-apps/SKILL.md
  • skills/lark-apps/references/lark-apps-db.md
  • tests/cli_e2e/apps/apps_db_sync_dryrun_test.go

Comment thread shortcuts/apps/apps_db_sync_get.go
Comment thread shortcuts/apps/db_common.go
Comment thread skills/lark-apps/references/lark-apps-db.md Outdated
Comment thread tests/cli_e2e/apps/apps_db_sync_dryrun_test.go
The backend moved the seven db-sync error codes from the 5000027xx
server-error range to the 4000024xx client-input range to reflect that
they are client-input errors. Mirror the new codes in the CLI so error
classification and recovery hints keep matching:

- 500002783 -> 400002477 (mapping invalid)
- 500002784 -> 400002478 (target schema mismatch)
- 500002785 -> 400002479 (operation not allowed)
- 500002786 -> 400002480 (task not found)
- 500002787 -> 400002481 (invalid task id)
- 500002788 -> 400002482 (source table not found)
- 500002789 -> 400002483 (target table not found)

Category, subtype, hint text, and behavior are unchanged; 500002776
(online DDL ban) is untouched.
…i-cli

# Conflicts:
#	internal/errclass/codemeta_spark.go
#	internal/errclass/codemeta_spark_test.go
#	shortcuts/apps/shortcuts_test.go
@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@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: 3

🤖 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/apps/apps_db_sync_list_get_test.go`:
- Around line 91-96: Update the invalid --mode test assertions to inspect the
typed error via errs.ProblemOf, verifying the expected validation category and
subtype instead of relying only on message text. Use errors.As to extract
*errs.ValidationError and assert its Param is "--mode"; if the validation path
wraps a cause, also verify that cause is preserved while retaining the existing
allowed-value checks as appropriate.

In `@skills/lark-apps/references/lark-apps-db.md`:
- Line 206: Update the “失败恢复” guidance to branch on task mode: recommend
+db-sync-update only when mode=streaming, while for mode=batch instruct the user
to inspect the result and create a new task when needed. Keep the existing log
inspection and authorization guidance, but ensure the fixed command chain does
not suggest +db-sync-update for batch tasks.
- Around line 133-134: Update all sync preview, create, recovery, and update
command examples to pass the same explicit task environment consistently,
including the get commands and commands currently defaulting to online. Preserve
the existing environment value used by each task, and ensure every command in
the documented workflow uses that value rather than omitting --environment.
🪄 Autofix

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 Plus

Run ID: 2d14581d-5252-4281-851c-b5fd8b973c26

📥 Commits

Reviewing files that changed from the base of the PR and between 2016120 and 40076d9.

📒 Files selected for processing (17)
  • internal/errclass/codemeta_spark.go
  • internal/errclass/codemeta_spark_test.go
  • shortcuts/apps/apps_db_sync_create.go
  • shortcuts/apps/apps_db_sync_create_update_test.go
  • shortcuts/apps/apps_db_sync_get.go
  • shortcuts/apps/apps_db_sync_list.go
  • shortcuts/apps/apps_db_sync_list_get_test.go
  • shortcuts/apps/apps_db_sync_operate.go
  • shortcuts/apps/apps_db_sync_operate_test.go
  • shortcuts/apps/apps_db_sync_update.go
  • shortcuts/apps/db_common.go
  • shortcuts/apps/db_common_test.go
  • shortcuts/apps/shortcuts.go
  • shortcuts/apps/shortcuts_test.go
  • skills/lark-apps/SKILL.md
  • skills/lark-apps/references/lark-apps-db.md
  • tests/cli_e2e/apps/apps_db_sync_dryrun_test.go
🚧 Files skipped from review as they are similar to previous changes (12)
  • internal/errclass/codemeta_spark.go
  • shortcuts/apps/shortcuts.go
  • shortcuts/apps/apps_db_sync_list.go
  • shortcuts/apps/apps_db_sync_update.go
  • shortcuts/apps/db_common.go
  • shortcuts/apps/apps_db_sync_create.go
  • tests/cli_e2e/apps/apps_db_sync_dryrun_test.go
  • shortcuts/apps/apps_db_sync_create_update_test.go
  • shortcuts/apps/apps_db_sync_get.go
  • shortcuts/apps/db_common_test.go
  • shortcuts/apps/apps_db_sync_operate.go
  • shortcuts/apps/apps_db_sync_operate_test.go

Comment thread shortcuts/apps/apps_db_sync_list_get_test.go
Comment thread skills/lark-apps/references/lark-apps-db.md
Comment thread skills/lark-apps/references/lark-apps-db.md Outdated
@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/data-sync-openapi-cli -y -g

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.03101% with 134 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.45%. Comparing base (2016120) to head (f704888).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/apps/apps_db_sync_create.go 47.61% 45 Missing and 10 partials ⚠️
shortcuts/apps/apps_db_sync_operate.go 70.58% 13 Missing and 7 partials ⚠️
shortcuts/apps/apps_db_sync_get.go 78.82% 9 Missing and 9 partials ⚠️
shortcuts/apps/db_common.go 88.46% 9 Missing and 9 partials ⚠️
shortcuts/apps/apps_db_sync_update.go 64.70% 6 Missing and 6 partials ⚠️
shortcuts/apps/apps_db_sync_list.go 81.96% 7 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2251      +/-   ##
==========================================
+ Coverage   76.36%   76.45%   +0.09%     
==========================================
  Files        1011     1018       +7     
  Lines      111269   112595    +1326     
==========================================
+ Hits        84970    86089    +1119     
- Misses      19815    19948     +133     
- Partials     6484     6558      +74     

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

Address review follow-ups on the db-sync shortcuts:

- +db-sync-get pretty output no longer prints <nil> for a missing
  schema_only nor Go map syntax for statistics; render a bare bool and
  deterministic key=value pairs instead.
- Reject a non-array field_maps in +db-sync-create --preview as well as
  commit, so the malformed shape is caught locally rather than forwarded
  to the backend.
- Clarify in lark-apps-db.md that +db-sync-create --preview needs no
  confirmation and only a real create requires --yes.
- Harden the db-sync dry-run validation tests to assert exit code 2 and
  the structured stderr envelope (type/subtype/param), and add coverage
  for the preview non-array field_maps rejection and batch pretty output.
Address the next db-sync review round:

- +db-sync-create --preview --output no longer writes a "null" file and
  exits success when the response omits data.config; project config into
  a typed object and return internal/invalid_response without writing.
- Make the 400002482 code hint command-neutral so +db-sync-update is not
  steered into a create-only recovery path that risks duplicate tasks.
- lark-apps-db.md: carry --environment on the update lifecycle examples
  and split failure recovery by streaming (can update) vs batch (cannot
  update; recreate instead), removing the batch/update contradiction.

@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: 1

🤖 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 `@skills/lark-apps/references/lark-apps-db.md`:
- Line 211: Update the batch recreation guidance near the “batch 任务” instruction
to require reusing the failed task’s original --environment value for both the
--preview and confirmed +db-sync-create commands. Preserve the existing workflow
of creating a new task rather than updating the original batch.
🪄 Autofix

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 Plus

Run ID: 743802aa-9f54-4693-9940-cbbb8be24412

📥 Commits

Reviewing files that changed from the base of the PR and between 23a5673 and f704888.

📒 Files selected for processing (4)
  • shortcuts/apps/apps_db_sync_create.go
  • shortcuts/apps/apps_db_sync_create_update_test.go
  • shortcuts/apps/db_common.go
  • skills/lark-apps/references/lark-apps-db.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • shortcuts/apps/apps_db_sync_create.go
  • shortcuts/apps/apps_db_sync_create_update_test.go
  • shortcuts/apps/db_common.go

Comment thread skills/lark-apps/references/lark-apps-db.md
@jinjiuzhe
jinjiuzhe merged commit 158d15b into main Aug 11, 2026
31 checks passed
@jinjiuzhe
jinjiuzhe deleted the feat/data-sync-openapi-cli branch August 11, 2026 10:21
@liangshuo-1 liangshuo-1 mentioned this pull request Aug 11, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants