[Bug]: pipeline view/job list/artifacts list still lowercase mixed-case org slugs (normalizeSlug), unlike PR #686
- Dominant language
- Go
- Stars
- 207
- Forks
- 70
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 24
Description
### Contact Details
_No response_
### What happened?
`bk pipeline view`, `bk job list --pipeline`, and `bk artifacts list --pipeline` all fail with
`404 No organization found` when the org slug is mixed case (e.g. `AcmeCorp`), because the org
value is silently lowercased before the API request.
```
$ bk pipeline view AcmeCorp/my-pipeline
Error: GET https://api.buildkite.com/v2/organizations/acmecorp/pipelines/my-pipeline: 404 No organization found
$ bk job list --pipeline AcmeCorp/my-pipeline --build 1234
Error: failed to list jobs: GET https://api.buildkite.com/v2/organizations/acmecorp/pipelines/my-pipeline/builds/1234/jobs?...: 404 No organization found
$ bk artifacts list 1234 --pipeline AcmeCorp/my-pipeline
Error: GET https://api.buildkite.com/v2/organizations/acmecorp/pipelines/my-pipeline/builds/1234/artifacts?per_page=100: 404 No organization found
```
`bk build view AcmeCorp/my-pipeline/1234` and `bk build list --pipeline AcmeCorp/my-pipeline` work correctly — they don't go through the same resolver path.
### Diagnosis
This looks like a resurgence of #424 / #685, which #686 only partially fixed. #686 fixed the
**validation regex** that rejected mixed-case slugs, but didn't touch the separate
`normalizeSlug` helper that actually lowercases the value:
```go
// internal/pipeline/resolver/cli.go
func normalizeSlug(s string) string {
return strings.ToLower(strings.ReplaceAll(s, "_", "-"))
}
```
`normalizeSlug` is called from `parsePipelineArg` (used by both `ResolveFromFlag` and
`ResolveFromPositionalArgument`) and from `WithOrg` in `internal/pipeline/resolver/resolver.go`,
so any org parsed from a positional `org/pipeline` arg, `--pipeline org/slug`, or `--org` is
lowercased regardless of the actual casing on Buildkite.
Commands going through this resolver chain are affected:
- `pipeline view`, `pipeline copy`
- `job list --pipeline`
- `artifacts list --pipeline`
- `build create`, `preflight`
`build view` / `build list --pipeline` don't hit `normalizeSlug` and work fine.
### Expected behavior
Org slugs should be preserved as given by the user (or resolved from git/config) and not
forced to lowercase, matching the fix intent of #686. `normalizeSlug`'s underscore→hyphen
substitution is presumably still wanted for local repo-derived names, but the `ToLower` call
should not apply to org (and probably not pipeline) slugs.
### Version
3.56.0
### What environment are you seeing the problem on?
Local Development
### Relevant log output
```shell
$ bk --debug pipeline view AcmeCorp/my-pipeline 2>&1 | head -5
DEBUG request uri=https://api.buildkite.com/v2/organizations/acmecorp/pipelines/my-pipeline
GET /v2/organizations/acmecorp/pipelines/my-pipeline HTTP/1.1
...
HTTP/2.0 404 Not Found
```
Contributor guide
Research direction
Start in internal/pipeline/resolver/cli.go at normalizeSlug and parsePipelineArg, then inspect WithOrg in internal/pipeline/resolver/resolver.go and their callers. Reproduce the mixed-case AcmeCorp examples, preserving organization slugs while retaining the intended underscore-to-hyphen behavior, and verify the affected pipeline, job, artifact, build-create, and preflight commands no longer request a lowercased organization.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 74/100