Skip to content

Fix failing golden master integration tests: ClassVar leak, data drift, missing Transaction properties - #4

Draft
caseydreier with Copilot wants to merge 2 commits into
mainfrom
copilot/assess-failing-actions-job
Draft

caseydreier with Copilot wants to merge 2 commits into
mainfrom
copilot/assess-failing-actions-job

Conversation

Copilot AI commented Aug 24, 2026 •

Copy link
Copy Markdown

Three golden master integration tests were failing due to a combination of a snapshot bug, live API data drift, and an out-of-date golden fixture.

Changes

Fix: SEARCH_FIELDS ClassVar leaking into snapshots

_snapshot_object iterates dir(obj), which includes class-level ClassVar attributes (e.g. Transaction.SEARCH_FIELDS). Added _is_classvar_attr() to detect and skip them:

def _is_classvar_attr(obj: object, name: str) -> bool:
    for cls in type(obj).__mro__:
        try:
            hints = typing.get_type_hints(cls)
        except Exception:
            hints = getattr(cls, "__annotations__", {})
        if name in hints:
            return getattr(hints[name], "__origin__", None) is typing.ClassVar
    return False

Fix: transaction_first_result.json out of date

The Transaction model was expanded with ~30 new instance properties after the golden file was last recorded. Updated the fixture to include all new properties — null for search-only fields absent in award-scoped responses, Decimal(0.00) for aliased zero-amount fields, and type tags for volatile ones.

Fix: Data drift in funding_first_result and award_account_first_result

gross_outlay_amount, reporting_fiscal_month, obligated_amount, and total_transaction_obligated_amount are live financial figures that change as USASpending ingests and revises transactions. Added to VOLATILE_PROPERTIES so they're compared by type tag rather than pinned value, and updated the golden fixtures accordingly.

Also added the six new volatile properties to KNOWN_UNCOVERED in test_volatile_field_mapping.py — four are from Funding/AwardAccount models not covered by the Award-level volatile_fields tables, and two (award_internal_id, generated_unique_award_id) are API-forwarded identifiers with no coercion mapping to verify.

- Add _is_classvar_attr() helper and skip ClassVar attributes
  (e.g. SEARCH_FIELDS) in _snapshot_object so class-level metadata
  does not appear as instance properties in golden snapshots
- Add gross_outlay_amount, reporting_fiscal_month, obligated_amount,
  total_transaction_obligated_amount, award_internal_id and
  generated_unique_award_id to VOLATILE_PROPERTIES since they are
  live financial figures or internal IDs that change as data is ingested
- Update funding_first_result.json and award_account_first_result.json
  golden fixtures to record volatile type tags instead of pinned Decimal/int
  values that drifted with live API data
- Update transaction_first_result.json to include all new Transaction
  model properties that were added after the golden file was last recorded
- Add new volatile properties to KNOWN_UNCOVERED in test_volatile_field_mapping
  so the coverage gate stays green

Co-authored-by: caseydreier <168192+caseydreier@users.noreply.github.com>
Copilot AI changed the title [WIP] Analyze and fix failing GitHub Actions job Fix failing golden master integration tests: ClassVar leak, data drift, missing Transaction properties Aug 24, 2026
Copilot AI requested a review from caseydreier August 24, 2026 15:31
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.

2 participants