Skip to content

fix(cli): accept --project-dir in schedule and webhook, retire their cwd lane - #4026

Merged
kojiwakayama merged 1 commit into
mainfrom
test/cwd-project-dir-parameter
Aug 23, 2026
Merged

kojiwakayama merged 1 commit into
mainfrom
test/cwd-project-dir-parameter

Conversation

@kojiwakayama

Copy link
Copy Markdown
Contributor

Why

schedule, webhook, and the TUI's project creation read the process working directory with no way to pass a directory in. Their tests therefore had to Deno.chdir through withCwd, which kept four files in the serial unit:cwd test lane and a cross-isolate disk lock in play for every unit-suite run.

What

  • schedule and webhook accept the project directory argument the rest of the CLI already has (CommonArgs.projectDir: --project-dir, --dir, -d), resolving opts.projectDir ?? Deno.cwd(). Help text updated.
  • TUI createProject accepts an optional baseDir on its context; remoteProjectPath / setRemoteProjects take an optional baseDir. All default to the working directory — no caller changes behaviour.
  • The four tests pass the directory instead of entering it, drop withCwd, and return to unit:parallel. UNIT_CWD_FILES in scripts/test/run-suite.ts shrinks to the three files that are genuinely about cwd itself (skills/validate tests a literal ".", platform/compat/process and testing/cwd test the primitives).

Notes

  • Semantic unit-boundary audit: unchanged (2141/762) — these entries never carried shared-cwd.
  • Follow-up candidates (out of scope): cli/commands/build/embedded-preset-flags.test.ts and cli/auth/login.test.ts still use withCwd from the parallel lane (safe under its disk lock, but the same parameter treatment applies).

Verification

  • The four migrated files + src/testing/cwd.test.ts + run-suite/suites pin tests: pass.
  • deno task test:unit:cwd (now 3 files): pass. The four files run under --parallel --trace-leaks alongside five unrelated cli tests: 14 passed (277 steps), no leaks.
  • deno task lint:test-semantic-dispositions, deno task test:layout, deno task lint:cwd-relative-test-reads: ok.
  • Pre-push gate (fmt, lint, check, test:unit): passed on push.

…cwd lane

`schedule`, `webhook`, and the TUI's project creation read the process
working directory with no way to pass a directory in. Their tests therefore
had to `Deno.chdir` through `withCwd`, which put four files in the serial
`unit:cwd` lane and kept a cross-isolate lock in play for every run of the
unit suite.

Give each site the parameter the rest of the CLI already has: `schedule`
and `webhook` take `CommonArgs.projectDir` (`--project-dir`, `--dir`, `-d`)
and resolve `opts.projectDir ?? Deno.cwd()`; `createProject` accepts an
optional `baseDir` on its context and `remoteProjectPath` /
`setRemoteProjects` an optional `baseDir`, all defaulting to the working
directory so no existing caller changes behaviour. The four tests pass the
directory instead of entering it, drop the `withCwd` import, and return to
`unit:parallel`; `unit:cwd` keeps only the files that test cwd itself or a
literal "." argument.

Constraint: Without `--project-dir` every command resolves exactly as before.

Rejected: Pin "every withCwd importer is in UNIT_CWD_FILES" | withCwd holds
a cross-isolate disk lock, so parallel-lane files already use it safely and
the invariant is false today.

Confidence: high

Scope-risk: narrow

Reversibility: clean

Tested: the four migrated files, run-suite/suites pin tests (3/17 steps),
test:unit:cwd (3 files, 112 steps), the four files under --parallel with
five unrelated cli tests (14/277 steps), semantic disposition audit
(2141/762, unchanged), test:layout, cwd-relative read audit (baseline
unchanged), deno check/lint/fmt on every touched file.

Not-tested: hosted CI and merge queue, pending push.

@greptile-apps greptile-apps 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.

kojiwakayama has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 34 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9577bf78-3c4a-495d-a787-5124416ca0c5

📥 Commits

Reviewing files that changed from the base of the PR and between f9add2b and d4797ec.

📒 Files selected for processing (12)
  • cli/app/operations/project-creation.test.ts
  • cli/app/operations/project-creation.ts
  • cli/app/state.ts
  • cli/commands/schedule/command-help.ts
  • cli/commands/schedule/handler.test.ts
  • cli/commands/schedule/handler.ts
  • cli/commands/webhook/command-help.ts
  • cli/commands/webhook/handler.test.ts
  • cli/commands/webhook/handler.ts
  • cli/router.test.ts
  • scripts/test/run-suite.test.ts
  • scripts/test/run-suite.ts

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

Copy link
Copy Markdown

📦 Client bundle boundary

Entrypoint Modules Source size Server leaks
src/index.client.ts 327 1963 KiB ✅ 0

A server module in a client graph aborts hydration in the browser. New leaks fail CI; known leaks are tracked in scripts/lint/client-bundle-baseline.json to burn down.

@codecov

codecov Bot commented Aug 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.14286% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
cli/commands/schedule/handler.ts 66.66% 2 Missing ⚠️
cli/commands/webhook/handler.ts 66.66% 2 Missing ⚠️
cli/app/operations/project-creation.ts 75.00% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@kojiwakayama

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

Reviewed commit: d4797ecb2d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@kojiwakayama
kojiwakayama added this pull request to the merge queue Aug 23, 2026
Merged via the queue into main with commit 7f178c8 Aug 23, 2026
46 checks passed
@kojiwakayama
kojiwakayama deleted the test/cwd-project-dir-parameter branch August 23, 2026 20:11
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.

1 participant