Skip to content

test_rules_coverage drift tests wipe real coverage entries via monkeypatch.setattr #662

Description

@FileSystemGuy

Regression uncovered by PR #602 CI

Two tests in `mlpstorage_py/tests/test_rules_coverage.py` fail on PR #602's branch:

  • `TestRulesCoverageReconciliation::test_drift_stale_oos_emits_warning_and_keeps_exit_0`
  • `TestRulesCoverageReconciliation::test_drift_stale_stub_emits_warning_naming_the_stub`

Both use `monkeypatch.setattr` to replace `coverage_mapping.OUT_OF_SCOPE_RULES` / `coverage_mapping.STUB_COVERAGE` with a single fake stale entry, then assert `reconcile()['unmapped'] == set()`.

That assertion held at Phase-3 land time because both registries were empty. Storage#658 (merged as #659) populated them with real entries mapped to PR #602's §6 IDs (17 in `STUB_COVERAGE['KVCacheCheck']`, 2 in `OUT_OF_SCOPE_RULES`). Once PR #602's Rules.md is present in the tree, the monkeypatch wipes real coverage and 19 §6 IDs go unmapped, tripping the assertion.

Fix

Change both tests to use a superset monkeypatch pattern (preserve existing entries, add the fake stale one). Weaken `stale_stubs` strict equality to `.get('VdbCheck') == ['9.9.8']` since KVCacheCheck's 17 anticipation-window entries can appear as stale drift on `main` (until PR #602 lands) even with the superset applied.

Blast radius

Blocks PR #602 CI (`test (3.12, others)`). No production impact — drift-warning behavior itself is correct; only the test's monkeypatch strategy is fragile.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions