Skip to content

Map flattened ArtifactsError and enable enhanced_error_serialization - #1439

Merged
kentcdodds merged 2 commits into
mainfrom
cursor/artifacts-error-message-prefix-c3b8
Aug 14, 2026
Merged

kentcdodds merged 2 commits into
mainfrom
cursor/artifacts-error-message-prefix-c3b8

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Aug 14, 2026 •

Copy link
Copy Markdown
Owner

Intent

community_fork is still broken on production after #1438 (53ae3918). The same probe threw ArtifactsError: Repository not found: package-<new-uuid>. #1438 required name === 'ArtifactsError' for the message fallback. Without enhanced_error_serialization (date-default 2026-04-21; Kody is dated 2026-04-16), JSRPC can flatten that into a plain Error whose message is ArtifactsError: Repository not found: …, so get still rethrew before create.

Summary

  • Strip a leading ArtifactsError: from the error message, then match the same known prefixes (Repository not found, Repository already exists, Import in progress).
  • A generic git: repository not found still does not map.
  • Lazy native repo() gets go through the same matcher.
  • Opt in enhanced_error_serialization on the main worker (and aligned dynamic/mock copies). Do not advance compatibility_date — 2026-04-21 also defaults enable_python_external_sdk. Keep the structural matcher; the flag does not restore custom prototype identity.

Testing

  • new Error('ArtifactsError: Repository not found: repo-native-prefixed') → not_found.
  • Prior duck-typed { name, code } and message-only ArtifactsError cases still pass.
  • Dynamic/mock compatibility flags stay aligned with the main wrangler config and include enhanced_error_serialization.
  • Preview smoke: health + seed login + /account on kody-pr-1439.
  • Re-probe community_fork of @kody/personal-capture after deploy.

System changes

System recap — extends existing primitives (medium risk)

Mode: recap · Base: main @ 53ae3918 · Head: a7a405d2

Classification: extends — Artifacts binding error matching plus consumer JSRPC serialization.

Primitives touched

Primitive Group Impact
artifacts-repos storage extends — map flattened ArtifactsError: Repository not found and opt in enhanced_error_serialization
repo-sessions runtime composes — test only

System map

Native get miss must become not_found whether JSRPC preserves { name, code } or flattens to a prefixed Error.message. The compatibility flag asks the consumer runtime to keep structured fields; the matcher stays as defense.

Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).

flowchart LR
	artifactsRepos["artifacts-repos<br/>Artifacts repos"]:::extended
	repoSessions["repo-sessions<br/>Repo sessions"]:::touched
	artifactsRepos -->|"flattened or structured NOT_FOUND then create"| repoSessions
	classDef touched fill:#1a7f37,color:#fff
	classDef extended fill:#9a6700,color:#fff
	classDef added fill:#cf222e,color:#fff
	classDef untouched fill:#57606a,color:#fff
Loading
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of native artifact repository lookup errors.
    • Repository-not-found errors now provide clearer, more descriptive feedback.
    • Other repository errors are preserved correctly instead of being misclassified.
    • Improved consistency across native repository handle operations.
    • Enhanced error details are now preserved for artifact-related errors.
  • Tests

    • Added coverage for repository-not-found errors reported through native error messages.
    • Added verification for enhanced error serialization compatibility.

Production still threw after #1438. Treat Error messages that start
with ArtifactsError: Repository not found as NOT_FOUND so create runs.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kentcdodds
kentcdodds marked this pull request as ready for review August 14, 2026 00:11
@coderabbitai

coderabbitai Bot commented Aug 14, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 2acf117a-b36f-479b-9fbc-63a961a1ce42

📥 Commits

Reviewing files that changed from the base of the PR and between f808e9b and a7a405d.

📒 Files selected for processing (4)
  • packages/mock-servers/cloudflare/wrangler.jsonc
  • packages/worker/src/dynamic-worker-compatibility.node.test.ts
  • packages/worker/src/dynamic-worker-compatibility.ts
  • packages/worker/wrangler.jsonc

📝 Walkthrough

Walkthrough

Native Artifacts handling now extracts messages from multiple error shapes, recognizes prefixed repository-not-found messages, preserves original causes, and routes native repository operations through shared lookup logic. Worker configurations enable enhanced error serialization and test the flag.

Changes

Native Artifacts error handling

Layer / File(s) Summary
Extract and classify native errors
packages/worker/src/repo/artifacts.ts, packages/worker/src/repo/artifacts.node.test.ts
Error messages are extracted from strings, Error instances, and objects. Prefixed ArtifactsError repository-not-found messages classify as not_found, with test coverage.
Apply shared repository lookup
packages/worker/src/repo/artifacts.ts
Native repository operations use a shared lookup wrapper. Missing repositories receive descriptive errors with the original cause, while other errors are rethrown unchanged.
Enable enhanced error serialization
packages/worker/src/dynamic-worker-compatibility.ts, packages/worker/src/dynamic-worker-compatibility.node.test.ts, packages/worker/wrangler.jsonc, packages/mock-servers/cloudflare/wrangler.jsonc
Worker compatibility configurations enable enhanced_error_serialization, and tests verify the main worker flag.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to a7a40

The PR updates artifact error matching and related configuration so flattened repository errors can be handled correctly; no actionable merge-blocking risk remains beyond normal checks and review.

Possibly related PRs

  • kentcdodds/kody#1437: Extends the native Artifacts binding and modifies the same repository operations.
  • kentcdodds/kody#1438: Extends the same Artifacts error normalization and NOT_FOUND classification logic.

Suggested reviewers: kody-bot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly summarizes the two main changes: mapping flattened ArtifactsError messages and enabling enhanced error serialization.
Description check ✅ Passed The description includes complete Intent, Summary, Testing, and System changes sections with relevant implementation and verification details.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/artifacts-error-message-prefix-c3b8

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 commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-1439.kody-a99.workers.dev

Worker: kody-pr-1439
Runtime worker: kody-pr-1439-runtime (https://kody-pr-1439-runtime.kody-a99.workers.dev)
D1: kody-pr-1439-db
KV: kody-pr-1439-oauth-kv

Mocks:

Kody's compatibility_date is 2026-04-16; this flag is date-default on
2026-04-21. Opt in on the main worker (and aligned dynamic/mock copies)
so the Artifacts binding can preserve name/code instead of flattening
to Error + a prefixed message. Keep the structural matcher.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@cursor cursor Bot changed the title Map JSRPC-flattened ArtifactsError not-found messages Map flattened ArtifactsError and enable enhanced_error_serialization Aug 14, 2026
@kentcdodds
kentcdodds merged commit 04ee0e0 into main Aug 14, 2026
10 checks passed
@kentcdodds
kentcdodds deleted the cursor/artifacts-error-message-prefix-c3b8 branch August 14, 2026 00:26
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.

2 participants