Skip to content

fix(beacon): close the four gaps in the FM beacon frequency pool - #140

Merged
FullGas1 merged 5 commits into
developfrom
fix/beacon-fm-pool-gap
Aug 26, 2026
Merged

fix(beacon): close the four gaps in the FM beacon frequency pool#140
FullGas1 merged 5 commits into
developfrom
fix/beacon-fm-pool-gap

Conversation

@FullGas1

@FullGas1 FullGas1 commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Closes The FM beacon pool is missing a third of its band (36-39.9, 46-49.9, 56-59.9, 66-69.9 MHz) — deliberate? #127. _buildFreqPools's FM loop capped its tens digit at s=0..5 instead of 0..9, leaving four gaps (36.0–39.9, 46.0–49.9, 56.0–59.9, 66.0–69.9 MHz) unreachable, including ordinary frequencies like 38.00 MHz.
  • Confirmed inherited from legacy (migration/source/CTLD.lua, identical shape) and confirmed as an artefact rather than a deliberate exclusion — the legacy source carries a dead loop and a comment describing a never-implemented finer scheme right above the generator, unlike VHF's principled _ndbSkip list.
  • Widens s to 0..9 for f=3..6 only; f=7 keeps s=0..5 — widening it too would silently push the pool's top past the declared 75.9 MHz ceiling to 79.9 MHz, caught during implementation by the existing test cross-checking _bands' declared min/max against the actual pool. 300 → 460 total steps, continuous 30.0–75.9 MHz.
  • Updates the two tests that hard-coded the gap as expected behavior (fmMHz=38 refused) to a value still genuinely off-grid (38.05); adds a pool-size regression test and a "gap now closed" behavior test; updates the two doc rows (EN+FR) that documented the sub-ranges as real.
  • Grilled with the user 2026-08-26 (.backlog/FIX-BEACON-FM-POOL-GAP/PRD.md).

Test plan

  • TDD: new tests written red first (pool-size=460, gap-frequency-now-granted), confirmed failing against the old pool, then green after the fix.
  • Full suite: busted --pattern=_spec --helper=tests/ci/helpers/init.lua tests/ci → 1355 passed / 0 failed / 1 pending (pre-existing, DCS-live gated).
  • luac -p CTLD.lua — Lua 5.1 syntax OK (rebuilt via merge_CTLD.ps1).
  • luacheck not installed locally (per CLAUDE.md, relies on CI).

Summary by Sourcery

Restore the complete FM beacon frequency pool while preserving its declared 30.0–75.9 MHz bounds.

Bug Fixes:

  • Restore the missing FM beacon frequencies so the pool continuously covers 30.0–75.9 MHz at 0.1 MHz intervals, including previously unreachable frequencies such as 38.00 MHz.

Enhancements:

  • Update beacon behavior tests to cover the expanded pool and retain valid off-grid refusal cases.
  • Document the corrected FM frequency range and stepping in English and French API and subsystem references.

Documentation:

  • Correct the documented FM beacon frequency range in the English and French developer documentation.

Tests:

  • Add regression coverage for the exact 460-entry FM pool and successful allocation from a previously missing frequency.

Chores:

  • Record the FM beacon pool correction in the unreleased changelog and backlog documentation.

The FM beacon pool (_buildFreqPools) caps its tens digit at s=0..5
instead of 0..9, missing 160 of 460 possible steps (four gaps
including 38.00 MHz). Confirmed inherited from legacy (same shape in
migration/source/CTLD.lua) and confirmed as an artefact rather than a
deliberate exclusion (a dead loop + an unimplemented 4-digit scheme
comment sit right above the legacy generator). Grilled with the user
2026-08-26 following GitHub issue #127 (davidp57/Zip).
Single AFK ticket: widen s to 0..9, update the two tests that
hard-code the current gap as expected behavior, update the two doc
rows, add a pool-size regression test. Granularity confirmed with
the user - one cohesive slice.
_buildFreqPools capped the FM pool's tens digit at s=0..5 instead of
0..9, leaving four gaps (36.0-39.9, 46.0-49.9, 56.0-59.9, 66.0-69.9
MHz) unreachable, including ordinary frequencies like 38.00 MHz.
Confirmed inherited from legacy (migration/source/CTLD.lua, same
shape) and confirmed as an artefact rather than a deliberate
exclusion - the legacy source carries a dead loop and a comment
describing a never-implemented finer scheme right above the
generator, unlike VHF's principled _ndbSkip list.

Widens s to 0..9 for f=3..6 only, closing the four internal gaps.
f=7 keeps s=0..5 - widening it too would silently push the pool's
top past the declared 75.9 MHz ceiling to 79.9 MHz, caught during
implementation by the existing test that cross-checks _bands'
declared min/max against the actual pool. 300 -> 460 total steps,
continuous 30.0-75.9 MHz.

Updates the two tests that hard-coded the gap as expected behavior
(fmMHz=38 refused) to a value that's still genuinely off-grid
(38.05, off the 0.1 MHz step from t, not s); adds a pool-size
regression test and a "gap now closed" behavior test; updates the
two doc rows (EN+FR) that documented the sub-ranges as real.

FIX-BEACON-FM-POOL-GAP, grilled with the user 2026-08-26, closes
GitHub issue #127.
@FullGas1
FullGas1 requested a review from davidp57 as a code owner August 26, 2026 19:48
@sourcery-ai

sourcery-ai Bot commented Aug 26, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR fixes the FM beacon pool’s decade-loop boundary so it now provides all 460 100 kHz steps from 30.0 through 75.9 MHz, while preserving the declared maximum. Tests cover exact pool size, successful allocation from a formerly missing range, and continued rejection of off-grid values; English/French API docs, changelog, and backlog records are updated accordingly.

Flow diagram for FM beacon frequency pool generation

flowchart TD
    A[_buildFreqPools] --> B{f = 3..7}
    B --> C{f = 7?}
    C -- Yes --> D[s = 0..5]
    C -- No --> E[s = 0..9]
    D --> F[t = 0..9]
    E --> F
    F --> G[FM pool: 460 steps from 30.0 to 75.9 MHz]
Loading

File-Level Changes

Change Details Files
Expand the FM beacon frequency pool to cover the full declared range without changing its endpoints or 0.1 MHz granularity.
  • Use s=0..9 for leading digits 3–6 and retain s=0..5 for 7 to preserve the 75.9 MHz maximum.
  • Update the generator comment to document the intentional boundary behavior.
src/CTLD_beacon.lua
Add regression coverage for pool density and successful allocation from a previously unreachable FM gap.
  • Assert the pool contains exactly 460 entries.
  • Verify 38.00 MHz is granted and assigned correctly.
  • Replace gap-dependent refusal cases with off-grid 38.05 MHz cases.
tests/ci/unit/beacon_spec.lua
tests/ci/unit/beacon_scripted_api_spec.lua
Align user-facing and project documentation with the continuous FM frequency range.
  • Document FM as 0.1 MHz steps across 30–75.9 MHz in English and French.
  • Record the behavior fix and restored 300-to-460-step coverage in the changelog.
  • Add the completed fix rationale and implementation acceptance details to backlog documentation.
docs/developer/api-reference.md
docs/developer/api-reference.fr.md
CHANGELOG.md
.backlog/FIX-BEACON-FM-POOL-GAP/PRD.md
.backlog/FIX-BEACON-FM-POOL-GAP/tickets/01-widen-fm-pool.md
.backlog/README.md

Assessment against linked issues

Issue Objective Addressed Explanation
#127 Expand the FM beacon frequency pool to include every 100 kHz step from 30.0 to 75.9 MHz, eliminating the gaps at 36–39.9, 46–49.9, 56–59.9, and 66–69.9 MHz while preserving the declared upper limit.
#127 Ensure previously unreachable frequencies such as 38.00 MHz can be requested successfully, while retaining rejection of frequencies that are genuinely off the 100 kHz FM grid.
#127 Update documentation and regression tests to reflect the continuous FM range and prevent the gaps from being reintroduced.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot 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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".backlog/README.md" line_range="17" />
<code_context>
+| [`FIX-BEACON-FM-POOL-GAP`](FIX-BEACON-FM-POOL-GAP/PRD.md) | ⬜ ready | Reported by **Zip** ([GitHub issue #127](https://github.com/VEAF/CTLD/issues/127)): the FM beacon pool (`_buildFreqPools`) caps its tens digit at `s=0..5` instead of `0..9`, missing 160 of 460 possible 100 kHz steps (four gaps: 36.0–39.9, 46.0–49.9, 56.0–59.9, 66.0–69.9 MHz), including ordinary frequencies like 38.00 MHz. Confirmed inherited from legacy (`migration/source/CTLD.lua:6171`, same `s=0..5` shape) — fixing it is a legacy-parity deviation, which the issue explicitly requests. Confirmed as an artefact, not a deliberate exclusion: the legacy source carries a comment describing a never-implemented 4-digit/0.05 MHz scheme, and a dead loop right above the FM generator that reads as an uncleaned UHF-generator copy-paste. Minimal fix: widen `s` to `0..9`, closing the gaps at the existing 0.1 MHz granularity — the finer 0.05 MHz grid the dead comment gestures at is explicitly out of scope. | `fix/beacon-fm-pool-gap` |
</code_context>
<issue_to_address>
**nitpick:** The backlog index labels `FIX-BEACON-FM-POOL-GAP` as `⬜ ready` even though its added PRD and ticket both declare the work `✅ done`, so the repository's backlog dashboard reports the wrong status.

**Suggested fix:** Change the README row status to match the completed PRD/ticket state, or leave the index at `ready` only while the ticket is actually pending.

```suggestion
| [`FIX-BEACON-FM-POOL-GAP`](FIX-BEACON-FM-POOL-GAP/PRD.md) | ✅ done | Reported by **Zip** ([GitHub issue #127](https://github.com/VEAF/CTLD/issues/127)): the FM beacon pool (`_buildFreqPools`) caps its tens digit at `s=0..5` instead of `0..9`, missing 160 of 460 possible 100 kHz steps (four gaps: 36.0–39.9, 46.0–49.9, 56.0–59.9, 66.0–69.9 MHz), including ordinary frequencies like 38.00 MHz. Confirmed inherited from legacy (`migration/source/CTLD.lua:6171`, same `s=0..5` shape) — fixing it is a legacy-parity deviation, which the issue explicitly requests. Confirmed as an artefact, not a deliberate exclusion: the legacy source carries a comment describing a never-implemented 4-digit/0.05 MHz scheme, and a dead loop right above the FM generator that reads as an uncleaned UHF-generator copy-paste. Minimal fix: widen `s` to `0..9`, closing the gaps at the existing 0.1 MHz granularity — the finer 0.05 MHz grid the dead comment gestures at is explicitly out of scope. | `fix/beacon-fm-pool-gap` |
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .backlog/README.md Outdated
docs/developer/subsystems/beacons.md/.fr.md still described the
pre-fix s=0..5 shape for every f, a review finding on PR #140 that
the api-reference.md/.fr.md update missed - this is the same
formula restated in more detail in a second file.
@FullGas1
FullGas1 merged commit 6dfb911 into develop Aug 26, 2026
9 checks passed
@FullGas1
FullGas1 deleted the fix/beacon-fm-pool-gap branch August 26, 2026 19:54
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.

The FM beacon pool is missing a third of its band (36-39.9, 46-49.9, 56-59.9, 66-69.9 MHz) — deliberate?

1 participant