Skip to content

ExportOnyxStateTest failing on main: areAgentsLoaded / arePolicyRoomsLoaded not covered by export bucket rules #96008

Description

@roryabraham

Problem

tests/unit/ExportOnyxStateTest.ts is failing on main (confirmed by running it directly against a fresh main checkout, not just a feature branch):

Onyx key export coverage › every ONYXKEYS value (top-level + collection) must be in one of the four buckets

expect(received).toEqual(expected) // deep equality

- Expected  - 1
+ Received  + 4

- Array []
+ Array [
+   "areAgentsLoaded",
+   "arePolicyRoomsLoaded",
+ ]

  315 |         const uncoveredCollection = allCollectionKeys.filter((key) => !coveredKeys.has(key));
  316 |
> 317 |         expect(uncoveredTopLevel).toEqual([]);
      |                                   ^
  318 |         expect(uncoveredCollection).toEqual([]);
  319 |     });

Root cause

f8dbfd4 ("add loading for agnets", merged Jul 10) added two new top-level Onyx keys in src/ONYXKEYS.ts:

ARE_AGENTS_LOADED: 'areAgentsLoaded',
ARE_POLICY_ROOMS_LOADED: 'arePolicyRoomsLoaded',

Neither key was classified into one of the four buckets in src/libs/ExportOnyxState/common.ts. The coverage test (introduced in #95433) deliberately fails whenever a new Onyx key isn't explicitly bucketed, so classification can't silently drift — this is the same pattern as the recently-fixed #96001 (companyCardsLoadingState_).

Suggested fix

Both keys are simple boolean "has this page finished loading once" flags with no PII, matching the existing precedent of IS_LOADING_BILL_WHEN_DOWNGRADE and RAM_ONLY_REPORT_LOADING_STATE/RAM_ONLY_COMPANY_CARDS_LOADING_STATE, which are all classified as safeOnyxKeys. Likely fix is adding both to safeOnyxKeys in src/libs/ExportOnyxState/common.ts (keeping the array alphabetically sorted, per the existing onyxKeysToMaskFragileData/safeOnyxKeys ordering test).

Verification

Confirmed via a temporary worktree checked out at origin/main — the test fails identically there (24/25 passing, same error), so this is not specific to any feature branch.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions