Skip to content

feat: make online test team configurable via LINEAR_TEST_TEAM_KEY#110

Closed
lightstrike wants to merge 2 commits intoflipbit03:mainfrom
lightstrikelabs:feat/test-team-env-var
Closed

feat: make online test team configurable via LINEAR_TEST_TEAM_KEY#110
lightstrike wants to merge 2 commits intoflipbit03:mainfrom
lightstrikelabs:feat/test-team-env-var

Conversation

@lightstrike
Copy link
Contributor

Summary

  • Adds LINEAR_TEST_TEAM_KEY environment variable support to all online test files
  • When set, tests look up the team by key instead of blindly using teams().first(1) (which picks the first team alphabetically — fragile across workspaces)
  • When unset, behavior is unchanged (falls back to first(1))
  • Consolidates ~20 inline team-lookup patterns in CLI tests into a shared test_team_key() helper, reducing duplication

Closes #105

Files changed

  • crates/lineark-sdk/tests/online.rs — added async test_team_id() helper, replaced 8 inline lookups
  • crates/lineark-sdk/tests/blocking_online.rs — added sync test_team_id_blocking() helper, replaced 3 inline lookups
  • crates/lineark/tests/online.rs — added test_team_key() and test_team_id_cli() helpers, replaced ~20 inline lookups

Test plan

  • cargo build --workspace compiles cleanly
  • cargo clippy --workspace -- -D warnings passes
  • cargo fmt --check passes
  • All offline tests pass (76 CLI + 44 SDK + 38 codegen)
  • SDK online tests pass with LINEAR_TEST_TEAM_KEY=STA (34/34)
  • Blocking online tests pass with LINEAR_TEST_TEAM_KEY=STA (11/11)
  • CLI online tests pass with LINEAR_TEST_TEAM_KEY=STA (47/49 — 2 pre-existing ProjectCreate UUID collision failures unrelated to this change)
  • Without env var set, falls back to original first(1) behavior

@flipbit03
Copy link
Owner

Thanks for putting this together — it's solid work and the helper consolidation is a nice cleanup.

However, we've decided to go a different direction on this. Rather than making the team configurable, we want to fix the root cause: tests should not depend on pre-existing teams at all. The TeamGuard RAII pattern already exists and is proven in the team CRUD tests — the fix is to migrate all teams[0] / teams().first(1) call sites to create their own team, making every test fully self-contained (which is already the stated policy in CLAUDE.md).

See #105 (now closed) for the full rationale, and #117 for the tracking issue.

Closing this PR without merging — but thanks again for surfacing the problem and for the effort here!

@flipbit03 flipbit03 closed this Mar 6, 2026
@flipbit03 flipbit03 deleted the feat/test-team-env-var branch March 6, 2026 19:37
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.

feat: make test team configurable via environment variable

2 participants