Skip to content

[COMMS-915] Count work package summary versions from target_versions#24400

Open
akabiru wants to merge 4 commits into
devfrom
implementation/comms-915-adjust-workpackage-summary-page-to-use-target_versions
Open

[COMMS-915] Count work package summary versions from target_versions#24400
akabiru wants to merge 4 commits into
devfrom
implementation/comms-915-adjust-workpackage-summary-page-to-use-target_versions

Conversation

@akabiru

@akabiru akabiru commented Jul 22, 2026

Copy link
Copy Markdown
Member

COMMS-915

The work package summary page counted versions through the deprecated version_id column, which only ever holds a work package's first target version. Work packages assigned to several target versions were therefore counted under a single version, and the totals no longer matched the filtered list a cell links to (that drill-down already filters on target_versions). The summary now counts through the work_package_versions target associations, so each work package is counted under every version it targets and the counts agree with the list behind them. The section heading also follows the multiple versions feature flag, reading "Target versions" when it is on, matching how the rest of the UI labels the field.

Work package #42 targets both 1.0.0 and 2.0.0. Before, it was counted only under 1.0.0, so 2.0.0 read 3; after, it is counted under both and 2.0.0 reads 4.

Before
comms-915-summary-before

After

comms-915-summary-after-UPDATED

@akabiru akabiru self-assigned this Jul 22, 2026
akabiru added 2 commits July 22, 2026 21:28
The version summary counted through the deprecated version_id column, which
holds only the first target version, so work packages with several target
versions were undercounted and did not match the drill-down list (already
filtered on target_versions).
The category headings rendered human_attribute_name(report_type), bypassing
each report's #title, so the version heading never reflected the multiple
versions feature. Rendering report.title lets the version report show Target
versions when the feature is on, and drops the raw report_type shown as the
drill-down legend.
@akabiru
akabiru force-pushed the implementation/comms-915-adjust-workpackage-summary-page-to-use-target_versions branch from f749032 to 4288dd4 Compare July 22, 2026 18:29
@akabiru akabiru changed the title Implementation/COMMS-915: Count work package summary versions from target_versions [COMMS-915] Count work package summary versions from target_versions Jul 22, 2026
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./spec/features/roles/report_spec.rb[1:1]
  • rspec ./spec/features/roles/report_spec.rb[1:2]
  • rspec ./spec/features/roles/report_spec.rb[1:3]
  • rspec ./spec/features/search/search_spec.rb[1:4: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 #24400, linked for reference only):

- `rspec ./spec/features/roles/report_spec.rb[1:1]`
- `rspec ./spec/features/roles/report_spec.rb[1:2]`
- `rspec ./spec/features/roles/report_spec.rb[1:3]`
- `rspec ./spec/features/search/search_spec.rb[1:4:1]`

Treat this as a standalone task, unrelated to PR #24400. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #24400 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.

The summary groups work packages under each target version (and each
subproject), so a section heading names a single one and reads better
alongside its singular siblings. Adds a singular target_version label
for the multiple-versions case and folds the version count query's kind
literal into the WorkPackageVersion enum constant.
Comment thread app/models/work_package.rb Fixed

def title
I18n.t(:label_subproject_plural)
I18n.t(:label_subproject)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ℹ️ This change is due to the change in _report_cateogy.html.erb to use title instead of the duplicate WorkPackage.human_attribute_name(report.report_type) calls. Titles in the work package summary page are generally singular.

@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/overviews/spec/features/managing_dashboard_page_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 #24400, linked for reference only):

- `rspec ./modules/overviews/spec/features/managing_dashboard_page_spec.rb[1:1:1]`

Treat this as a standalone task, unrelated to PR #24400. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #24400 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.

Switch the target-version count query to sanitize_sql_array with named
placeholders so the project id and kind are bound rather than
interpolated, clearing the SQL injection warning.
@akabiru
akabiru marked this pull request as ready for review July 23, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants