Skip to content

Implementation/COMMS-1047: Label creation API with case-insensitive dedupe - #25553

Open
akabiru wants to merge 4 commits into
implementation/comms-1046-labels-schema-and-workspace-listingfrom
implementation/comms-1047-label-creation-api
Open

akabiru wants to merge 4 commits into
implementation/comms-1046-labels-schema-and-workspace-listingfrom
implementation/comms-1047-label-creation-api

Conversation

@akabiru

@akabiru akabiru commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

https://community.openproject.org/wp/COMMS-1047

Adds POST /api/v3/labels for creating labels straight from the work package dropdown. Names are matched case-insensitively: an existing label with the same name in another casing is returned instead of creating a duplicate, including when it appears concurrently between validation and insert. The create service reports that race as the usual "already taken" error, so the admin form no longer fails on it.

AI involvement

Collaborative – AI generated a substantial part of the code; I reviewed and understand every line.

@akabiru
akabiru added this pull request to stack #25555 September 23, 2026 20:57
@akabiru akabiru changed the title implementation/comms 1047 label creation api Implementation/COMMS-1047: Label creation API with case-insensitive dedupe Sep 23, 2026
@akabiru akabiru self-assigned this Sep 23, 2026
@akabiru akabiru added the ai: Collaborative 💻 AI generated a substantial part of the code; A human reviewed and understands every line. label Sep 23, 2026
@akabiru akabiru added this to the 18.0.x milestone Sep 23, 2026
@akabiru
akabiru force-pushed the implementation/comms-1047-label-creation-api branch from 4cfaa00 to a249145 Compare September 24, 2026 06:13
@github-actions github-actions Bot removed the ai: Collaborative 💻 AI generated a substantial part of the code; A human reviewed and understands every line. label Sep 24, 2026
@akabiru
akabiru force-pushed the implementation/comms-1047-label-creation-api branch from a249145 to 08512b9 Compare September 24, 2026 07:03
@akabiru
akabiru force-pushed the implementation/comms-1047-label-creation-api branch from 08512b9 to 4feef22 Compare September 24, 2026 13:39
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/gantt/spec/features/timeline/timeline_dates_spec.rb[1:2:1]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #25553, linked for reference only):

- `rspec ./modules/gantt/spec/features/timeline/timeline_dates_spec.rb[1:2:1]`

Treat this as a standalone task, unrelated to PR #25553. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #25553 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @akabiru to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @akabiru, and request a review from @akabiru.
On every commit, set @akabiru as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@akabiru
akabiru force-pushed the implementation/comms-1047-label-creation-api branch from 4feef22 to d5ff4e4 Compare September 24, 2026 14:28
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./spec/features/notifications/navigation_spec.rb[1:1:1]
🤖 Ask Copilot to investigate

Copy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer.

@copilot The following spec(s) are flaky in CI (first seen on PR #25553, linked for reference only):

- `rspec ./spec/features/notifications/navigation_spec.rb[1:1:1]`

Treat this as a standalone task, unrelated to PR #25553. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #25553 or reuse that branch.

Follow the playbook in docs/development/testing/handling-flaky-tests/README.md to find the root cause and fix the underlying race — do not skip, delete, or weaken the spec to make it pass; disabling is a last resort per the playbook, and only with a bug ticket. Verify the fix by running the spec(s) repeatedly (e.g. `script/bulk_run_rspec --run-count 10`).

If you cannot reproduce the flake or are not confident in a fix after reasonable investigation, do not fabricate a change or skip the spec to force CI green. Instead, leave the pull request in draft and document what you tried, the suspected cause, and any leads in its description, then assign @akabiru to take over.

Once the fix is verified, title the PR after the spec(s) it fixes, and use the PR description to explain the root cause, how the change resolves it, and the before/after results. Label the PR `flaky-spec`, assign @akabiru, and request a review from @akabiru.
On every commit, set @akabiru as the sole co-author with a `Co-authored-by:` trailer (use their GitHub no-reply email so it links to their account), so it is traceable who dispatched the fix.

@akabiru
akabiru marked this pull request as ready for review September 28, 2026 07:41
@akabiru
akabiru requested a review from a team September 28, 2026 07:41
@akabiru akabiru added the ai: Collaborative 💻 AI generated a substantial part of the code; A human reviewed and understands every line. label Sep 28, 2026
@github-actions github-actions Bot removed the ai: Collaborative 💻 AI generated a substantial part of the code; A human reviewed and understands every line. label Sep 28, 2026
@akabiru akabiru added the ai: Collaborative 💻 AI generated a substantial part of the code; A human reviewed and understands every line. label Sep 28, 2026
Creating a label from the work package dropdown must hand back the
existing label when one with the same name in another casing exists,
including when it appears concurrently between lookup and insert.
A duplicate inserted between the uniqueness validation and the INSERT
raised through the admin form as a 500. The create service now turns the
unique index violation into the same "taken" error, so every caller,
including the find-or-create path, handles the race the same way.
Labels can now be created through the API.
@akabiru
akabiru force-pushed the implementation/comms-1047-label-creation-api branch from d5ff4e4 to 3e47058 Compare September 29, 2026 10:01

@brunopagno brunopagno left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's go! 🎉

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai: Collaborative 💻 AI generated a substantial part of the code; A human reviewed and understands every line.

Development

Successfully merging this pull request may close these issues.

2 participants