Skip to content

[COMMS-1022]: Journal work package labels - #25320

Draft
akabiru wants to merge 1 commit into
devfrom
implementation/comms-1022-labels-journaling
Draft

akabiru wants to merge 1 commit into
devfrom
implementation/comms-1022-labels-journaling

Conversation

@akabiru

@akabiru akabiru commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

https://community.openproject.org/wp/79963

Each journal now snapshots the work package's label set, so the activity tab renders label changes ("Labels: a, b") and baseline comparison loads the historic set for a timestamp. The snapshot table keeps no foreign key to labels so history survives a hard delete, the same shape versions use. The versions formatter base becomes a generic JoinedAssociation shared by target versions, observed-in versions and labels. Exposing the historic labels through the API waits for the labels property in the API PR.

@akabiru
akabiru added this pull request to stack #25321 September 14, 2026 18:12
@akabiru akabiru changed the title Journal work package labels Feature/COMMS-1022: Journal work package labels Sep 14, 2026
@akabiru akabiru self-assigned this Sep 14, 2026
@akabiru
akabiru force-pushed the implementation/comms-1022-labels-journaling branch from c5c66f6 to 4b766c9 Compare September 14, 2026 18:49
Base automatically changed from implementation/comms-1001-labels-data-model to dev September 16, 2026 12:59
Snapshots the label set per journal so the activity tab renders label
changes and baseline comparison loads historic labels. Snapshot rows
keep no foreign key to labels so history survives a hard delete.

https://community.openproject.org/wp/79963
@akabiru
akabiru force-pushed the implementation/comms-1022-labels-journaling branch from 4b766c9 to d2db840 Compare September 16, 2026 12:59
@github-actions

Copy link
Copy Markdown

Warning

Flaky specs

  • rspec ./modules/wikis/spec/features/admin/internal_provider_spec.rb[1:1]
  • rspec ./spec/features/work_packages/new/attributes_from_filter_spec.rb[1:3: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 #25320, linked for reference only):

- `rspec ./modules/wikis/spec/features/admin/internal_provider_spec.rb[1:1]`
- `rspec ./spec/features/work_packages/new/attributes_from_filter_spec.rb[1:3:1]`

Treat this as a standalone task, unrelated to PR #25320. Create a new branch from origin/dev and open a new pull request targeting dev — do not stack it on PR #25320 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 removed this pull request from stack #25321 September 16, 2026 14:13
@akabiru akabiru changed the title Feature/COMMS-1022: Journal work package labels [COMMS-1022]: Journal work package labels Sep 16, 2026
@akabiru

akabiru commented Sep 16, 2026

Copy link
Copy Markdown
Member Author

Note for the admin side of labels (COMMS-1025 / COMMS-1026, PR 2 of the labels stack): deleting a label from Administration → Labels removes its labelings rows directly through Labels::DeleteService and does not create a journal on the affected work packages.

Consequences for this PR's model:

  • label_journals keeps the deleted label's id (no FK, as intended here), so existing history still renders.
  • The removal only becomes visible in each work package's next journal, attributed to whoever edits it next, as "Label X removed".
  • No updated_at bump, no notification at deletion time.

That is acceptable for the first iteration; the epic's journaling wording ("Label {name} removed by {author}") assumes a per-work-package change, and an admin delete is a bulk operation. If a dedicated entry at deletion time turns out to be wanted, the way to do it is a background job iterating the affected work package ids and calling Journals::CreateService with a cause such as label_deleted, which can build on this PR without schema changes.

Flagging it here so the two PRs stay consistent; nothing to change in this one.

@akabiru

akabiru commented Sep 17, 2026

Copy link
Copy Markdown
Member Author

Follow-up to the note above, after checking the epic text: admin deletion of a label (COMMS-1026, #25394) is allowed while work packages still carry it and cascades to the labelings. The epic only defines work-package-level entries ("Label {name} added / removed by {author}") and is silent on admin deletion, so #25394 ships without journaling it.

Decided to handle the journaling side here rather than in the admin PR. Two things this model needs to be able to show a deletion in history: a journal on each affected work package at deletion time (a job with the admin as author and a dedicated cause), and the label name surviving the delete, either as a snapshot column on label_journals or by soft-deleting labels. Without the second, the formatter can only render a placeholder for the removed label.

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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant