Skip to content

fix(cli): resolve parent IDs when creating commit statuses - #3453

Closed
Arham-Begani wants to merge 1 commit into
python-gitlab:mainfrom
Arham-Begani:fix/cli-commit-status-create
Closed

Arham-Begani wants to merge 1 commit into
python-gitlab:mainfrom
Arham-Begani:fix/cli-commit-status-create

Conversation

@Arham-Begani

Copy link
Copy Markdown

Changes

Fixes #3452.

project-commit-status create sent /projects/{project_id}/statuses/{commit_id} literally, producing a 404. CLI initialization removes parent IDs from the payload after interpolating the manager's list path. Status creation uses a different endpoint and therefore cannot reconstruct its POST path from the unparented CLI manager.

Route this one CLI action through lazily constructed project/commit parents, then reuse the existing do_create() path. This retains the Python API's URL construction and CLI error handling, keeps parent IDs out of the JSON payload, and adds no project/commit lookup requests.

Only gitlab/v4/cli.py and its CLI tests change. The new HTTP-contract cases cover numeric and namespaced project IDs, including spaces, and assert the exact payload.

Documentation and testing

  • Unit tests in the matching CLI test module.
  • Two new regressions fail on unchanged main 51eb17e6e67a25157e04b0abc649221bd8ecc7fe, showing encoded literal {project_id} / {commit_id} in the POST URL; both pass after the fix.
  • Focused CLI/commit suite: 31 passed.
  • Full unit suite on Windows / CPython 3.13.15: 722 passed, 5 skipped.
  • Two actual python -m gitlab ... project-commit-status create subprocesses against a local HTTP server exit 0, use the correct numeric/encoded project paths, send only state and context, and make no project/commit fetch requests. Normal CLI authentication requests are accounted for. These are local wire-contract checks, not a live GitLab deployment.
  • Strict mypy: no issues in 255 source files. Repository-wide Black, isort, flake8 and pylint checks pass; Black emits its Python-3.15 target warning under Python 3.13.
  • Source distribution and wheel build successfully; both pass twine check. All 3 packaging smoke tests pass.
  • All applicable pinned pre-commit hooks pass: Black, flake8, isort, pylint and mypy. RST and Renovate hooks have no matching changed files and are skipped normally.
  • Full Docker-backed GitLab API/CLI functional tests have not been run; no live GitLab instance or credentials used.

AI assistance

OpenAI Codex investigated, reproduced, implemented and tested this contribution and drafted the description on behalf of Arham-Begani. No human-authored-code or personal-review attestation is claimed. The commit records AI-assisted-by: OpenAI Codex.

@Arham-Begani

Copy link
Copy Markdown
Author

I see this was closed without a review comment. If you have a moment, could you clarify whether the concern is the implementation, contribution policy, or existing work I missed? That would help me avoid repeating unsuitable submissions. I will leave this closed and pause further contributions to this repository pending clarification. AI involvement and the exact test evidence are documented in the description.

@codecov

codecov Bot commented Oct 20, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.85%. Comparing base (51eb17e) to head (d411883).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3453      +/-   ##
==========================================
+ Coverage   95.78%   95.85%   +0.06%     
==========================================
  Files         100      100              
  Lines        6172     6177       +5     
==========================================
+ Hits         5912     5921       +9     
+ Misses        260      256       -4     
Flag Coverage Δ
api_func_v4 83.72% <0.00%> (-0.19%) ⬇️
cli_func_v4 78.74% <20.00%> (-0.05%) ⬇️
unit 90.77% <100.00%> (+0.44%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
gitlab/v4/cli.py 71.47% <100.00%> (+1.76%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@python-gitlab python-gitlab locked and limited conversation to collaborators Oct 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI project-commit-status create: URL includes placeholders for project_id and commit_id

2 participants