Skip to content

Translate MLAT_MARKER to MLAT_PRIVATE on save (co-emit, preserve marker)#5

Merged
d4rken merged 1 commit into
devfrom
feat/mlat-marker-retire
May 11, 2026
Merged

Translate MLAT_MARKER to MLAT_PRIVATE on save (co-emit, preserve marker)#5
d4rken merged 1 commit into
devfrom
feat/mlat-marker-retire

Conversation

@d4rken
Copy link
Copy Markdown
Member

@d4rken d4rken commented May 11, 2026

PHP webconfig's still-shipping yes/no dropdown writes MLAT_MARKER to airplanes-config.txt with inverted polarity (no=privacy on). The new feed daemons read MLAT_PRIVATE instead. Without translation at save time, toggling privacy in webconfig would silently no-op on already-updated feeders. This adds a second migration step that emits MLAT_PRIVATE alongside every MLAT_MARKER it sees.

MLAT_MARKER is preserved on disk, not stripped, because PHP rebuilds the config from $_POST only and only knows about MLAT_MARKER; stripping it would cause the next PHP save to lose both keys. The migration re-derives MLAT_PRIVATE on every save (MLAT_MARKER wins on conflict), mirroring the USER to MLAT_USER re-derivation already in this migrator. Value parsing is case-insensitive; unrecognized MLAT_MARKER values exit 2 rather than silently defaulting to public.

Two structural changes ride along. First, do_migrate is refactored into a chain of single-purpose migration functions so a third migration is a function-add. Second, an AIRPLANES_CONFIG_BACKUP_BASE env var lets install-adsbconfig.sh redirect .pre-X-split backups at the canonical boot config path even when the migrator runs against a random temp file; previously each save orphaned one backup per migration under the temp suffix.

PHP webconfig's still-shipping yes/no dropdown writes MLAT_MARKER (inverted polarity, no=privacy on). The new feed daemons read MLAT_PRIVATE instead. Without translation at save time, toggling privacy in webconfig would silently no-op on already-updated feeders.

MLAT_MARKER is preserved on disk because PHP rebuilds the config from POST only and only knows about MLAT_MARKER. Stripping it would cause the next PHP save to drop both keys. MLAT_PRIVATE is co-emitted on the line after MLAT_MARKER, re-derived on every save, mirroring the USER -> MLAT_USER re-derivation already in this migrator. MLAT_MARKER wins when both keys are present; stale MLAT_PRIVATE is overwritten.

Value parsing is case-insensitive. Unrecognized MLAT_MARKER values exit 2 rather than silently defaulting to public; for a privacy key, fail-loud beats fail-open.

Refactors do_migrate into a chain of single-purpose migration functions. Adds AIRPLANES_CONFIG_BACKUP_BASE env var: install-adsbconfig.sh sets it to the canonical boot config path so .pre-X-split backups land there even when the migrator runs against a random temp file (previously orphaned one backup per save under random temp suffixes). 26 test cases including a two-save PHP round-trip verifying privacy survives PHP's rebuild-from-POST.
@d4rken d4rken force-pushed the feat/mlat-marker-retire branch from bb93dae to 5c89a6f Compare May 11, 2026 13:06
d4rken added a commit to airplanes-live/airplanes-update that referenced this pull request May 11, 2026
Picks up the chain refactor, MLAT_MARKER to MLAT_PRIVATE co-emit, and AIRPLANES_CONFIG_BACKUP_BASE support from airplanes-live/airplanes-webconfig#5. Drift CI will fail until that PR lands on dev.
@d4rken d4rken changed the title Retire MLAT_MARKER; translate to canonical MLAT_PRIVATE on save Translate MLAT_MARKER to MLAT_PRIVATE on save (co-emit, preserve marker) May 11, 2026
@d4rken d4rken merged commit 0c65be3 into dev May 11, 2026
1 check passed
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.

1 participant