Skip to content

Bug: Object count + insights show same number across all tiers #75

@rubenvdlinde

Description

@rubenvdlinde

Observation

On the application detail page for Permit Flow (uuid `09f72a5f-b0f9-45e5-8120-b1030694ab50`), all three KPI cards on the version-pill row show identical numbers regardless of which version is selected:

Version (pill) URL Active users Object count Files Audit events
Production (no `?_version=`) 0 246 0 0
Development `?_version=development` 0 246 0 0
Staging (not retested but expected same)

The newly seeded development register `openbuilt-permit-flow-development` should be empty, so `object count: 246` is wrong.

Suspected root cause

`ApplicationInsightsController` / its underlying service probably ignores the `versionUuid` URL path segment and aggregates the whole `openbuilt` register (or the whole organisation) instead of the per-version register `openbuilt-permit-flow-{tier}`.

Need to:

  1. Trace `GET /api/applications/{appUuid}/versions/{versionUuid}/insights`
  2. Verify the underlying counter queries scope by the version's `register` field, not the global `openbuilt` register.
  3. Add a unit test that distinguishes per-tier counts.

Repro

  1. Wizard-create app with 3 tiers (development, staging, production).
  2. Open detail page.
  3. Switch between pills.
  4. KPIs should reflect each tier's register; instead all read 246.

Surfaced while verifying #74 (dev → staging → prod workflow).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions