Skip to content

[codex] Structure mobile project thread validation errors#3387

Merged
juliusmarminge merged 2 commits into
mainfrom
codex/mobile-project-thread-validation-errors
Jun 20, 2026
Merged

[codex] Structure mobile project thread validation errors#3387
juliusmarminge merged 2 commits into
mainfrom
codex/mobile-project-thread-validation-errors

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

Mobile project-thread creation represented two distinct input failures as generic Error values. That discarded the environment, project, and creation-mode context needed to correlate repeated failures, and made both cases indistinguishable except for their message text.

This change introduces separate Schema error classes for a missing task and a missing worktree base branch. The task error records the environment, project, and environment mode; the branch error records the environment and project. Their messages remain stable and are derived from the error type rather than an opaque reason string. A focused validation function now returns those errors before the command is dispatched, and the existing user-facing pending error behavior is unchanged.

No behavior test was added for this pure validation refactor.

Validation

  • pnpm vp check (passes with the repository existing warnings)
  • pnpm vp run typecheck
  • pnpm vp run lint:mobile

Note

Low Risk
Client-side input validation only; behavior and displayed messages are unchanged aside from failure values being tagged errors instead of plain Error.

Overview
Project thread creation on mobile now validates through validateProjectThreadCreation instead of inline checks that threw generic Error values.

Two Effect Schema tagged errors cover the same cases as before: missing task text (includes environment, project, and local/worktree mode) and missing base branch for worktree creation (includes environment and project). use-project-actions still surfaces the same user-facing strings via setPendingConnectionError, but failures are returned as AsyncResult.failure(Cause.fail(validationError)) so callers can distinguish error kinds by type.

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

Note

Replace generic errors with tagged validation errors for project thread creation

  • Adds projectThreadCreationValidation.ts with two tagged error classes (ProjectThreadTaskRequiredError, ProjectThreadBaseBranchRequiredError) and a validateProjectThreadCreation function that returns the appropriate error or null.
  • Updates useCreateProjectThread in use-project-actions.ts to use the new validation function, replacing ad-hoc Error instances with structured tagged errors.
  • Failure messages shown to users are unchanged; only the error type changes from generic Error to a tagged schema type.

Macroscope summarized 4e208c3.

Co-authored-by: codex <codex@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Jun 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 338dded7-e6d5-421a-af27-3a12f0103984

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/mobile-project-thread-validation-errors

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Jun 20, 2026
Co-authored-by: codex <codex@users.noreply.github.com>
@macroscopeapp

macroscopeapp Bot commented Jun 20, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

This is a straightforward refactor extracting validation logic into structured error classes. The only behavioral change is adding .trim() to reject whitespace-only messages, which is a sensible minor fix. Changes are self-contained and well-tested.

You can customize Macroscope's approvability policy. Learn more.

@juliusmarminge juliusmarminge merged commit 4fbc4f9 into main Jun 20, 2026
16 checks passed
@juliusmarminge juliusmarminge deleted the codex/mobile-project-thread-validation-errors branch June 20, 2026 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant