Skip to content

docs: give geolocation its own section, and drop the dead GEO_TIMEOUT_SECONDS - #653

Merged
NotYuSheng merged 1 commit into
mainfrom
fix/wire-geoip-env-vars
Aug 11, 2026
Merged

NotYuSheng merged 1 commit into
mainfrom
fix/wire-geoip-env-vars

Conversation

@NotYuSheng

@NotYuSheng NotYuSheng commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Closes #652

Rebased after #645 landed. That PR wired every backend env var into the container — including GEO_ENRICHMENT_ENABLED and GEO_MMDB_PATH — and added a CI guard (scripts/check_env_passthrough.py) so the class of bug cannot recur. That was the larger half of #652, so the wiring commit here is dropped. What remains:

Summary

  • Removed GEO_TIMEOUT_SECONDS / tracepcap.geo.timeout-seconds. No Java reads it — GeoIpService uses hardcoded CONNECT_TIMEOUT_MS/READ_TIMEOUT_MS constants — so fix: pass every backend environment variable into the container (#641) #645 faithfully passed through a knob that does nothing. Dropped from application.yml and the two compose files that wired it, rather than leaving an advertised setting with no effect.
  • Added a Geolocation section to the env-vars page. GEO_MMDB_PATH appeared nowhere on it, and the section spells out the distinction the one-line toggle entry could not: GEO_ENRICHMENT_ENABLED=false kills geolocation including the local MMDB, while GEO_FORCE_OFFLINE=true only suppresses the ipinfo.io egress — the latter is what an air-gapped deployment wants.
  • Documented both variables in .env.example, which covered neither.
  • Corrected two claims that the code contradicts:
    • Turning enrichment off is not retroactive. GeoOrgLookupAdapter and the ip_geo_cache join in SubnetLabelSuggestionService.java:226 read the cache directly without consulting tracepcap.geo.enabled, so geo resolved earlier still surfaces. fix: pass every backend environment variable into the container (#641) #645's "no geo fields on hosts" is corrected to match.
    • GEO_MMDB_PATH only falls back to the bundled database when the path does not exist. GeoIpService.java:341-345 returns openFile(f) the moment f.exists(), so a corrupt file or an unreadable bind mount yields null and leaves no offline database at all.

No behaviour change to defaults.

Test plan

  • docker compose config clean on all four stacks; GEO_ENRICHMENT_ENABLED, GEO_MMDB_PATH and the right GEO_FORCE_OFFLINE split still reach the backend, with no GEO_TIMEOUT_SECONDS
  • python3 scripts/check_env_passthrough.py passes — nothing the backend reads went unreachable
  • Sphinx builds with no new warnings; the Geolocation_ references resolve and the duplicate toggle row is gone
  • No reference to GEO_TIMEOUT_SECONDS remains anywhere in the repo

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@NotYuSheng, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f1b59878-d686-459d-a0c9-5f735d37b5a3

📥 Commits

Reviewing files that changed from the base of the PR and between c1aa23f and 39df8b0.

📒 Files selected for processing (5)
  • .env.example
  • backend/src/main/resources/application.yml
  • docker-compose.offline.yml
  • docker-compose.yml
  • docs/configuration/environment-variables.rst

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

NotYuSheng added a commit that referenced this pull request Aug 11, 2026
Review of #653 caught both.

GEO_ENRICHMENT_ENABLED=false was described as leaving country/city/ASN empty
outright. It only stops new lookups: GeoOrgLookupAdapter and the ip_geo_cache
join in SubnetLabelSuggestionService read the cache directly without consulting
tracepcap.geo.enabled, so geo resolved before the switch was flipped still
surfaces. Say so, and point at the cache table.

GEO_MMDB_PATH's fallback was described unconditionally. tryOpenMmdb only falls
back when the file does not exist — an existing but unopenable file (corrupt,
or an unreadable bind mount) returns null from openFile and leaves no offline
database at all. Distinguish the two cases and name the log line to check.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…_SECONDS

#645 wired the GeoIP variables into the backend container, which was the larger
half of #652. Two things it left behind:

GEO_TIMEOUT_SECONDS is dead. No Java reads tracepcap.geo.timeout-seconds —
GeoIpService uses hardcoded CONNECT_TIMEOUT_MS/READ_TIMEOUT_MS constants — so
#645 faithfully passed through a knob that does nothing. Remove the property and
the two compose lines rather than leave an advertised setting with no effect.

The env-vars page still had no geolocation section: GEO_MMDB_PATH appeared
nowhere on it, and nothing in .env.example covered either variable. Add the
section, and document both there.

It spells out the distinction the two switches blur, which the one-line toggle
entry could not: GEO_ENRICHMENT_ENABLED=false kills geolocation including the
local MMDB, while GEO_FORCE_OFFLINE=true only suppresses the ipinfo.io egress —
the latter is what an air-gapped deployment wants, since the MMDB lookup never
touches the network.

Two caveats worth stating because the code contradicts the obvious reading:

  * Turning enrichment off is not retroactive. GeoOrgLookupAdapter and the
    ip_geo_cache join in SubnetLabelSuggestionService read the cache directly
    without consulting tracepcap.geo.enabled, so geo resolved earlier still
    surfaces. The toggle row's "no geo fields on hosts" is corrected to match.
  * GEO_MMDB_PATH only falls back to the bundled database when the path does
    not exist. tryOpenMmdb returns openFile(f) the moment f.exists(), so a
    corrupt file or an unreadable bind mount yields null and leaves the
    deployment with no offline database at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@NotYuSheng
NotYuSheng force-pushed the fix/wire-geoip-env-vars branch from 2d01beb to 39df8b0 Compare August 11, 2026 07:18
@NotYuSheng NotYuSheng changed the title fix: wire the GeoIP env vars into the backend container and document them docs: give geolocation its own section, and drop the dead GEO_TIMEOUT_SECONDS Aug 11, 2026
@NotYuSheng
NotYuSheng merged commit 805c9cf into main Aug 11, 2026
8 checks passed
@NotYuSheng
NotYuSheng deleted the fix/wire-geoip-env-vars branch August 11, 2026 07:22
NotYuSheng added a commit that referenced this pull request Aug 12, 2026
…656)

* fix: make the env guard catch dead knobs, not just unreachable ones

The guard checked one direction — variables the backend reads that no compose
file passes — and was blind to the inverse: a variable compose passes that no
Spring config reads. That one looks configurable in .env and does nothing.

Which is exactly what I shipped. #645 wired GEO_TIMEOUT_SECONDS into both
compose files because application.yml referenced it, without checking whether
anything consumed it. Nothing did — GeoIpService uses hardcoded timeout
constants — so the knob was inert from the moment it was added, and CI passed.
#653 removed the dead property and the compose lines with it.

A check written after this failure mode bit twice should not have been able to
introduce a third instance of it. Now reports both directions separately, with
the fix for each.

The allowance for variables consumed outside Spring is an explicit two-entry
list (APP_MEMORY_MB, TZ) rather than prefix matching. A pattern like LLM_* or
MINIO_* would be less maintenance but would hide a genuinely dead knob in the
same family — the precise thing this half of the check exists to find.

Verified in both directions: injecting a knob nothing reads fails the check, and
removing SURICATA_ENABLED from compose fails it too. Passes clean on main.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix/use-extend-for-filtered-diagnostics

PERF401 from review on #656. Both filtered append loops become extend over a
generator, which also gave each branch a one-line comment saying what it detects
— the two halves of this check are easy to confuse when skimming.

Adopted the intent rather than the suggested diff: the proposal rewrote the
second loop as dead.extend([(stack, var)]) still inside the for, which is a
single-element extend per iteration and strictly worse than the append it
replaces.

Note there is no Ruff config or Python lint in CI, so this is a readability
change rather than a gate. Behaviour verified unchanged in both directions —
injected dead knob still fails, removed SURICATA_ENABLED still fails, clean tree
still passes.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
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.

GeoIP env vars are silently ignored under Docker Compose, and undocumented

1 participant