Skip to content

feat: bl project status add / update / delete / reorder#77

Merged
23prime merged 4 commits intomainfrom
feature/38-project-status-add-update-delete-reorder
Mar 17, 2026
Merged

feat: bl project status add / update / delete / reorder#77
23prime merged 4 commits intomainfrom
feature/38-project-status-add-update-delete-reorder

Conversation

@23prime
Copy link
Copy Markdown
Owner

@23prime 23prime commented Mar 17, 2026

Checklist

  • Target branch is main
  • Status checks are passing
  • Documentation updated if user-visible behavior changed (website/docs/, website/i18n/ja/, README.md)

Summary

  • Add bl project status add <id-or-key> --name <name> --color <color>POST /api/v2/projects/{key}/statuses
  • Add bl project status update <id-or-key> --status-id <id>PATCH /api/v2/projects/{key}/statuses/{id}
  • Add bl project status delete <id-or-key> --status-id <id> --substitute-status-id <id>DELETE /api/v2/projects/{key}/statuses/{id}
  • Add bl project status reorder <id-or-key> --status-id <id>...PATCH /api/v2/projects/{key}/statuses/updateDisplayOrder

Reason for change

Implements the project status management commands requested in #38.

Changes

  • src/api/project.rs: added four new BacklogClient methods and corresponding tests
  • src/api/mod.rs: added trait method declarations and BacklogApi for BacklogClient delegations
  • src/cmd/project/status.rs: added add/update/delete/reorder subcommands alongside existing list; update uses try_new requiring at least one of --name/--color
  • src/main.rs: clap wiring for new subcommands
  • website/docs/commands.md, website/i18n/ja/.../commands.md: documentation and coverage table updated

Notes

Closes #38

Copilot AI review requested due to automatic review settings March 17, 2026 04:39
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 17, 2026

📝 Walkthrough

Walkthrough

Adds four project-status operations (add, update, delete, reorder): BacklogApi trait methods and BacklogClient implementations, HTTP handlers in project API, CLI subcommands/args/validation + tests, and updated documentation and i18n.

Changes

Cohort / File(s) Summary
API trait & client
src/api/mod.rs, src/api/project.rs
Added BacklogApi trait methods and BacklogClient implementations: add_project_status, update_project_status, delete_project_status, reorder_project_statuses. Implemented HTTP calls (POST/PATCH/DELETE/PATCH), JSON (de)serialization, and error-wrapping.
CLI commands & validation
src/cmd/project/status.rs
Added argument structs and handlers for Add/Update/Delete/Reorder (ProjectStatusAddArgs, ProjectStatusUpdateArgs, ProjectStatusDeleteArgs, ProjectStatusReorderArgs), validation (color, required fields, uniqueness), _with variants, output formatting, and tests.
CLI dispatcher
src/main.rs
Extended ProjectStatusCommands enum with Add, Update, Delete, Reorder variants and wired dispatch to new handlers.
Docs & i18n
website/docs/commands.md, website/i18n/ja/.../commands.md
Added usage examples and docs for project status add/update/delete/reorder; updated command table and parameter syntax (e.g., --status-id) and JSON output notes.
Misc
.cspell/dicts/project.txt
Added .cspell dictionary entry: hexdigit.

Sequence Diagram(s)

sequenceDiagram
  participant CLI as "CLI (main/status)"
  participant API as "BacklogApi / BacklogClient"
  participant HTTP as "HTTP client"
  participant Server as "Backlog API server"

  CLI->>API: call add/update/delete/reorder(args)
  API->>HTTP: build HTTP request (POST/PATCH/DELETE/PATCH) to /projects/{key}/statuses...
  HTTP->>Server: send HTTP request
  Server-->>HTTP: JSON response
  HTTP-->>API: return raw JSON
  API->>API: deserialize -> ProjectStatus / Vec<ProjectStatus]
  API-->>CLI: return Result<ProjectStatus|Vec<ProjectStatus]>
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • feat: add project subcommands #13 — Adds project status listing and foundational ProjectStatus types; overlaps in status surface and CLI wiring.
  • feat: Add bl space activities command #1 — Modified BacklogApi trait and BacklogClient for additional endpoints; related API-surface changes.
  • linked issue #38 — Feature objective explicitly requests add/update/delete/reorder endpoints for project statuses; direct specification match.

Poem

