Skip to content

Portal test pins capacity percentages of a recorded sample that changes at each recording #792

Backlog

Description

@ephico2real2

Part of #19. Found on PR #791 (#783), CI run 46725943883, job portal-ui.

What is wrong. cmapi-portal-ui/tests/api/portal.test.mjs (test "12 Quotas change", the assertion "the recorded plan: the test instance has no usage source (#310)") pins the capacity line of the recorded update dry run as cpu 13% · memory 10%. The stand-in serves that dry run from cmapi/src/cmapi/contract/samples.json (namespaces_update_namespace:dryRun, standin.mjs planUpdate), and the samples test compares those numbers by shape only (test_api_samples.py: "Values such as request IDs, times, etags and cursors differ at each run, so this test compares those by shape"). Any PR that records the samples again (every API change must) can change them, and the portal job then fails although nothing in the portal changed.

Measured (macOS, the suite's PostgreSQL 16, 2026-12-01): two recordings on #791's branch gave capacity.cpu 0.062 and memory 0.05; main 390655a holds 0.125 and 0.1; one experimental recording with the CRC cache listed again before the dry run gave 0.312 and 0.25. The value depends on what the fake cluster's watch cache holds at that moment (test_api_samples.py notes "the fake cluster's watch does not stream").

How to prove it. Re-record the samples (CMAPI_WRITE_SAMPLES=1 ... test_api_samples.py) until the dry run's capacity.cpu differs from 0.125, then run the portal job's tests/api/portal.test.mjs: test 12 fails.

Severity: Medium. It blocks CI for an unrelated API change; no runtime effect.

Fix in #791 (it blocks that PR): the portal test reads the fractions from the same sample the stand-in serves, rounded as src/portal/plan.ts rounds them. Left open here: whether the sample scenario should make the ledger's state deterministic before that dry run, so the recorded plan is the same at each run.

Research: search the primary sources, compare the options, choose the industry best practice, fix the cause rather than the symptom, and record the choice and its sources.

Activity

  1. added
    bug
    on Dec 1, 2026
  2. added a commit that references this issue on Dec 1, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions