Skip to content

fix: avoid duplicate custom variable filters in cube links (#166) - #178

Open
DanielVdWP wants to merge 9 commits into
Icinga:mainfrom
DanielVdWP:fix/166-avoid-duplicate-custom-var-filters
Open

DanielVdWP wants to merge 9 commits into
Icinga:mainfrom
DanielVdWP:fix/166-avoid-duplicate-custom-var-filters

Conversation

@DanielVdWP

Copy link
Copy Markdown

Description

Fixes #166.

When a custom variable is used both as a cube filter and as a
dimension, the generated detail URL may contain the same filter
condition twice.

This can cause incorrect results when navigating from a cube
to the corresponding host or service status view.

The issue affects both cube detail links and the actions used
to display matching hosts and services.

Changes

  • Prevent duplicate equality conditions when generating cube
    detail URLs.
  • Avoid adding redundant filters to host and service status
    action links.
  • Preserve existing filters and dimension selections.
  • Handle nested AND filters without incorrectly removing
    conditions inside OR expressions.
  • Add automated regression tests covering host and service
    navigation.

Testing

Bug reproduction

The original implementation was tested using GitHub Actions
with PHP 8.3 and PHP 8.4.

Both environments reproduced the duplicate filter issue.

https://github.com/DanielVdWP/icingaweb2-module-cube/actions/runs/35562754291

Fix validation

After applying the fix, the regression tests passed on both
PHP versions.

The tests cover:

  • Host and service detail URLs.
  • Host and service status action links.
  • Duplicate custom variable filters.
  • Preservation of independent filter conditions.
  • Nested AND filters and OR expressions.
  • Preservation of distinct dimension selections.

The regression tests exercise the production URL-building code
with lightweight doubles for external dependencies.

The project's upstream PHP checks were also executed,
including linting, PHPUnit and PHPStan.

All 8 CI jobs completed successfully.

https://github.com/DanielVdWP/icingaweb2-module-cube/actions/runs/35562919130

Full end-to-end testing with a running Icinga Web 2 installation
has not been performed.

@cla-bot cla-bot Bot added the cla/signed label Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Filter with custom vars creates wrong filter url

1 participant