Skip to content

fix(lk): a --project or --subdomain that doesn't resolve is an error - #1076

Merged
Topherhindman merged 1 commit into
mainfrom
fix/lk-named-project-no-fallback
Oct 23, 2026
Merged

Topherhindman merged 1 commit into
mainfrom
fix/lk-named-project-no-fallback

Conversation

@Topherhindman

@Topherhindman Topherhindman commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

When --project or --subdomain named no configured project, requireProjectWithOpts treated it like nothing resolving and fell back to selectProject, which in non-interactive mode quietly used the only configured project. A typo could act on a different project than the one named. It now returns the error, which lists the configured projects, or says none are configured. With nothing named, selectProject still picks.

Behaviour that changes:

  • Interactive runs: a mistyped name now gets the same error instead of the project picker, as commands using loadProjectDetails and --user-auth already do. The picker never mentioned the typo.
  • --dev with a named project now reports "both project and dev flags are set" instead of falling back.
  • No projects configured: a named project now gets "project not found. No projects configured…" instead of the prompt to authenticate one.

Left alone on purpose:

  • A livekit.toml naming an unconfigured project. With no projects configured, that is how an agent repo gets offered lk cloud auth. With some configured, the picker lets you choose, and agent commands then reject a project that doesn't match the toml's subdomain.
  • --dev with inline credentials. It still falls back.

Also: resolveCredentials reuses namedProject for the same check, and resolveProject's doc comment says which errors still reach the picker.

Testing:

  • TestRequireProjectNamedProjectIsAnError runs requireProjectWithOpts with --yes and a mistyped --project or --subdomain: it errors and chooses no project. Without the fix it picks the only configured one.
  • mistyped-project.txtar drops its known-bug skip and the checks that recorded today's fallback, and gains a --subdomain row.
  • The rest of cmd/lk passes.
  • Once this and the property-test PR are both in, the property's allowance for this fallback in room list can narrow to livekit.toml.

@Topherhindman
Topherhindman force-pushed the auth-tests/lk-auth-scripts branch from 81c5844 to 7d625e4 Compare October 23, 2026 17:11
@Topherhindman
Topherhindman force-pushed the fix/lk-named-project-no-fallback branch from 843292d to 56f3073 Compare October 23, 2026 17:11
@Topherhindman
Topherhindman force-pushed the auth-tests/lk-auth-scripts branch from 7d625e4 to e07a424 Compare October 23, 2026 17:53
@Topherhindman
Topherhindman force-pushed the fix/lk-named-project-no-fallback branch from 56f3073 to e386f8a Compare October 23, 2026 17:53
Base automatically changed from auth-tests/lk-auth-scripts to main October 23, 2026 19:24
When --project or --subdomain named no configured project,
requireProjectWithOpts treated it like nothing resolving and fell back
to selectProject, which in non-interactive mode quietly used the only
configured project. A typo could act on a different project than the
one named. It now returns the error, which lists the configured
projects, or says none are configured. With nothing named,
selectProject still picks.

Interactive runs change too: a mistyped name now gets the same error
instead of the picker, as commands using loadProjectDetails and
--user-auth already do. A named project with --dev now reports "both
project and dev flags are set" instead of falling back.
@Topherhindman
Topherhindman force-pushed the fix/lk-named-project-no-fallback branch from e386f8a to 01d65ef Compare October 23, 2026 19:39
Comment thread cmd/lk/utils_test.go
// TestRequireProjectNamedProjectIsAnError checks that a --project or
// --subdomain naming no configured project fails instead of falling back to
// the only configured one, even when prompts are skipped.
func TestRequireProjectNamedProjectIsAnError(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think we need this since we have the e2e test too

@Topherhindman
Topherhindman merged commit f4e8a0d into main Oct 23, 2026
25 checks passed
@Topherhindman
Topherhindman deleted the fix/lk-named-project-no-fallback branch October 23, 2026 21:47
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