Skip to content

test(spp_change_request_v2): cover fail-closed/edge branches flagged by codecov on batch 2 (field_mapping no-selection; conflict_mixin dynamic-duplicate) [from #422] #426

Description

@gonzalesedwin1123

From the codecov patch-coverage audit of batch-2 PR #422 (comment: patch coverage 91.9%, 16 lines). The audit confirmed no security-critical enforcement line is untested — the 16 misses are defensive branches, latent-feature sub-cases, and mechanical async/demo lock reroutes. This issue tracks adding tests for the two Group-B lines worth pinning; the rest are defensive/mechanical and left uncovered by design.

Severity: Low (test coverage only)

Add tests

  1. spp_change_request_v2/strategies/field_mapping.py:34return mappings.browse(), the fail-CLOSED path of _effective_mappings for a dynamic-approval type with no selected_field_name (applies nothing). The adjacent unmapped-selection branch (line 35) is tested; the no-selection branch is not. Add a test: a dynamic-approval field_mapping CR with an empty selected field applies/previews nothing.

  2. spp_change_request_v2/models/conflict_mixin.py:528any_similar = True, the fuzzy-match sub-branch of dynamic duplicate detection (returns 80.0). Reached only by two dynamic-approval field_mapping CRs with the same changed-field set where a field differs but is "similar". Latent today (no shipped CR type enables dynamic approval) but worth a regression test alongside the existing dynamic-duplicate tests.

Explicitly NOT worth a test (documented for the record)

conflict_mixin.py:331/337/522 (missing-detail edge + non-existent-field skips), change_request.py:692 & change_request_detail_base.py:110 (recordset-normalization branch of _normalize_frozen_value), assign_program.py:65 (empty-program_id skip), and the eight spp_programs/spp_farmer_registry_demo _acquire/_release_operation_lock reroute call sites (async/demo paths the unit-test DB doesn't drive; the is_locked write guard itself is tested).

References

Codecov audit comment on #422; internal/plans/batch2-fix-review.md.

Activity

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions