Repository navigation
Mutmut - #2278
Mutmut#2278
Conversation
Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Expand the two-module mutation pilot to 32 modules and improve test selection and assertions for observable behavior. - Cover parameter handling, vehicle components, firmware upload, bootloader communication, log analysis, AutoTune, and GUI workflows. - Align the seven do_not_mutate exclusions with .coveragerc omissions. - Include existing validation, schema, and constants tests previously missing from the mutation selection. - Load plugin fixtures explicitly and copy test helpers and resources required by the selected tests into Mutmut's generated tree. - Derive the CI clean baseline from pyproject.toml to keep test selection synchronized with mutation runs. - Increase CI job and mutation-step limits to 240 and 230 minutes, respectively, and summarize mutation outcomes by module. - Verify that diagnostics polling and banner reception use nonblocking MAVLink reads. - Add seven voltage-correction cases that verify the conflicting field and persisted correction exactly 0.01 V beyond its limit. - Add seven cases accepting equality at related voltage boundaries. - Add two cases verifying repeated required-MCU schema updates preserve field metadata without reporting errors. - Document selection audits, required resources, cache refreshes, and interpretation of mutation outcomes. Validation: - Completed the initial 32-module run across 24,697 mutants. - Final selected clean baseline: 2,137 tests passed. - Fresh validation/schema runs covered 2,422 mutants each. - Corrected selection increased kills from 588 to 1,406. - New regressions caught 36 additional survivors, yielding 1,442 killed, 722 surviving, and 258 without associated tests. - All 16 new regression cases passed normally and failed by assertion against their targeted mutations in isolated verification. - Pre-commit, targeted pylint, and git diff --check passed. Remaining unassociated validation mutants are in ESC telemetry helpers. GUI timeout and segfault classifications remain unresolved. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Add 37 behavior cases using the real component model and schema to verify ESC telemetry choices through public APIs. - Check compatible ports and mirror state for PWM, DShot, CAN and same-port serial protocols across all four vehicle types. - Distinguish scripting, ESC telemetry and mirrored serial protocols. - Verify safe fallbacks for empty, stale and incompatible selections. - Check CAN-to-PWM transitions and subsequent protocol changes for stale choices and duplicates. Validation: - All 2,174 selected tests pass. - Complete all 1,914 validation mutants: 1,337 killed, 577 surviving, zero without tests, zero timeouts and zero segfaults. - Catch 331 additional mutants and associate tests with all six previously uncovered ESC telemetry helpers. - Confirm assertion failures for a representative mutation in each helper. - Pre-commit, targeted pylint and git diff --check pass. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Add 32 behavior cases using the real component model and schema to verify choices presented by the component editor. - Check complete initial connection-port lists and full protocol labels when metadata and saved connections are absent. - Select FRAME_CLASS or Q_FRAME_CLASS according to vehicle type. - Preserve Heli and Rover frame fallbacks when metadata is unusable, and retain Plane's valid Undefined-only frame choice. - Apply loaded MOT_PWM_TYPE and Q_M_PWM_TYPE choices, preferring the QuadPlane parameter when both are available. - Keep offline PWM choices when motor metadata is missing or empty. - Support receiver enum and bitmask metadata, with nonempty enum values taking priority, and verify battery-monitor labels. - Replace stale motor-protocol choices when metadata is reloaded. Validation: - All 191 validation-file tests and 2,206 selected tests pass. - Complete all 1,914 validation mutants: 1,420 killed, 494 surviving, zero without tests, zero timeouts and zero segfaults. - Catch 83 additional initialization mutants, reducing that function's survivors from 224 to 141 while preserving every previous kill. - Verify assertion failures for seven representative mutations using the new cases alone. - Pre-commit, targeted pylint and git diff --check pass. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Add 23 behavior cases that load persisted component data through the real model initialization workflow without calling connection setters. - Rebuild receiver, telemetry, GNSS and battery-monitor protocol choices from saved connection types while preserving their stored settings. - Cover disabled connections and analog, I2C, CAN, PWM, SPI and virtual battery-monitor configurations. - Verify complete initial battery-monitor and ESC selectors, excluding internal mirror markers and duplicate telemetry protocols. - Rebuild saved PWM, DShot, CAN and same-port serial ESC telemetry choices, including explicitly disabled telemetry. - Verify legacy ESC connection migration retains control settings and initializes disabled telemetry with compatible port choices. Validation: - All 214 validation-file tests and 2,229 selected tests pass. - Complete all 1,914 validation mutants: 1,556 killed, 358 surviving, zero without tests, zero timeouts and zero segfaults. - Catch 136 additional mutants while preserving every previous kill. - Reduce initialization survivors from 141 to 29 and catch additional ESC telemetry, battery-monitor and GNSS filtering mutations. - Verify assertion failures for nine representative startup mutations using the new cases alone. - Pre-commit, targeted pylint and git diff --check pass. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Add 22 behavior cases using real component models and public APIs to verify cross-component validation without mocks or private-state edits. - Reject GNSS serial-port conflicts with RC receivers, telemetry, ESC control and ESC telemetry in either field order. - Accept RC/telemetry and bidirectional ESC serial sharing while still reporting later independent port conflicts and motor-pole errors. - Accept shared CAN1/CAN2 buses and multiple disabled peripherals. - Check invalid selections report the rejected value, full field path and allowed choices before continuing through the remaining fields. - Validate CAN2/DroneCAN type and protocol selections together without treating repeated protocol names as exclusive physical ports. - Assert complete error lists so early exits cannot hide later errors. Validation: - All 236 validation-file tests and 2,251 selected tests pass. - Complete all 1,914 validation mutants: 1,593 killed, 321 surviving, zero without tests, zero timeouts and zero segfaults. - Catch 37 additional mutants while preserving every previous kill. - Reduce validate_all_data survivors from 43 to 10, with additional kills in motor-pole validation and numeric error propagation. - Verify assertion failures for 12 representative prior survivors using the new cases alone, with zero setup errors. - Ruff, targeted pylint, pre-commit and git diff --check pass. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Add 27 behavior cases using real component models and public APIs to check telemetry selectors immediately after each control-port change. - Preserve DroneCAN telemetry while moving ESCs between CAN1 and CAN2. - Move bidirectional serial ESCs to SERIAL1 or SERIAL8 while retaining the mirrored FETtecOneWire, Torqeedo or CoDevESC protocol. - Exclude stale CAN/PWM protocols when switching to serial, then refresh telemetry after selecting a compatible control protocol. - Clear prior telemetry choices when the control connection is disabled. - Keep new PWM modes from firmware metadata selectable while offering only disabled telemetry when no built-in compatibility mapping exists. - Cover Main Out/AIO across Copter, Heli, Rover and Plane, including Q_M_PWM_TYPE metadata for Plane. Assert both telemetry selectors before a later field edit can overwrite their values. Use no mocks or private-state edits and leave existing tests, production code and mutation configuration unchanged. Validation: - All 263 validation-file tests and 2,278 selected tests pass. - Complete all 1,914 validation mutants: 1,626 killed, 288 surviving, zero without tests, zero timeouts and zero segfaults. - Catch 33 additional mutants while retaining every previous kill. - Reduce general ESC telemetry selector survivors from 31 to 5 and PWM mapping survivors from 33 to 26. - Verify assertion failures for ten representative prior survivors using the new cases alone, with zero setup errors. - Ruff, targeted pylint, pre-commit and git diff --check pass. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Add 38 behavior cases using real component models and public APIs to verify numeric guidance, inclusive boundaries and applied corrections. - Cover both endpoints and out-of-range values for takeoff weights, battery cell count/capacity, motor poles and propeller diameter. - Check range errors include the field, required numeric type and both limits, and conversion failures preserve the existing field value. - Verify entry validation previews the nearest allowed value without changing data and batch validation applies that exact correction. - Check crossed takeoff weights identify the opposing field and value, correct by 0.01 kg and preserve the unedited endpoint. - Load malformed related weights through saved-data initialization and report invalid types or nonnumeric text without replacing either value. - Exercise battery-voltage cross-field constraints through the general entry API and confirm the same correction is applied during a batch. - Revalidate corrected values to confirm the proposed repair is valid. Use no mocks or private-state edits and leave previously committed tests, production code and mutation configuration unchanged. Validation: - All 301 validation-file tests and 2,316 selected tests pass. - Complete all 1,914 validation mutants: 1,658 killed, 256 surviving, zero without tests, zero timeouts and zero segfaults. - Catch 32 additional mutants while retaining every previous kill. - Reduce entry-limit survivors from 22 to 10, takeoff-weight survivors from 19 to 9 and shared comparison survivors from 8 to zero. - Catch two additional battery-voltage mutations. - Verify assertion failures for 14 representative prior survivors using the new cases alone, with zero setup errors. - Ruff, targeted pylint, pre-commit and git diff --check pass. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Add 56 behavior cases using real component models and public APIs to verify chemistry limits, voltage relationships and invalid-input recovery. - Accept exact absolute minimum and maximum voltages for all eight supported chemistries and check the guidance for out-of-range values. - Verify errors identify the chemistry, exact limit or related threshold so generic error assertions cannot hide incorrect diagnostic details. - Cover all seven cross-field voltage relationships and preserve the other thresholds when batch validation corrects the edited field. - Check invalid text, empty values and decimal-comma text for all five voltage thresholds, including the recovery instruction and exact recommended value applied by batch validation. - Verify preview validation preserves data and corrected values pass subsequent entry validation. - Keep unrelated battery capacity and product fields outside the scope of the dedicated cell-voltage validator. Avoid dependence on Python conversion-error wording. Use no mocks or private-state edits and leave existing tests, production code and the mutation configuration unchanged. Validation: - All 357 validation-file tests and 2,372 selected tests pass. - Complete all 1,914 validation mutants: 1,675 killed, 239 surviving, zero without tests, zero timeouts and zero segfaults. - Catch 17 additional mutants while retaining every previous kill. - Reduce validate_cell_voltage survivors from 21 to four; individually review the remaining False-to-None argument changes as equivalent for the current comparison helper without adjusting the raw results. - Verify assertion failures for eleven representative prior survivors using the new cases alone, with zero setup errors. - Ruff, targeted pylint, pre-commit and git diff --check pass. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Add 50 behavior cases exercising the schema editor's public APIs with representative metadata dictionaries, without mocks or private calls. - Check exact datatype extraction for properties composed with allOf, including empty placeholders and unknown-type string fallback. - Handle a Components node without property definitions safely. - Distinguish quiet defaults for missing optional metadata from caught lookup exceptions that previously returned the same default tuple. - Keep unrelated product and allOf section properties from triggering absent-field lookups or spurious error logs. - Follow reference aliases to direct or composed nested field metadata while preserving the description and optional flag. - Verify missing MCU schema diagnostics identify the unavailable structure for both required and optional update requests. - Preserve malformed schema data and retain useful operation/type context in MCU-update and description-lookup error messages. Leave existing tests, production code and mutation configuration unchanged. Validation: - Establish a fresh baseline matching the earlier 508 schema outcomes: 436 killed and 72 surviving, with zero execution errors. - Complete a fresh regression run: 488 killed and 20 surviving, with zero without tests, zero timeouts and zero segfaults. - Catch 52 additional mutants while retaining every previous kill. - All 67 schema-file tests and 2,422 selected tests pass. - Verify assertion failures for eleven representative prior survivors using the new cases alone, with zero setup errors. - Individually review eight equivalents without adjusting raw results; keep twelve MCU debug-message mutations as unresolved survivors. - Ruff, targeted pylint, pre-commit and git diff --check pass. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Add 40 behavior cases using real schemas, models and parameter dictionaries through public APIs without mocks or private-state edits. - Initialize legacy battery settings with controller, file, mixed or absent voltage parameters available before migration runs. - Verify controller precedence, per-parameter fallback, single-cell and legacy-text counts, and pack-to-cell rounding to four decimals. - Use chemistry defaults for invalid, zero or negative cell counts. - Preserve existing thresholds, custom scalar/nested data and original input dictionaries while ordering newly migrated fields canonically. - Retain complete settings and their field order when reopening with different controller parameters. - Store supported Boolean spellings as actual bool values and preserve objects already matching the schema's dictionary type. - Retain unconvertible text with warnings that identify the value, target datatype, component path and structured-data requirement. Leave existing tests, production code and mutation configuration unchanged. Validation: - Establish a fresh 867-mutant baseline: 641 killed and 226 surviving. - Complete a fresh regression run: 725 killed and 142 surviving, with zero without tests, zero timeouts and zero segfaults. - Catch 84 additional mutants while retaining every previous kill. - Reduce cast-helper survivors from 46 to eight and battery-migration survivors from 39 to seven, with further initialization/setter gains. - All 118 base-file tests and 2,462 selected tests pass. - Verify assertion failures for 14 representative prior survivors using the new cases alone, with zero setup errors. - Record eleven individual equivalence reviews without adjusting the raw results; distinguish 28 earlier gains from this batch's 84 gains. - Ruff, targeted pylint, pre-commit and git diff --check pass. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Add 15 BDD cases using real schemas and the public project-loading API: - Verify exact format, program, controller, frame and battery defaults. - Preserve saved values, explicit zero and nested project extensions while refreshing the program version and leaving caller-owned input untouched. - Check the full standard component sequence and custom component order. - Cover optional product identity fields, version/URL ordering and partial metadata preservation, including Notes-last behavior. - Exercise legacy ESC connection merging, telemetry preservation/defaults, and GNSS component/protocol renaming without losing custom settings. - Confirm loaded projects remain stable when initialized again. Verify the same 867 base-model mutants: 792 killed and 75 surviving, catching 67 additional mutants while retaining all 725 previous kills. Confirm the new cases alone fail by assertion under 14 formerly surviving mutations and pass against unmodified generated source. Validation: 2,477 configured tests pass, including all 133 base-file tests; Ruff format/check, Pylint, pre-commit and git diff --check pass. Production code, existing tests and mutation configuration are unchanged. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
Expand regression coverage for observable model and GUI behavior, and include existing suites that were missing from Mutmut's test selection. - Select manual-override unit, acceptance, and integration tests, plus derived-parameter confirmation tests. - Cover IMU magnitudes across axes, all supported orientations, detection boundaries, scale invariance, and polling callback wiring. - Verify every supported AutoTune result filename and ensure aliases reduce only the intended axis gains. - Exercise inclusive parameter limits, independent FC-value validation, value resets, snapshot copy independence, and tolerance boundaries. - Check battery cell-count limits, invalid-voltage fallbacks, chemistry detection priority, and known firmware protocol renames. - Verify upload cancellation, cancelled and invalid renames, rejected motor settings, safety confirmation refusal, and timed status feedback. - Control motor-view timers before construction, destroy views during teardown, and mock informational dialogs. - Document equivalent mutants, focused reruns, result preservation, and fork-server isolation diagnostics. Validation: - Pass all 2,693 clean tests in the expanded mutation selection. - Confirm 352 additional kills across 1,262 targeted mutants. - Complete a separate 3,886-mutant baseline refresh, including coverage improvements from earlier commits. - Confirm four parameter worker failures as assertion kills with fork-server preloading disabled; retain five sampled GUI timeouts. - Pass pre-commit and Pylint checks. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
Test Results 3 files - 1 3 suites - 1 43m 21s ⏱️ - 23m 16s For more details on these failures, see this check. Results for commit 84ed73b. ± Comparison against base commit cc1d26f. This pull request removes 10 and adds 554 tests. Note that renamed tests count towards both.This pull request skips 2 tests.♻️ This comment has been updated with latest results. |
Previous review (2026-10-26)Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head This PR adds Mutmut mutation testing and strengthens many tests, but the pylint CI job fails on duplicate code introduced by the new tests. Blocking
Minor
Withdrawn: the concern that the sub-volt chemistry boundary test locks in degenerate behaviour. It tests the helper's documented threshold. |
Expand Mutmut's scope from 32 to 38 modules and select their existing focused test suites. Add 72 test cases targeting observable behavior exposed by surviving mutants. - Cover flight-controller frame fallbacks, throttle and duration limits, and default motor sequence numbering. - Verify one-byte transfers, estimates at exactly one second, and transitions between known and unknown file sizes. - Check every supported configuration expression helper. - Exercise firmware migration boundaries, collision diagnostics, invalid version inputs, and numeric serial-port ordering. - Cover secondary-battery thresholds, unavailable readings, reconnect and re-enable recovery, and telemetry subscription retries. - Assert expected telemetry intervals before advancing the round-robin simulation so zero-interval mutants fail immediately. - Verify configuration-step metadata, defaults, forced and derived values, manual overrides, live expression inputs, deletion priority, auto-import identity, connection conflicts, and ExpressLRS guidance. - Add scoped pylint duplicate-code suppressions around independent expected ordering tuples. - Document equivalent and unreachable mutation paths, and clarify that per-mutant timeouts and crashes are reported for review while clean-test and framework failures fail the workflow. Validation: - 3,001 configured tests pass. - Targeted kills increase from 792 to 976 across 1,109 mutants. - No unresolved targeted timeouts, crashes, or missing test associations. - Repository-wide pylint and pre-commit checks pass. Signed-off-by: Dr.-Ing. Amilcar do Carmo Lucas <amilcar.lucas@iav.de>
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head No open issues remain at head 84ed73b. This PR adds mutmut mutation-testing support and strengthens tests, with no production code changes. Since the last review at 8ec0c44, both earlier findings are fixed. The duplicated expected tuples are now wrapped in scoped duplicate-code suppressions (tests/test_data_model_vehicle_components_base.py:1727, :2120), and pylint passes again. The failure wording in .github/workflows/mutation.yml:69 and CONTRIBUTING.md:140 now matches mutmut 3.8.0's exit behaviour. The remaining red CI jobs are not caused by this PR: Windows layout failures that also fail on base, a network timeout on Ubuntu, a Homebrew setup failure on macOS, and a broken link in files the PR does not touch. The full mutation campaign and the GitHub run of the mutation workflow were not exercised here. |
Description
Add mutation testing
Checklist
git commit --signoff)Testing
Describe how you tested these changes: