Skip to content

feat(base): emit typed error envelopes across the base domain#1248

Merged
evandance merged 1 commit into
mainfrom
feat/errs-migrate-base
Jun 5, 2026
Merged

feat(base): emit typed error envelopes across the base domain#1248
evandance merged 1 commit into
mainfrom
feat/errs-migrate-base

Conversation

@evandance

@evandance evandance commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Migrate Base shortcut errors to typed errs.* envelopes so validation, API, network, internal, policy, and partial-failure paths expose structured machine-readable fields.

Changes

  • Replaced Base legacy output errors and bare final errors with typed errs.* builders and local Base helpers.
  • Routed Base raw API responses through typed classification, including role/advanced-permission wrappers and Base-specific message/hint/log_id enrichment.
  • Converted attachment download partial failure to ok:false stdout via OutPartialFailure while preserving successful and failed item details.
  • Updated Base tests and opted Base into typed-error guard rules, including Base block shortcut validation on the latest main.

Test Plan

  • gofmt -l shortcuts/base/
  • go vet ./shortcuts/base/...
  • go test ./shortcuts/base/...
  • go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6 run --new-from-rev=origin/main ./shortcuts/base/...
  • go run -C lint . ..
  • go build ./...
  • incremental deadcode check against origin/main
  • go mod tidy did not change go.mod or go.sum

Related Issues

None

@github-actions github-actions Bot added domain/base PR touches the base domain size/L Large or sensitive change across domains or core paths labels Jun 3, 2026
@coderabbitai

coderabbitai Bot commented Jun 3, 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

This PR migrates shortcuts/base from legacy output-based errors to typed errs, expands lint scopes to include shortcuts/base, adds shared base error and API-envelope helpers, updates many shortcut validation and API-response paths to use the new helpers, and updates tests to assert typed problems and structured partial-failure output.

Changes

Error handling framework migration and linting scopes

Layer / File(s) Summary
Linter contract and envelope rule
.golangci.yml, lint/errscontract/rule_no_legacy_envelope_literal.go
Expand forbidigo path-except and legacy-envelope detection to include shortcuts/base/ in the typed-error migration scope.
Core base error helpers and API-envelope helpers
shortcuts/base/base_errors.go
Add baseFlagErrorf, baseValidationErrorf, baseInputStatError, baseSaveError, baseUploadAttachmentError, and response-envelope helpers that validate Base v3 envelopes and build typed API errors.
Tests: typed-problem assertions
shortcuts/base/base_errors_test.go
Switch tests to use errs.ProblemOf and add assertProblemCode helper to assert typed problem codes and message substrings.

Flag and validation error migration across shortcuts

Layer / File(s) Summary
JSON parsing and helper validation
shortcuts/base/base_shortcut_helpers.go, shortcuts/base/helpers.go
Use baseFlagErrorf/baseValidationErrorf for JSON input loading, formatting errors, action selection, and object/value parsing.
Advanced permissions and workflow validation
shortcuts/base/base_advperm_*.go, shortcuts/base/workflow_*.go
Use baseFlagErrorf for --base-token and related blank-flag validations.
Data query, form, and field operation validation
shortcuts/base/base_data_query.go, shortcuts/base/base_form_*.go, shortcuts/base/field_ops.go, shortcuts/base/dashboard_block_create.go
Convert JSON and form-related validation failures to baseFlagErrorf/baseValidationErrorf and use errs.NewValidationError for structured validation where appropriate.
Record selection and query validation
shortcuts/base/record_ops.go, shortcuts/base/record_query.go
Switch record-selection, select-fields, normalizeStringList, sort normalization, and search-flag validations to baseFlagErrorf.
Table and attachment validation
shortcuts/base/table_ops.go, shortcuts/base/record_upload_attachment.go
Standardize field-array checks, attachment metadata validation, file-path safety, MIME detection, and save failures to use base* error helpers.
Record markdown and content-safety error handling
shortcuts/base/record_markdown.go
Return baseValidationErrorf for markdown validation and use baseContentSafetyBlockError to produce errs.ContentSafetyError with rules metadata.

API response handling refactor

Layer / File(s) Summary
Role API response classification and wrapping
shortcuts/base/base_role_common.go
Add handleRoleAPIResponse and baseRoleAPIError to classify/enrich SDK API responses and produce typed API errors.
Role CRUD & advperm shortcut handler migration
shortcuts/base/base_role_*.go, shortcuts/base/base_advperm_*.go
Pass full apiResp to the new handler and migrate flag validation to baseFlagErrorf.

Test assertion refactoring and helper integration

Layer / File(s) Summary
Role and permission test assertion migration
shortcuts/base/base_advperm_test.go, shortcuts/base/base_role_test.go
Replace substring-based error checks with assertProblemCode typed-problem assertions.
Record execute test updates
shortcuts/base/base_execute_test.go
Use RawBody for HTTP stubs and validate partial-failure JSON envelopes for download failures via errors.As into partial-failure types.
Content-safety test assertion migration
shortcuts/base/record_markdown_test.go
Assert *errs.ContentSafetyError and validate attached Rules.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • zgz2048
  • liangshuo-1
  • kongenpei

"I nibble at flags with tidy care,
Errors reformed, no stringy snare.
API replies now neatly wrapped,
Typed problems found and gently mapped.
Hooray — the rabbit hops, code repaired!"

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.57% 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 describes the main change: migrating Base shortcut errors to typed error envelopes across the base domain.
Description check ✅ Passed The PR description is well-structured with all required sections: summary, changes, test plan, and related issues. It clearly explains the migration objectives and provides comprehensive testing evidence.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/errs-migrate-base

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.

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

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

🧩 Skill update

npx skills add larksuite/cli#feat/errs-migrate-base -y -g

@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.47887% with 119 lines in your changes missing coverage. Please review.
✅ Project coverage is 70.17%. Comparing base (ac116e7) to head (75533a5).

Files with missing lines Patch % Lines
shortcuts/base/base_errors.go 68.69% 24 Missing and 12 partials ⚠️
shortcuts/base/record_upload_attachment.go 62.71% 21 Missing and 1 partial ⚠️
shortcuts/base/helpers.go 62.50% 14 Missing and 4 partials ⚠️
shortcuts/base/base_shortcut_helpers.go 53.33% 7 Missing ⚠️
shortcuts/base/record_ops.go 53.33% 7 Missing ⚠️
shortcuts/base/base_form_submit.go 64.70% 6 Missing ⚠️
shortcuts/base/base_data_query.go 0.00% 2 Missing ⚠️
shortcuts/base/base_role_common.go 90.90% 1 Missing and 1 partial ⚠️
shortcuts/base/record_markdown.go 86.66% 2 Missing ⚠️
shortcuts/base/record_query.go 75.00% 2 Missing ⚠️
... and 11 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1248      +/-   ##
==========================================
- Coverage   70.18%   70.17%   -0.01%     
==========================================
  Files         671      671              
  Lines       65240    65329      +89     
==========================================
+ Hits        45786    45847      +61     
- Misses      15783    15794      +11     
- Partials     3671     3688      +17     

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

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

Caution

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

⚠️ Outside diff range comments (4)
shortcuts/base/helpers.go (1)

422-426: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Reattach x-tt-logid before returning the decoded Base envelope.

After runtime.ClassifyAPIResponse(resp) succeeds, this path throws away its parsed state and re-decodes resp.RawBody. If the server only sent the log ID in the header, the returned map no longer carries it, so later handleBaseAPIResultAny / baseAPIErrorFromResult calls cannot surface log_id for ordinary Base business errors. attachBaseErrorLogID() is still available just below and should run here before returning. Based on learnings: typed Base errors should preserve structured machine-readable fields like log_id across migration.

Proposed fix
 	result, parseErr := decodeBaseV3Response(resp.RawBody)
 	if parseErr != nil {
 		return nil, parseErr
 	}
+	attachBaseErrorLogID(result, baseResponseLogID(resp))
 	return result, nil
 }
🤖 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/base/helpers.go` around lines 422 - 426, The decoded Base envelope
from decodeBaseV3Response(resp.RawBody) loses the header-only x-tt-logid after
runtime.ClassifyAPIResponse(resp) succeeds; call attachBaseErrorLogID(result,
resp) (or the existing attachBaseErrorLogID helper) on the resulting map before
returning so the structured result preserves log_id for downstream functions
like handleBaseAPIResultAny and baseAPIErrorFromResult; ensure you run
attachBaseErrorLogID immediately after parseErr check and before the final
return.
shortcuts/base/record_markdown.go (1)

32-38: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Allow --jq with explicit --format json.

Line 33 keys off runtime.Changed("format"), so --format json --jq ... now hits the markdown-only conflict even though JSON is the compatible fallback. Only reject when the explicit format is markdown; otherwise keep the JSON runtime.Out(...) path.

Proposed fix
 	if runtime.JqExpr != "" {
-		if !runtime.Changed("format") {
-			runtime.Out(data, nil)
-			return nil
-		}
-		return baseValidationErrorf("--jq and --format markdown are mutually exclusive")
+		if runtime.Changed("format") && runtime.Str("format") == "markdown" {
+			return baseValidationErrorf("--jq and --format markdown are mutually exclusive")
+		}
+		runtime.Out(data, nil)
+		return nil
 	}
🤖 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/base/record_markdown.go` around lines 32 - 38, The current check
rejects any use of runtime.JqExpr when runtime.Changed("format") is false,
causing valid combinations like --format json --jq ... to be rejected; update
the logic so that you only return baseValidationErrorf("--jq and --format
markdown are mutually exclusive") when the user explicitly set the format to
"markdown". Concretely, in the block referencing runtime.JqExpr and
runtime.Changed("format"), change the condition to detect an explicit "markdown"
choice (e.g. check the runtime's format field or accessor, such as
runtime.Format or runtime.Get("format") depending on available API) and only
error when that explicit value equals "markdown"; otherwise call
runtime.Out(data, nil) and return nil as before.
shortcuts/base/record_upload_attachment.go (1)

241-250: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Preserve path-validation failures when checking --output.

This branch turns every Stat error into “must be an existing directory”. If runtime.FileIO().Stat() rejects an unsafe path, the caller loses the real typed validation detail and gets a misleading directory message instead.

💡 Proposed fix
 	if len(tokens) != 1 {
 		info, statErr := runtime.FileIO().Stat(runtime.Str("output"))
-		if statErr != nil || !info.IsDir() {
+		if statErr != nil {
+			if errors.Is(statErr, fileio.ErrPathValidation) {
+				return baseValidationErrorf("unsafe output path: %s", statErr)
+			}
+			return baseFlagErrorf("--output must be an existing directory when downloading multiple attachments or when --file-token is omitted")
+		}
+		if !info.IsDir() {
 			return baseFlagErrorf("--output must be an existing directory when downloading multiple attachments or when --file-token is omitted")
 		}
 	}

Based on learnings: when checking whether a user-supplied --output path is an existing directory, this repo distinguishes fs.ErrNotExist from fileio.PathValidationError and other filesystem errors instead of collapsing them into one generic message.

🤖 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/base/record_upload_attachment.go` around lines 241 - 250, In
validateRecordDownloadAttachment, preserve and propagate specific filesystem
errors from runtime.FileIO().Stat instead of masking them; call
runtime.FileIO().Stat(runtime.Str("output")) and if it returns an error check
for fs.ErrNotExist and fileio.PathValidationError (or the repo's
PathValidationError type) separately: if fs.ErrNotExist then return
baseFlagErrorf("--output must be an existing directory when downloading multiple
attachments or when --file-token is omitted"), if it's a PathValidationError
return that error (or wrap/preserve it) so callers see validation failures,
otherwise handle other unexpected errors by returning them rather than always
returning the generic directory message; keep the existing branch that checks
!info.IsDir() and returns the same baseFlagErrorf.
shortcuts/base/record_ops.go (1)

332-353: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Trim --record-ids entries before the empty-check.

validateRecordShareBatch now rejects an empty slice, but deduplicateRecordIDs() still treats " " as a valid ID because it only filters exact empty strings. That lets whitespace-only --record-ids bypass validation and reach share_links/batch as invalid record IDs.

💡 Proposed fix
 func deduplicateRecordIDs(runtime *common.RuntimeContext) []string {
 	raw := runtime.StrSlice("record-ids")
 	seen := make(map[string]bool, len(raw))
 	result := make([]string, 0, len(raw))
 	for _, id := range raw {
+		id = strings.TrimSpace(id)
 		if id != "" && !seen[id] {
 			seen[id] = true
 			result = append(result, id)
 		}
 	}
 	return result
 }
🤖 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/base/record_ops.go` around lines 332 - 353, The deduplication
currently treats whitespace-only entries as valid; modify deduplicateRecordIDs
to trim each entry using strings.TrimSpace before checking emptiness and before
using it as the map key/append value so that entries like "   " are treated as
empty and filtered out; ensure you import "strings" if necessary and keep the
rest of the logic (seen map, result append) operating on the trimmedID.
🤖 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/base/base_errors.go`:
- Around line 175-180: The merge logic in the block using
errs.ProblemOf(enriched) and errs.ProblemOf(err) overwrites an existing
dst.LogID with an empty src.LogID; change the assignment so dst.LogID is only
set when src.LogID is non-empty (i.e., after confirming src.LogID != ""), while
still copying Message and Hint unconditionally; update the block that references
src, dst, dst.Message, dst.Hint, and dst.LogID to preserve an existing dst.LogID
when enriched provides no log id.
- Around line 38-42: Reject non-numeric "code" values before treating code==0 as
success: verify the value in resultMap["code"] is actually numeric (or that
util.ToFloat64 succeeded) and return an InvalidResponse/InternalError when
conversion fails or the value is not a number. Replace the current blind call
that lets util.ToFloat64 fall back to 0 by checking existence and conversion
result (e.g., capture any error/ok from util.ToFloat64 or use a type switch on
resultMap["code"]) and only then compare the numeric code; if conversion fails,
return the invalid-response error instead of proceeding with code==0 logic.

In `@shortcuts/base/base_form_submit.go`:
- Line 197: The current return uses baseValidationErrorf for a missing FileIO
provider which is a runtime/setup issue; change the return to an internal error
so callers can distinguish internal runtime failures from user validation
errors. Locate the check that returns baseValidationErrorf("file operations
require a FileIO provider (needed for attachments in --json)") (in
base_form_submit.go near the FileIO use) and replace it with the project’s
internal error constructor (e.g., internalErrorf or the InternalError type
factory used elsewhere) with a similar descriptive message so the error envelope
and exit code reflect an internal/runtime failure rather than validation.

In `@shortcuts/base/base_role_common.go`:
- Around line 21-24: The early return in handleRoleAPIResponse loses the action
context; change the error path so the error returned from
runtime.ClassifyAPIResponse is enriched via enrichBaseAPIErrorFromBody and then
wrapped/prefixed with baseRoleAPIError using the action string. Specifically, in
handleRoleAPIResponse replace the current return enrichBaseAPIErrorFromBody(err,
apiResp.RawBody, runtime.APIClassifyContext()) with a call that first enriches
the error (using enrichBaseAPIErrorFromBody) and then passes that result into
baseRoleAPIError(..., action) so the final error preserves the "create role
failed"/"get role failed" prefix.

In `@shortcuts/base/record_upload_attachment.go`:
- Around line 378-380: The error message for exceeding
baseAttachmentUploadMaxFileSize uses common.FormatSize(fileInfo.Size()) but
drops the offending file path; update the baseValidationErrorf call so it
includes the file path (use the variable that holds the uploaded file path/name
— e.g., filePath, filename, or file.Name()) along with the formatted size, by
changing the message to something like "file %s (%s) exceeds 2GB limit" and
passing the path and common.FormatSize(fileInfo.Size())); ensure you modify the
call at the check that references baseAttachmentUploadMaxFileSize and
common.FormatSize(fileInfo.Size()).

---

Outside diff comments:
In `@shortcuts/base/helpers.go`:
- Around line 422-426: The decoded Base envelope from
decodeBaseV3Response(resp.RawBody) loses the header-only x-tt-logid after
runtime.ClassifyAPIResponse(resp) succeeds; call attachBaseErrorLogID(result,
resp) (or the existing attachBaseErrorLogID helper) on the resulting map before
returning so the structured result preserves log_id for downstream functions
like handleBaseAPIResultAny and baseAPIErrorFromResult; ensure you run
attachBaseErrorLogID immediately after parseErr check and before the final
return.

In `@shortcuts/base/record_markdown.go`:
- Around line 32-38: The current check rejects any use of runtime.JqExpr when
runtime.Changed("format") is false, causing valid combinations like --format
json --jq ... to be rejected; update the logic so that you only return
baseValidationErrorf("--jq and --format markdown are mutually exclusive") when
the user explicitly set the format to "markdown". Concretely, in the block
referencing runtime.JqExpr and runtime.Changed("format"), change the condition
to detect an explicit "markdown" choice (e.g. check the runtime's format field
or accessor, such as runtime.Format or runtime.Get("format") depending on
available API) and only error when that explicit value equals "markdown";
otherwise call runtime.Out(data, nil) and return nil as before.

In `@shortcuts/base/record_ops.go`:
- Around line 332-353: The deduplication currently treats whitespace-only
entries as valid; modify deduplicateRecordIDs to trim each entry using
strings.TrimSpace before checking emptiness and before using it as the map
key/append value so that entries like "   " are treated as empty and filtered
out; ensure you import "strings" if necessary and keep the rest of the logic
(seen map, result append) operating on the trimmedID.

In `@shortcuts/base/record_upload_attachment.go`:
- Around line 241-250: In validateRecordDownloadAttachment, preserve and
propagate specific filesystem errors from runtime.FileIO().Stat instead of
masking them; call runtime.FileIO().Stat(runtime.Str("output")) and if it
returns an error check for fs.ErrNotExist and fileio.PathValidationError (or the
repo's PathValidationError type) separately: if fs.ErrNotExist then return
baseFlagErrorf("--output must be an existing directory when downloading multiple
attachments or when --file-token is omitted"), if it's a PathValidationError
return that error (or wrap/preserve it) so callers see validation failures,
otherwise handle other unexpected errors by returning them rather than always
returning the generic directory message; keep the existing branch that checks
!info.IsDir() and returns the same baseFlagErrorf.
🪄 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: d253ee83-cceb-44c3-ba22-e69b14795bda

📥 Commits

Reviewing files that changed from the base of the PR and between 33de28f and 9077c7c.

📒 Files selected for processing (36)
  • .golangci.yml
  • lint/errscontract/rule_no_legacy_envelope_literal.go
  • shortcuts/base/base_advperm_disable.go
  • shortcuts/base/base_advperm_enable.go
  • shortcuts/base/base_advperm_test.go
  • shortcuts/base/base_data_query.go
  • shortcuts/base/base_errors.go
  • shortcuts/base/base_errors_test.go
  • shortcuts/base/base_execute_test.go
  • shortcuts/base/base_form_questions_create.go
  • shortcuts/base/base_form_questions_delete.go
  • shortcuts/base/base_form_questions_update.go
  • shortcuts/base/base_form_submit.go
  • shortcuts/base/base_role_common.go
  • shortcuts/base/base_role_create.go
  • shortcuts/base/base_role_delete.go
  • shortcuts/base/base_role_get.go
  • shortcuts/base/base_role_list.go
  • shortcuts/base/base_role_test.go
  • shortcuts/base/base_role_update.go
  • shortcuts/base/base_shortcut_helpers.go
  • shortcuts/base/dashboard_block_create.go
  • shortcuts/base/field_ops.go
  • shortcuts/base/helpers.go
  • shortcuts/base/record_markdown.go
  • shortcuts/base/record_markdown_test.go
  • shortcuts/base/record_ops.go
  • shortcuts/base/record_query.go
  • shortcuts/base/record_upload_attachment.go
  • shortcuts/base/table_ops.go
  • shortcuts/base/workflow_create.go
  • shortcuts/base/workflow_disable.go
  • shortcuts/base/workflow_enable.go
  • shortcuts/base/workflow_get.go
  • shortcuts/base/workflow_list.go
  • shortcuts/base/workflow_update.go

Comment thread shortcuts/base/base_errors.go
Comment thread shortcuts/base/base_errors.go Outdated
Comment thread shortcuts/base/base_form_submit.go Outdated
Comment thread shortcuts/base/base_role_common.go
Comment thread shortcuts/base/record_upload_attachment.go
@evandance evandance force-pushed the feat/errs-migrate-base branch 2 times, most recently from 611b727 to ae8417f Compare June 3, 2026 10:36
@evandance evandance changed the title feat: return typed errors from base shortcuts feat(base): emit typed error envelopes across the base domain Jun 3, 2026
@evandance evandance force-pushed the feat/errs-migrate-base branch from ae8417f to 306a8a7 Compare June 4, 2026 04:13

@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)
shortcuts/base/base_execute_test.go (1)

517-574: ⚡ Quick win

Cover the blank --type validation branch too.

This table misses the other changed validateBaseBlockCreate path: --type blank now also routes through baseFlagErrorf. Adding a "create blank type" case would keep both modified branches in shortcuts/base/base_block_ops.go under typed-error assertions.

🤖 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/base/base_execute_test.go` around lines 517 - 574, Add a new test
case in TestBaseBlockValidationReturnsTypedErrors to cover the blank --type
branch: add an entry with name "create blank type", shortcut
BaseBaseBlockCreate, args []string{"+base-block-create", "--base-token",
"app_x", "--type", " " , "--name", "doc"} (or similar required flags) and params
[]string{"--type"} so the test exercises validateBaseBlockCreate's --type blank
path and asserts the same typed ValidationError checks already present in the
loop.
🤖 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 `@shortcuts/base/base_execute_test.go`:
- Around line 517-574: Add a new test case in
TestBaseBlockValidationReturnsTypedErrors to cover the blank --type branch: add
an entry with name "create blank type", shortcut BaseBaseBlockCreate, args
[]string{"+base-block-create", "--base-token", "app_x", "--type", " " ,
"--name", "doc"} (or similar required flags) and params []string{"--type"} so
the test exercises validateBaseBlockCreate's --type blank path and asserts the
same typed ValidationError checks already present in the loop.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 616269d7-f008-4476-8dc3-0ddf849be70a

📥 Commits

Reviewing files that changed from the base of the PR and between ae8417f and 306a8a7.

📒 Files selected for processing (37)
  • .golangci.yml
  • lint/errscontract/rule_no_legacy_envelope_literal.go
  • shortcuts/base/base_advperm_disable.go
  • shortcuts/base/base_advperm_enable.go
  • shortcuts/base/base_advperm_test.go
  • shortcuts/base/base_block_ops.go
  • shortcuts/base/base_data_query.go
  • shortcuts/base/base_errors.go
  • shortcuts/base/base_errors_test.go
  • shortcuts/base/base_execute_test.go
  • shortcuts/base/base_form_questions_create.go
  • shortcuts/base/base_form_questions_delete.go
  • shortcuts/base/base_form_questions_update.go
  • shortcuts/base/base_form_submit.go
  • shortcuts/base/base_role_common.go
  • shortcuts/base/base_role_create.go
  • shortcuts/base/base_role_delete.go
  • shortcuts/base/base_role_get.go
  • shortcuts/base/base_role_list.go
  • shortcuts/base/base_role_test.go
  • shortcuts/base/base_role_update.go
  • shortcuts/base/base_shortcut_helpers.go
  • shortcuts/base/dashboard_block_create.go
  • shortcuts/base/field_ops.go
  • shortcuts/base/helpers.go
  • shortcuts/base/record_markdown.go
  • shortcuts/base/record_markdown_test.go
  • shortcuts/base/record_ops.go
  • shortcuts/base/record_query.go
  • shortcuts/base/record_upload_attachment.go
  • shortcuts/base/table_ops.go
  • shortcuts/base/workflow_create.go
  • shortcuts/base/workflow_disable.go
  • shortcuts/base/workflow_enable.go
  • shortcuts/base/workflow_get.go
  • shortcuts/base/workflow_list.go
  • shortcuts/base/workflow_update.go
✅ Files skipped from review due to trivial changes (2)
  • shortcuts/base/workflow_list.go
  • shortcuts/base/field_ops.go
🚧 Files skipped from review as they are similar to previous changes (30)
  • lint/errscontract/rule_no_legacy_envelope_literal.go
  • shortcuts/base/base_form_questions_update.go
  • shortcuts/base/workflow_get.go
  • shortcuts/base/workflow_create.go
  • shortcuts/base/base_form_questions_delete.go
  • shortcuts/base/base_advperm_disable.go
  • shortcuts/base/base_role_create.go
  • shortcuts/base/base_role_list.go
  • shortcuts/base/base_form_questions_create.go
  • shortcuts/base/workflow_disable.go
  • shortcuts/base/base_advperm_test.go
  • shortcuts/base/base_role_delete.go
  • .golangci.yml
  • shortcuts/base/base_data_query.go
  • shortcuts/base/table_ops.go
  • shortcuts/base/base_shortcut_helpers.go
  • shortcuts/base/record_markdown_test.go
  • shortcuts/base/base_role_get.go
  • shortcuts/base/base_role_update.go
  • shortcuts/base/record_query.go
  • shortcuts/base/record_ops.go
  • shortcuts/base/base_form_submit.go
  • shortcuts/base/base_role_common.go
  • shortcuts/base/dashboard_block_create.go
  • shortcuts/base/base_role_test.go
  • shortcuts/base/base_errors.go
  • shortcuts/base/record_markdown.go
  • shortcuts/base/base_errors_test.go
  • shortcuts/base/helpers.go
  • shortcuts/base/record_upload_attachment.go

@evandance evandance force-pushed the feat/errs-migrate-base branch 2 times, most recently from e745454 to 8563b1f Compare June 4, 2026 08:17
@evandance evandance force-pushed the feat/errs-migrate-base branch from 8563b1f to 75533a5 Compare June 4, 2026 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/base PR touches the base domain feature size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants