Skip to content

Commit 4ad09da

Browse files
thykelclaude
andauthored
[COMMS-843] Make Target Versions the default for new installations (#24690)
* [COMMS-843] Remove the work_package_multiple_versions feature flag * [COMMS-843] Enable multiple target versions per WP by default * [COMMS-843] Pin specs that relied on multiple versions being off With the setting now defaulting to on, specs describing the legacy single-version behaviour no longer get it implicitly. State the assumption where it is load-bearing: contexts named "inactive"/"off"/ "disabled", the single-value validation rule, and the surfaces that expose the deprecated version column (query columns, query form API, PDF export, grouping and sorting by version). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * iron out the test coverage a bit * appease rubocop * [COMMS-843] Read the target version links via parse_json `response.parsed_body` is not available here: these are rack-test requests, so `response` is a Rack::MockResponse. Use json_spec's `parse_json`, which reads the body without tripping Rails/ResponseParsedBody. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * [COMMS-843] Pin the feature specs covering the single version field Same reason as the unit specs: with the setting on by default, the work package form, table columns, sort options and form configuration expose target versions instead of the deprecated version, so the specs describing the single-version UI have to say so. Whole spec pinned where the version attribute runs through all of it (baseline rendering, form configuration, assign_versions permission), single example or context where it does not. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * [COMMS-843] Exercise the target versions field on the new default Two of the pinned specs already drove the targetVersions field; they only needed the version to exist before the page loads, since the multi-value field resolves its options then, unlike the single-value one. Create it eagerly and drop the pins, so both cover the default again. Also cover the form configuration with the feature on, which had no feature-level coverage left: target versions is offered in place of the deprecated version and can be dragged out of the group. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * [COMMS-843] Restore the pins on the work package form specs Creating the version before the page loads was not the reason these specs failed: the target versions autocompleter in the work package full view offers no options at all while multiple versions is enabled, so nothing can be picked by name. Pin them back to the single version field, which is what they describe, and leave the empty autocompleter to be looked at on its own. The form configuration coverage added alongside stays - it passes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> * remove some old flag references * pin some more tests after merge from dev * pin last test --------- Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
1 parent 4680aa7 commit 4ad09da

37 files changed

Lines changed: 168 additions & 60 deletions

File tree

config/constants/settings/definition.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ class Definition
13621362
work_package_multiple_versions: {
13631363
description: "Enable multiple version assignments on work packages.",
13641364
format: :boolean,
1365-
default: false
1365+
default: true
13661366
},
13671367
work_packages_activities_tab_polling_interval_in_ms: {
13681368
description: "Interval in milliseconds at which the work package activities tab polls for updates.",

modules/boards/spec/features/action_boards/version_board_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def create_new_version_board
9999
login_as(user)
100100
end
101101

102-
it "allows management of boards" do
102+
it "allows management of boards", with_settings: { work_package_multiple_versions: false } do
103103
board_page = create_new_version_board
104104

105105
board_page.expect_card "Open version", work_package.subject, present: true

modules/reporting/spec/models/cost_query/filter_spec.rb

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,14 +291,14 @@ def create_matching_object_with_time_entries(factory, work_package_field, entry_
291291
expect(query.result.count).to eq(3)
292292
end
293293

294-
it "labels the filter 'Version' while multiple versions is off" do
294+
it "labels the filter 'Version' while multiple versions is off", with_settings: { work_package_multiple_versions: false } do
295295
expect(CostQuery::Filter::VersionId.label).to eq("Version")
296296
end
297297

298298
# While the feature is off a work package is single-version, so the filter
299299
# only sees its primary target version (the lowest version id, i.e. what
300300
# target_versions.first returns).
301-
it "matches a work package through its primary target version" do
301+
it "matches a work package through its primary target version", with_settings: { work_package_multiple_versions: false } do
302302
primary_version = create(:version, project:)
303303
secondary_version = create(:version, project:)
304304
work_package = create_work_package_with_time_entry(version: primary_version)
@@ -308,7 +308,8 @@ def create_matching_object_with_time_entries(factory, work_package_field, entry_
308308
expect(query.result.count).to eq(1)
309309
end
310310

311-
it "ignores a non-primary target version while multiple versions is off" do
311+
it "ignores a non-primary target version while multiple versions is off",
312+
with_settings: { work_package_multiple_versions: false } do
312313
primary_version = create(:version, project:)
313314
secondary_version = create(:version, project:)
314315
work_package = create_work_package_with_time_entry(version: primary_version)
@@ -321,7 +322,8 @@ def create_matching_object_with_time_entries(factory, work_package_field, entry_
321322
# Off-mode negation runs on the primary-only (one-to-one) join, so the
322323
# default "is not" operator is already correct without the multi-version
323324
# NOT EXISTS override.
324-
it "negates on the primary target version while multiple versions is off" do
325+
it "negates on the primary target version while multiple versions is off",
326+
with_settings: { work_package_multiple_versions: false } do
325327
primary_version = create(:version, project:)
326328
secondary_version = create(:version, project:)
327329
work_package = create_work_package_with_time_entry(version: primary_version)
@@ -332,7 +334,8 @@ def create_matching_object_with_time_entries(factory, work_package_field, entry_
332334
expect(query.result.count).to eq(0)
333335
end
334336

335-
it "keeps a work package when negating a non-primary target version while off" do
337+
it "keeps a work package when negating a non-primary target version while off",
338+
with_settings: { work_package_multiple_versions: false } do
336339
primary_version = create(:version, project:)
337340
secondary_version = create(:version, project:)
338341
work_package = create_work_package_with_time_entry(version: primary_version)

modules/reporting/spec/models/cost_query/group_by_spec.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,16 @@
9797
expect(query.result.size).to eq(2)
9898
end
9999

100-
it "labels the group 'Version' while multiple versions is off" do
100+
it "labels the group 'Version' while multiple versions is off", with_settings: { work_package_multiple_versions: false } do
101101
expect(CostQuery::GroupBy::VersionId.label).to eq("Version")
102102
end
103103

104104
# While the feature is off a work package is single-version, so it is grouped
105105
# under its primary target version only (the lowest version id, i.e. what
106106
# target_versions.first returns) and the grouped total matches the ungrouped
107107
# entry count.
108-
it "computes group_by Version, listing a work package under its primary target version" do
108+
it "computes group_by Version, listing a work package under its primary target version",
109+
with_settings: { work_package_multiple_versions: false } do
109110
version1 = create(:version, project: project1)
110111
version2 = create(:version, project: project1)
111112
work_package = create(:work_package, project: project1, type:, version: version1)

spec/contracts/work_package_types/update_form_configuration_contract_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,8 @@ module WorkPackageTypes
237237
end
238238
end
239239

240-
context "when the multiple versions feature is inactive" do
240+
context "when the multiple versions feature is inactive",
241+
with_settings: { work_package_multiple_versions: false } do
241242
it "accepts the deprecated version" do
242243
model.attribute_groups = [["foo", ["version"]]]
243244

spec/contracts/work_packages/base_contract_spec.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1326,7 +1326,8 @@
13261326
work_package.target_version_ids_replacements = [assignable_version.id, other_assignable_version.id]
13271327
end
13281328

1329-
context "when the multiple-versions feature is disabled" do
1329+
context "when the multiple-versions feature is disabled",
1330+
with_settings: { work_package_multiple_versions: false } do
13301331
before { contract.validate }
13311332

13321333
it "rejects more than one target version" do

spec/controllers/work_package_types/form_configuration_tab_controller_rows_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
before do
3838
allow(User).to receive(:current).and_return(user)
39-
type.update_column(:attribute_groups, [[:details, %w[priority version]]])
39+
type.update_column(:attribute_groups, [[:details, %w[priority category]]])
4040
end
4141

4242
describe "PUT #drop", with_ee: %i[edit_attribute_groups] do
@@ -52,7 +52,7 @@
5252
it "moves the row into another active section at the requested position" do
5353
type.update_column(:attribute_groups, [
5454
[:details, %w[priority]],
55-
["Custom group", %w[version]]
55+
["Custom group", %w[category]]
5656
])
5757

5858
put :drop,
@@ -62,7 +62,7 @@
6262
expect(response).to have_http_status(:ok)
6363

6464
target_group = type.reload.attribute_groups.find { |group| group.key == "Custom group" }
65-
expect(target_group.members).to eq(%w[priority version])
65+
expect(target_group.members).to eq(%w[priority category])
6666
end
6767
end
6868
end

spec/features/types/form_configuration_spec.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030

3131
require "spec_helper"
3232

33-
RSpec.describe "form configuration", :js, :selenium do
33+
RSpec.describe "form configuration", :js, :selenium,
34+
with_settings: { work_package_multiple_versions: false } do
3435
shared_let(:admin) { create(:admin) }
3536
let(:type) { create(:type) }
3637

@@ -250,6 +251,25 @@ def persisted_attribute_order(type, group_key)
250251
loading_indicator_saveguard
251252
end
252253

254+
context "with multiple versions enabled",
255+
with_settings: { work_package_multiple_versions: true } do
256+
it "offers target versions in place of the deprecated version" do
257+
form.expect_group "details",
258+
"Details",
259+
{ key: :category, translation: "Category" },
260+
{ key: :date, translation: "Date" },
261+
{ key: :priority, translation: "Priority" },
262+
{ key: :target_versions, translation: "Target versions" }
263+
264+
form.drag_and_drop(form.find_attribute_handle(:target_versions), form.inactive_group)
265+
form.expect_inactive(:target_versions)
266+
267+
form.save_changes
268+
269+
expect(persisted_attribute_order(type, :details)).not_to include("target_versions")
270+
end
271+
end
272+
253273
context "with field format labels" do
254274
let!(:custom_field) { create(:issue_custom_field, :integer, name: "MyNumber") }
255275

spec/features/work_packages/details/inplace_editor/version_editor_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
login_as(user)
5858
end
5959

60-
it "renders hierarchical versions" do
60+
it "renders hierarchical versions", with_settings: { work_package_multiple_versions: false } do
6161
work_package_page.visit!
6262
work_package_page.ensure_page_loaded
6363

spec/features/work_packages/edit_on_assign_version_permission_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
require "spec_helper"
44
require "features/page_objects/notification"
55

6-
RSpec.describe "edit work package", :js do
6+
RSpec.describe "edit work package", :js, with_settings: { work_package_multiple_versions: false } do
77
let(:current_user) do
88
create(:user,
99
firstname: "Dev",

0 commit comments

Comments
 (0)