turbo
edb257ff - fix: rust spaces auth requirements (#6453)

Commit
2 years ago
fix: rust spaces auth requirements (#6453) ### Description Fix our too strict requirement on the presence of `team_id` for making API calls. We don't have this requirement in Go and instead have the `IsLinked` method that checks that one of them is present. This is used in exactly 2 places [spaces](https://github.com/vercel/turbo/blob/main/cli/internal/runsummary/spaces.go#L71) and [analytics](https://github.com/vercel/turbo/blob/main/cli/internal/run/run.go#L440) to check if there's some way of identifying the team. In this PR we port this behavior from Go. One thing to note is that this also gets us to parity of the Go behavior for the HTTP cache (whether it's desired is another question). There's no requirement that `team_id` is non-empty when constructing the HTTP cache artifact signer: [construction](https://github.com/vercel/turbo/blob/main/cli/internal/cache/cache_http.go#L246) [signing](https://github.com/vercel/turbo/blob/main/cli/internal/cache/cache_signature_authentication.go#L59). We copy this behavior in Rust and allow for an empty `team_id`. Future work: There's some type-safety gains we can make by representing team identification as an enum to avoid the case where `APIAuth` doesn't have a team identifier. This requires an audit of what API calls require what information exactly and changing of those interfaces. There's also the question of the validity of both a team slug and a team id. In the name of getting this out quick, I copied the Go behavior with whatever flaws has so we can at least match the behavior. It will probably be slightly easier to remove each commit on it's own as it's mostly code shuffling until the final commit. ### Testing Instructions Sending info to spaces now works if only a team slug is provided e.g. ``` EXPERIMENTAL_RUST_CODEPATH=true turbo_dev build --filter='@turbo/codemod' --team=vercel --token=**secret** ... Tasks: 3 successful, 3 total Cached: 3 cached, 3 total Time: 390ms >>> FULL TURBO Sending to space Run: https://vercel.com/teams/... ``` --------- Co-authored-by: Chris Olszewski <Chris Olszewski>
Parents
Loading