🐇 I hopped through code with nimble paws,
I stitched new status moves and CLI laws,
Add, update, delete, reorder set,
Colors and order — all neatly met,
A tiny carrot for tests and docs applause!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 47.73% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding four new project status management commands (add, update, delete, reorder) to the CLI.
Linked Issues check ✅ Passed All four requirements from issue #38 are met: add/update/delete/reorder commands implemented with correct API endpoints and proper validation (e.g., update requires name or color).
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the four project status management commands plus documentation updates and dictionary additions, with no unrelated modifications present.
Description check ✅ Passed The pull request description clearly and comprehensively describes the implemented changes for adding project status management CLI commands and their corresponding API methods.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/38-project-status-add-update-delete-reorder
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feature/38-project-status-add-update-delete-reorder
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds full CRUD-style support for project statuses to the bl project status command group, including corresponding Backlog API client methods and documentation updates (English + Japanese).

Changes:

  • Add new CLI subcommands: bl project status add|update|delete|reorder (plus wiring in main.rs)
  • Implement new BacklogApi trait methods and BacklogClient endpoints for project status management
  • Update command reference docs and mark the endpoints as implemented in the commands/API mapping table

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
website/docs/commands.md Documents the new project status subcommands and updates the API↔command coverage table (EN).
website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md Same documentation and coverage table updates for Japanese docs.
src/main.rs Adds clap subcommands + routes to the new cmd handlers/Args structs.
src/cmd/project/status.rs Implements cmd-layer handlers (*_with) + Args structs + unit tests for add/update/delete/reorder.
src/api/project.rs Adds BacklogClient methods for POST/PATCH/DELETE/PATCH endpoints for project statuses.
src/api/mod.rs Extends BacklogApi trait + implements the new methods for BacklogClient.

You can also share your feedback on Copilot code review. Take the survey.

…ry_new

Addresses review comment: empty status_ids list is semantically invalid
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/api/project.rs (1)

231-306: Add API-layer tests for the new project status endpoints.

These four methods are the only new src/api/project.rs bindings without matching httpmock coverage. That leaves the verb/path/form wiring unverified, especially the repeated statusId[] payload in reorder_project_statuses.

As per coding guidelines, "For api/ layer tests, use httpmock to spin up a local HTTP server and construct BacklogClient::new_with(base_url, api_key) instead of calling BacklogClient::from_config()."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/api/project.rs` around lines 231 - 306, Add httpmock-based API-layer
tests for the four new functions add_project_status, update_project_status,
delete_project_status, and reorder_project_statuses: spin up an httpmock server
and construct the client with BacklogClient::new_with(base_url, api_key), then
assert the HTTP verb, path, and form body for each endpoint (including repeated
"statusId[]" entries for reorder_project_statuses) and return representative
responses to validate successful serde via the existing methods; ensure each
test verifies the exact form parameters, status_id/substituteStatusId usage, and
that the client deserializes the response into ProjectStatus/Vec<ProjectStatus>.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/cmd/project/status.rs`:
- Around line 137-145: The constructor ProjectStatusDeleteArgs::new currently
allows creating a delete request where substitute_status_id == status_id; add a
domain-level validation in Args::try_new (not just in the CLI parser) to detect
this case and return an Err indicating the substitute status cannot equal the
status being deleted, and stop callers from invoking the API path; keep
ProjectStatusDeleteArgs::new as a simple initializer if desired but ensure
Args::try_new checks the invariant (compare status_id and substitute_status_id)
and returns a clear error so cmd/*_with code never sends a request that
round-trips to the server for an obvious domain error.
- Around line 37-53: ProjectStatusAddArgs::new (and
ProjectStatusUpdateArgs::try_new) currently accept any string for color; add
validation to reject values that do not match the required "#RRGGBB" hex format
before any API call: implement a simple domain-invariant check (e.g., regex
/^#[0-9A-Fa-f]{6}$/) inside ProjectStatusAddArgs::new and inside
ProjectStatusUpdateArgs::try_new (or their constructors) and return an error (or
propagate a Result::Err) on invalid input so callers in cmd/*_with never
dispatch invalid colors to the network; ensure the error type/message matches
existing argument-validation conventions.

---

Nitpick comments:
In `@src/api/project.rs`:
- Around line 231-306: Add httpmock-based API-layer tests for the four new
functions add_project_status, update_project_status, delete_project_status, and
reorder_project_statuses: spin up an httpmock server and construct the client
with BacklogClient::new_with(base_url, api_key), then assert the HTTP verb,
path, and form body for each endpoint (including repeated "statusId[]" entries
for reorder_project_statuses) and return representative responses to validate
successful serde via the existing methods; ensure each test verifies the exact
form parameters, status_id/substituteStatusId usage, and that the client
deserializes the response into ProjectStatus/Vec<ProjectStatus>.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fa6071c7-3e82-43f0-9004-46c498e694fc

📥 Commits

Reviewing files that changed from the base of the PR and between 6078333 and 2767298.

📒 Files selected for processing (6)
  • src/api/mod.rs
  • src/api/project.rs
  • src/cmd/project/status.rs
  • src/main.rs
  • website/docs/commands.md
  • website/i18n/ja/docusaurus-plugin-content-docs/current/commands.md

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/cmd/project/status.rs (1)

248-291: Strengthen the new command-layer tests.

The success cases only assert is_ok(), and MockApi ignores the forwarded key/IDs/params. That means request-shaping and output-formatting regressions can slip through even though *_with owns both behaviors.

As per coding guidelines, "Validation boundaries: main.rs (clap) handles syntactic/type-level checks; Args::try_new handles domain invariants; cmd/*_with handles API call logic, output formatting, and API-spec constraints; api/ handles HTTP-level error translation only".

Also applies to: 304-493

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/cmd/project/status.rs` around lines 248 - 291, The MockApi methods
(get_project_statuses, add_project_status, update_project_status,
delete_project_status, reorder_project_statuses) currently ignore incoming
key/IDs/params and only return canned statuses; update MockApi to validate
and/or record the forwarded arguments so tests can assert request shaping: add
fields like expected_key/expected_status_id/expected_params/expected_status_ids
or a last_call enum on MockApi and have each method compare incoming args
against expectations (or populate last_call) and return Err when mismatched;
then tighten the tests to set those expectations and assert specific call
parameters and formatted output (not just is_ok()) for the cmd/*_with paths that
own API call logic and formatting.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/cmd/project/status.rs`:
- Around line 189-200: ProjectStatusReorderArgs::try_new currently only rejects
empty status_ids but must also reject duplicate IDs; update try_new to validate
that the provided status_ids Vec<u64> contains no duplicates (e.g., by inserting
into a HashSet and comparing lengths or checking for any repeated entry) and
return an anyhow::Error with a clear message like "Duplicate --status-id values
are not allowed for reorder" when duplicates are found; keep this domain
invariant in try_new so invalid duplicate inputs are caught locally before any
API call.

---

Nitpick comments:
In `@src/cmd/project/status.rs`:
- Around line 248-291: The MockApi methods (get_project_statuses,
add_project_status, update_project_status, delete_project_status,
reorder_project_statuses) currently ignore incoming key/IDs/params and only
return canned statuses; update MockApi to validate and/or record the forwarded
arguments so tests can assert request shaping: add fields like
expected_key/expected_status_id/expected_params/expected_status_ids or a
last_call enum on MockApi and have each method compare incoming args against
expectations (or populate last_call) and return Err when mismatched; then
tighten the tests to set those expectations and assert specific call parameters
and formatted output (not just is_ok()) for the cmd/*_with paths that own API
call logic and formatting.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3dd5b9c4-706e-4e36-a74f-38cfdb78eceb

📥 Commits

Reviewing files that changed from the base of the PR and between 2767298 and 41ddb57.

📒 Files selected for processing (3)
  • .cspell/dicts/project.txt
  • src/cmd/project/status.rs
  • src/main.rs
✅ Files skipped from review due to trivial changes (1)
  • .cspell/dicts/project.txt
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main.rs

Addresses review comment: duplicate --status-id values cannot describe a valid display order
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/cmd/project/status.rs`:
- Around line 57-232: Extract each subcommand (add, update, delete, reorder)
into its own module file under src/cmd/project: create add.rs, update.rs,
delete.rs and reorder.rs; move the corresponding public functions and their
*_with variants (add / add_with, update / update_with, delete / delete_with,
reorder / reorder_with) and their related Args structs and impls into their
respective files preserving signatures (e.g., ProjectStatusAddArgs +
add/add_with, ProjectStatusUpdateArgs + update/update_with, etc.) and keep
serialization/printing logic in those files; leave src/cmd/project/status.rs as
the wiring module that pub mod {add, update, delete, reorder}; and re-export the
public functions (pub use add::add; pub use add::add_with; etc.), ensuring the
top-level functions that call BacklogClient::from_config() remain in the wiring
file (or moved with identical behavior) so callers keep the same API.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7817ac17-6ad0-4a30-9a4f-1287c9636be8

📥 Commits

Reviewing files that changed from the base of the PR and between 41ddb57 and 1df0a89.

📒 Files selected for processing (1)
  • src/cmd/project/status.rs

@23prime 23prime merged commit fc576fb into main Mar 17, 2026
11 checks passed
@23prime 23prime deleted the feature/38-project-status-add-update-delete-reorder branch March 17, 2026 08:38
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: bl project status add / update / delete / reorder

2 participants