89 lines
4.1 KiB
Markdown
89 lines
4.1 KiB
Markdown
---
|
|
id: "bug-1935"
|
|
status: "fixed"
|
|
status_updated: "2026-10-10"
|
|
status_note: ""
|
|
component: "apiserver"
|
|
severity: "wrong-result"
|
|
timestamp: "2026-10-10T04:31:27Z"
|
|
last_seen: "2026-10-10T04:31:27Z"
|
|
occurrences: 1
|
|
files: ["src/frontend/apiserver/models/jobs.go", "src/frontend/apiserver/controllers/jobs.go", "src/frontend/xcecli/filters/job_filter.go"]
|
|
tags: ["apiserver", "xcecli", "filter", "project"]
|
|
related: ["bug-1934"]
|
|
fix_commits: ["4a38bb3c"]
|
|
gitea_issue: 360
|
|
gitea_synced_status: "fixed"
|
|
gitea_synced_hash: "0b51c602bc8f"
|
|
---
|
|
|
|
# bug-1935: xcecli jobs list -P <project> fails: apiserver rejects project_name filter (unsupported filter)
|
|
|
|
## Description
|
|
**Observed:** `xcecli jobs list -P <project>` (`-P/--project`,
|
|
`src/frontend/xcecli/cmd/jobs/list.go:356`) sends the filter
|
|
`{project_name:eq:<project>}` (`xcecli/filters/job_filter.go:108-109`), but
|
|
`project_name` is commented out of the apiserver's `JOB_SUPPORT_FILTERS`
|
|
(`src/frontend/apiserver/models/jobs.go:178`), so `validateJobQueryFilters()`
|
|
(`controllers/jobs.go:470-483`) rejects the request:
|
|
```
|
|
unsupported filter: project_name
|
|
```
|
|
(HTTP 400, INVALID_PARAMS). The same holds for `license_project`
|
|
(`models/jobs.go:179`, `job_filter.go:112-113`). Found by source reading; not
|
|
yet run against a live apiserver.
|
|
|
|
**Expected:** `xcecli jobs list -P eng` lists the caller's visible jobs whose
|
|
project is `eng`.
|
|
**Impact:** wrong result: the documented `-P` (and license-project) filter of
|
|
`xcecli jobs list` always fails with an error; users cannot list jobs by
|
|
project. No data is affected.
|
|
**Found by:** review, during `/kiro-spec-requirements project-config`
|
|
(2026-10-10); `project-config` Requirement 7.5 needs this filter.
|
|
UPDATE (2026-10-10): confirmed by `TestJobHandler_ProjectFilters`
|
|
(`src/frontend/apiserver/controllers/job_scope_test.go`) before the fix:
|
|
`status = 400 ... unsupported filter: project_name`.
|
|
|
|
## Environment
|
|
- OS: no /etc/os-release; Docker container; NixOS kernel; kernel Linux 6.18.33 x86_64
|
|
- libc: glibc 2.42-47 (interpreter /nix/store/wb6rhpznjfczwlwx23zmdrrw74bayxw4-glibc-2.42-47/lib/ld-linux-x86-64.so.2), from src/xce.build/frontend/apiserver/xce_apiserver
|
|
- Toolchain: go1.25.5 linux/amd64 (nix dev shell); gcc (GCC) 15.2.0, meson 1.9.1
|
|
- Build: asan (xce.build) binary exists at this commit; the bug was found by reading the source, not by running it
|
|
- Code: scheduler-framework @ 54c8b29e
|
|
- Deployment: any apiserver deployment (single or HA); not reproduced on a running cluster yet
|
|
|
|
## Reproduction
|
|
1. Start an apiserver (any deployment) and submit a job with
|
|
`xcecli jobs submit -P eng sleep 1`.
|
|
2. `xcecli jobs list -P eng`
|
|
3. Expected: the job is listed; per the source, the apiserver replies HTTP 400
|
|
`unsupported filter: project_name`.
|
|
- Frequency: deterministic by code reading; not yet executed.
|
|
- Evidence: the code lines quoted in Description; no logs.
|
|
|
|
## Root cause
|
|
`JOB_SUPPORT_FILTERS` (`src/frontend/apiserver/models/jobs.go`) had
|
|
`project_name` and `license_project` commented out, and
|
|
`validateJobQueryFilters()` (`controllers/jobs.go`) rejects every field not on
|
|
that list, while `xcecli` (`filters/job_filter.go:108-113`) sends exactly
|
|
those fields for `-P` and the license-project option. The job store already
|
|
carries both fields (`JobInfo.ProjectName`, `LicenseProject`). Since:
|
|
pre-existing, origin unknown.
|
|
## Fix
|
|
`models/jobs.go`: `project_name` and `license_project` are now in
|
|
`JOB_SUPPORT_FILTERS`. No other change was needed: the store query filters
|
|
by the JSON field name. `ARRAY_JOB_SUPPORT_FILTERS` (array statistics) is
|
|
unchanged.
|
|
## Verification
|
|
- Test: `TestJobHandler_ProjectFilters`
|
|
(`src/frontend/apiserver/controllers/job_scope_test.go`): RED before (400
|
|
unsupported filter), GREEN after (`{project_name:eq:eng}` and
|
|
`{license_project:eq:lic2}` select only the matching job).
|
|
- Suites: same run as bug-1934: apiserver and xcecli Go tests ok, meson
|
|
`apiserver` suite 1/1 OK, asan, 2026-10-10.
|
|
- Live: n/a: the change is a filter whitelist entry exercised through the
|
|
real handler and store in the test.
|
|
|
|
## References
|
|
- Related: bug-1934
|
|
- Spec: `.kiro/specs/project-config/requirements.md` Requirement 7.5
|