# Bug COMMS-997 - "Only changes" work packages activity filter hides target and observed-in version changes

Project: Stream Communicator
Status: closed
URL: https://community.openproject.org/work_packages/COMMS-997

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module | Modules and project features / Comments and activity |
| Target versions | 17.9.0 |
| Observed in versions | 17.8.0 |
| Sprint | Sprint 14 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 17.8.x |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Kabiru Mwenja |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  Log in as a user with the "Assign versions" permission in a project that has at least two versions.

2.  Open a work package that already has at least one journal entry besides its creation (for example, edit the subject once).

3.  Change only the "Target versions" attribute (or only the "Observed in versions" attribute, once the type's form configuration includes it) and save.

4.  Open the Activity tab and confirm the new journal entry with the version change is listed.

5.  In the activity filter dropdown, switch from "Show all" to "Only changes".

### What is the buggy behavior?

  - The journal entry that contains only the version change disappears from the activity feed.

  - The entry is still listed under "Show all" and renders the "Target versions" / "Observed in versions" detail line correctly, so the data is journaled. Only the filter is wrong.

  - Both version kinds are affected: journals whose only change is in `target_versions` and journals whose only change is in `observed_in_versions`.

> Cause: `WorkPackages::ActivitiesTab::Paginator::JournalChangesFilter#changes_condition_sql` decides whether a journal "has changes" by comparing the predecessor against the current journal across `work_package_journals` columns, attachment journals, custom field journals, and file link journals. Version snapshots live in the `work_package_version_journals` side table (introduced with the target versions journaling in PR <mention class="mention" data-id="24146" data-type="work_package" data-text="#24146">#24146</mention> and extended to observed-in versions in PR <mention class="mention" data-id="25035" data-type="work_package" data-text="#25035">#25035</mention>), and that table is not part of the condition. A journal whose only difference from its predecessor is in that table therefore fails the "has changes" test and is filtered out.

### What is the expected behavior?

1.  With "Only changes" active, a journal entry whose only change is an added or removed target version or observed-in version stays visible.

2.  The filter treats version snapshot changes the same way it treats attachment, custom field, and file link changes: an addition or removal of a `(version_id, kind)` row between the predecessor and current journal counts as a change.

3.  Journals with a comment plus a version change keep behaving as they do today (visible under all filter modes).

> Implementation note: `association_changes_condition_sql` already handles the side-table pattern. Adding one more `EXISTS` clause for `Journal::WorkPackageVersionJournal.table_name` with `join_columns: %w[version_id kind]` and no value columns should be sufficient, plus a spec in `spec/services/work_packages/activities_tab/paginator_spec.rb` covering a target-only and an observed-in-only journal under the `:only_changes` filter.

### 

### Related

  - Target versions journaling: <https://github.com/opf/openproject/pull/24146> (<mention class="mention" data-id="COMMS-852" data-type="work_package" data-text="#COMMS-852">#COMMS-852</mention>)

  - Observed-in versions journaling: <https://github.com/opf/openproject/pull/25035> (<mention class="mention" data-id="COMMS-966" data-type="work_package" data-text="#COMMS-966">#COMMS-966</mention>)
