Skip to content

audit: validator _ALIASES consistency after PR #16 power_validator fix #19

Open

Description

@root3315

Context

PR #16 (Matt Van Horn, issue #14) discovered that configurator/validators/power_validator.py was missing the _ALIASES table that both mass_validator.py and volume_validator.py had. As a result, validate_power("cubesat_3u", …) silently dropped to 0 solar panels and broke the generation calculation, while validate_power("3U", …) worked. PR #16 added the missing alias table.

Two lessons from this incident:

  1. The three validator modules are supposed to implement the same contract but drifted. No test caught it until someone migrated the tests from legacy to canonical keys.
  2. Other similar drift points may still exist across the codebase — wherever a dict or table keys off form-factor strings without going through the core.form_factors registry.

Proposal

Do a focused consistency audit:

  1. grep the codebase for every place that uses form-factor strings as dict keys ("1U", "3U", "cansat_standard", etc.) outside core.form_factors and configurator.validators.*._ALIASES.
  2. For each, verify that either:
    • It goes through core.form_factors.get_form_factor() (single source of truth), or
    • It has its own _ALIASES table covering all registered keys + legacy aliases.
  3. Add a meta-test under configurator/tests/ that iterates FORM_FACTOR_LIMITS.keys() and FORM_FACTOR_VOLUMES.keys() and power_validator panel counts, asserts these three sets are identical — so if a future form factor is added to one validator and not another, tests fail immediately.

Candidate hotspots to check

  • configurator/generators/*.py — any hardcoded form-factor lists?
  • configurator/configurator_app.py lines 16–50 (PLATFORM_OPTIONS) — synced with registry?
  • ground-station/utils/profile_gate.py — gate logic by form factor
  • flight-software/core/feature_flags.py — feature-gate tables
  • hardware/bom/by_form_factor/*.csv — cross-check against registry keys

Definition of done

  • Written audit report (brief, ~1 page) under docs/project/FORM_FACTOR_AUDIT.md listing every location that keys off form-factor strings and its status (passes through registry / has own alias table / needs fix).
  • For any drift found, a follow-up PR or issue opened.
  • A meta-test test_validator_alias_tables_are_synchronised added to configurator/tests/test_validators.py.

Helps turn a one-off PR fix into a structural guarantee.

Activity

  1. added
    testingTests, CI, verification
    choreRefactoring, audits, quality maintenance
    on Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    choreRefactoring, audits, quality maintenancetestingTests, CI, verification

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions