[#74314] Use displayId on backlogs view work package click#22905
Merged
myabc merged 6 commits intoMay 1, 2026
Merged
Conversation
342dab9 to
17e5b18
Compare
ed518aa to
0231cd6
Compare
myabc
requested changes
Apr 29, 2026
Contributor
myabc
left a comment
There was a problem hiding this comment.
This adds a significant amount of complexity for a concern that is not really Backlogs-related - I'd prefer to see us implement #to_param first - not change the path helper call sites.
The two Backlogs card components (sprint/bucket and inbox) built the split-view and full-view URLs by passing the WorkPackage model to Rails path helpers, which fall back to to_param (numeric PK). Pass work_package.display_id explicitly so semantic-mode projects get URLs like /work_packages/PROJ-7 instead of /work_packages/42. The Stimulus story controller's selection-sync regex assumed numeric identifiers (/details/(\d+)); widen it via the shared WP_ID_URL_PATTERN so semantic segments match too, and add a displayId Stimulus value so the controller can compare the URL capture against either identifier form. Component specs cover the semantic-mode URL construction; the existing classic-mode specs double as the regression guard for the numeric path.
Three more Backlogs view components were still passing the WorkPackage model to Rails path helpers, which falls back to to_param (numeric PK): - sprint_component: split-view and full-view URLs in story rows. Also threads displayId through as a Stimulus value so backlogs--story can match the URL segment against either id form (mirrors the inbox/bucket fix from the previous commit). - inbox_menu_component: open details, open fullscreen, and clipboard copy URLs in the overflow menu. - story_menu_list_component: same trio for sprint stories. The "copy work package ID" clipboard item keeps the numeric primary key because that action's contract is explicitly to copy the integer ID. Each component spec gets a "in semantic mode" context that asserts the URLs use the displayId and do not include the numeric id, mirroring the pattern from the bucket/inbox specs in the previous commit. The existing classic-mode examples remain as the regression guard for the numeric path; sprint_component additionally gains an explicit classic-mode data- attribute check since it had none before.
The backlog details route accepted any segment as :work_package_id, diverging from the equivalent core WP routes which apply WorkPackage::SemanticIdentifier::ID_ROUTE_CONSTRAINT. Aligning the constraint keeps the surface uniform and prevents a future sibling segment from silently matching this route.
- Replace eq("BACKLOG-1") / eq("INBOX-1") with start_with(...) so the
test pins the URL shape rather than coupling to the allocator's
"starts at 1" contract.
- Pin data-backlogs--story-display-id-value, the data-attr the
story Stimulus controller now reads to compare URL segments.
- Add the symmetric not_to include("/details/#{numeric_id}")
negative assertion alongside the existing full-view one.
WorkPackage#to_param now returns display_id, so URL helpers emit semantic IDs without per-callsite display_id boilerplate. Drop the explicit .display_id arguments from split_url, full_url, and the overflow-menu open/copy links; leave the Stimulus displayId value pass-through (the JS selection-from-URL comparator still needs both forms) and the backlog_details route constraint (still needed to accept either form in the URL) untouched. Component specs already cover semantic and classic URL output and continue to pass.
0231cd6 to
9337d66
Compare
The previous comment described what the code does (compare two forms) without explaining why a numeric URL would legitimately appear in semantic mode. Name the actual reason — bookmarks and external links predate semantic-mode activation — so the defensive comparison is self-justifying to a future reader.
Base automatically changed from
implementation/74543-wp-to-param-override
to
dev
April 30, 2026 08:52
myabc
reviewed
May 1, 2026
Comment on lines
+163
to
+164
| clipboard_id = page.find("clipboard-copy##{"work_package_#{work_package.id}_menu_copy_work_package_id"}") | ||
| expect(clipboard_id[:value]).to eq(work_package.id.to_s) |
Contributor
There was a problem hiding this comment.
I'm not sure this is the desired behaviour.
myabc
approved these changes
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ticket
https://community.openproject.org/work_packages/74314
Follow-up from the PR 22733 review: #22733 (review)
Screenshots
Verified manually in semantic mode against the
ACSMTproject's Backlogs view on the local dev edge.Story-row Stimulus values carry the semantic identifier in both URLs and a
displayIdValuefor selection sync:Click → split view URL uses the semantic identifier:
Follow-up scope verification
Additional sprint and overflow-menu surfaces verified live against the
SEPproject (sprint story #20919 →SEP-7, inbox item #20881 →SEP-6).Sprint card story rows (
sprint_component) —displayIdValuedata-attr and both URLs carry the semantic identifier:Sprint story overflow menu (
story_menu_list_component) — Open details, Open fullscreen, and Copy URL hrefs all use the semantic identifier; the Copy work package ID action intentionally keeps the numeric primary key:Inbox row overflow menu (
inbox_menu_component) — same trio of semantic-ID URLs, same numeric Copy work package ID:Route constraint —
backlog_detailsnow appliesWorkPackage::SemanticIdentifier::ID_ROUTE_CONSTRAINT, so navigating to/projects/SEP/backlogs/backlog/details/SEP-7resolves the correct work package via thedisplay_idfinder:Fix
WorkPackage#to_paramto generate semantic aware routes. See Override WorkPackage#to_param so URL helpers emit semantic IDs #22974