Skip to content

fix(config): route legacy dev ingresses (*.dev.intern.nav.no) to the dev collector - #31

Merged
Starefossen merged 1 commit into
mainfrom
fix/legacy-dev-ingress-collector
Aug 5, 2026
Merged

fix(config): route legacy dev ingresses (*.dev.intern.nav.no) to the dev collector#31
Starefossen merged 1 commit into
mainfrom
fix/legacy-dev-ingress-collector

Conversation

@Starefossen

Copy link
Copy Markdown
Member

Problem (reported by k9saksbehandling)

Two apps with identical init() calls routed to different collectors:

  • ung.intern.dev.nav.no (modern dev ingress) → dev collector ✅
  • k9.dev.intern.nav.no (legacy dev-fss ingress) → prod collector ❌

The interim hostname fallback (ADR-0001 decision 7) recognized dev only via the .dev.nav.no suffix. The legacy pattern puts the dev label before intern, so it missed the dev branch and fell through to the .nav.no catch-all — sending dev telemetry to the prod collector.

Fix

A literal dev DNS label anywhere in a nav.no hostname now routes to the dev collector. By nav domain conventions a bare dev label always marks a dev-cluster ingress, wherever the zone puts it (dev.nav.no, *.intern.dev.nav.no, *.dev.intern.nav.no, …). The label must match exactly — devtools.intern.nav.no stays prod. Non-nav hosts still derive nothing.

Tests

New unit block for navTenant.telemetryUrlFromHostname covering modern + legacy dev patterns (including the reported k9.dev.intern.nav.no), prod hosts, the partial-label case, and non-nav hosts. 218 tests passing.

Note: the hostname derivation remains INTERIM — the platform channels (meta tags / generatedConfig / env) always win, and teams on legacy ingress can already get correct routing today by serving <meta name="nais-cluster"> or the generated config.

…dev collector

The interim hostname fallback matched dev only on the .dev.nav.no
suffix, so the modern ingress pattern (ung.intern.dev.nav.no) routed
correctly while the legacy dev-fss pattern (k9.dev.intern.nav.no —
dev label before intern) fell through to the .nav.no catch-all and
sent DEV telemetry to the PROD collector (reported by
k9saksbehandling, who ran both patterns side by side).

The derivation now treats a literal dev DNS label anywhere in a
nav.no hostname as a dev-cluster ingress: by nav domain conventions
the bare label dev always marks a dev environment, wherever the zone
puts it. The label must match exactly — devtools.intern.nav.no stays
prod.
Copilot AI lite review requested due to automatic review settings August 5, 2026 09:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes NAV tenant collector derivation so legacy dev ingresses under *.dev.intern.nav.no route to the dev telemetry collector instead of incorrectly falling through to the prod collector.

Changes:

  • Update navTenant.telemetryUrlFromHostname to only derive for nav.no hostnames and treat a literal dev DNS label anywhere in the hostname as a dev-cluster signal.
  • Add unit tests covering modern dev patterns, the reported legacy pattern, prod routing, partial-label safety (devtools), and non-nav hostnames.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/config.ts Adjusts NAV hostname-based collector derivation to detect a dev label anywhere within *.nav.no.
src/config.test.ts Adds targeted unit tests for modern/legacy dev hostnames and validates prod/non-nav behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Starefossen
Starefossen added this pull request to the merge queue Aug 5, 2026
Merged via the queue into main with commit 4af9c69 Aug 5, 2026
7 checks passed
@Starefossen
Starefossen deleted the fix/legacy-dev-ingress-collector branch August 5, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants