Skip to content

[Bug]: t3 serve lists --auto-bootstrap-project-from-cwd in its help but ignores it #34223

Closed

Description

@coygeek

Summary

t3 serve --help lists --auto-bootstrap-project-from-cwd with the description "Create a project for the current working directory on startup when missing." t3 serve accepts the flag without an error or warning and creates no project. Disabling auto-bootstrap for t3 serve is intended (it was introduced that way and a unit test covers it); the defect is that serve's own help offers a flag that the command always overrides, so a user who follows the help gets no project and no message.

Steps to reproduce

  1. Create a Git repository with one commit and cd into it.
  2. Run t3 serve --help and find the --auto-bootstrap-project-from-cwd entry.
  3. Run t3 serve --auto-bootstrap-project-from-cwd --base-dir <empty dir> --host 127.0.0.1 --port <free port> --log-level debug .
  4. Read the publishing welcome event debug entry, then stop the server and count the rows in projection_projects in <base-dir>/userdata/statev2.sqlite.
  5. Control: repeat step 3 with a fresh --base-dir, replacing t3 serve with t3 --no-browser, and repeat step 4.

All steps were run on both release builds, except the control in step 5, which was run on the nightly only.

Expected behavior

t3 serve --help is the command's own flag reference, so every flag it lists should either take effect on t3 serve or not be offered there, or the command should reject the flag or warn that it is ignored. Since PR #1871 made t3 serve never bootstrap a project, this flag currently does none of these. The user docs do not mention this flag for t3 serve.

Actual behavior

On both release builds, t3 serve starts normally, prints no warning or error at any log level, and logs (excerpt, environmentId omitted):

startup phase: publishing welcome event
  {
    cwd: '<repo dir>',
    projectName: '<repo name>',
    bootstrapProjectId: undefined,
    bootstrapThreadId: undefined
  }

projection_projects holds 0 rows afterwards. On the nightly, setting T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD=true instead of passing the flag gives the same result. In the control run, t3 --no-browser --auto-bootstrap-project-from-cwd logs a defined bootstrapProjectId and bootstrapThreadId, and projection_projects holds 1 row.

In source, serveCommand is built from the same sharedServerCommandFlags that define and describe the flag, and it calls the server with startupPresentation: "headless" and forceAutoBootstrapProjectFromCwd: false. resolveServerConfig checks both of those before the flag and the environment variable.

Evidence

  • Expected source: t3 serve --help output on both release builds; the flag and its description at config.ts#L64-L69, included in serve's flag set at config.ts#L241.
  • Failure source: the local runs under Actual behavior; the precedence at config.ts#L389-L397 and serve's forced options at server.ts#L90-L101.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

The test at config.test.ts#L631 asserts that headless startup overrides T3CODE_AUTO_BOOTSTRAP_PROJECT_FROM_CWD=true, so the override itself is intended. The environment variable is not shown in serve's help; this report concerns the advertised flag.

Restoration check

Failing: t3 serve --help lists --auto-bootstrap-project-from-cwd, and t3 serve --auto-bootstrap-project-from-cwd starts with no project and no message. Passing: t3 serve --help no longer offers the flag, or t3 serve tells the user that it ignores the flag, or t3 serve with the flag creates the working-directory project. Control: t3 serve without the flag still creates no project, and t3 --auto-bootstrap-project-from-cwd still creates one.

Version or commit

  • t3 v0.1.9-nightly.20261111.4501 (latest nightly) and t3 v0.1.8 (latest stable, installed in isolation from npm t3@0.1.8) were run.
  • Source read at main 950c34226cc08ca4d9fc0e387b059a30463a1e47; the cited lines are identical at tags v0.1.8 and v0.1.9-nightly.20261111.4501.

Environment

macOS 27.2 (26B123), arm64. Linux and Windows were not tested.

Area

apps/server

Impact

Cosmetic issue

Workaround

Run t3 project add <path> (with the same --base-dir as serve, if serve uses one); in an isolated run on the nightly it exited 0 and added the working-directory project to that base dir's state. t3 --no-browser --auto-bootstrap-project-from-cwd also created the project in the control run, but it logs a pairing URL instead of serve's connection-string block and, according to its source, refuses to start while another server is running for the same base dir.

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

References

Triage assessment

  • Impact level: P3
  • Assessment status: supported
  • Impact basis: Serve's help offers a flag that the command always overrides. Server startup, pairing and other behavior are unaffected; a user who follows the help gets no project and no message, and has to add the project another way.
  • Workaround status: available
  • Workaround basis: Run t3 project add <path> (with the same --base-dir as serve, if serve uses one); in an isolated run on the nightly it exited 0 and added the working-directory project to that base dir's state. t3 --no-browser --auto-bootstrap-project-from-cwd also created the project in the control run, but it logs a pairing URL instead of serve's connection-string block and, according to its source, refuses to start while another server is running for the same base dir.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions