Skip to content

ui-react: replace weak graph order and parameter-name assertions with geometry oracles #2982

Closed

Description

@schlessera

Context

Part of #2963. Source-verified finding from the 2026-10-25 multi-agent test-value audit at c670449d3bf1b0639e50ce554d728961f4313add. Broad inventory screening was followed by detailed inspection of this finding; this is not a claim of exhaustive manual review or measured CI savings.

Classification/confidence: Confirmed assertion-quality weaknesses by source inspection, not a claim that the whole suite is tautological. No mutation performed. These are not major cost candidates.

A. Community order accepts coincident angles

  • Test DISCOVERY_COMMUNITY_BRANCH_ORDER: assigned topics precede absent topics, packages/ui-react/tests/discovery-bands.test.ts:4-20, obtains production radialLayout positions and asserts [7,9,5,3].map(angle) equals that same list sorted numerically (17-19).
  • This is a real nondecreasing-order property, not a literal expect(x).toEqual(x) tautology. However, all four angles being identical satisfies it. For example, a broken radial wrapper returning (x=0, y=distance) for every node would pass it: all four angles are zero. It has destroyed every branch's angular placement.
  • The existing wrapper tests root sits at the origin, rings at their distance and deterministic across calls and input order, packages/ui-react/tests/graph-helpers.test.ts:78-108, also accept that collapsed deterministic wrapper: the tested radii and stable keys remain correct.
  • Production wrapper: radialLayout, packages/ui-react/src/lib/graph-helpers.ts:71-79, scales the discoveryLayout coordinates. Real graph use: packages/ui-react/src/components/graph/graph-canvas.tsx:430-442.
  • Independent existing sort oracle: DISCOVERY_NULL_COMMUNITIES: null and missing share the unassigned ordering, discovery-bands.test.ts:230-247, asserts exact wedge identities [7,9,5,3,4,null] directly from discoveryLayout. Keep it. It does not check that the radial wrapper preserves those distinct angles.
  • Native detection also survives: Discovery capture and real selection, packages/ui-react/tests/browser/discovery-bands.layout.tsx:119-124, compares the actual Sigma graph coordinates to the direct geometry result, so collapsed wrapper output cannot be called a whole-suite survivor. That is meaningful runtime wiring proof and stays.

Safe rewrite: keep exact expected identity order and require finite, distinct, strictly ordered first-hop angles (with an explicit wrap convention); add a representative non-unit ringSpacing and directed-edge case to the cheap radial wrapper test if wrapper scaling/edge forwarding is the intended protected contract. Expected ordering comes from fixture IDs, not production-sorted output. Preserve existing radius/permutation/native wiring tests.

Mutation proposal: in a separate implementation checkout, temporarily collapse only the wrapper's first-hop angular coordinates, retaining radii. The old ordering and radius/determinism cases should remain green; the rewritten independent-angle test must fail on the intended distinct/order assertion. Restore. This audit has not executed that mutation.

B. Parameter names do not prove viewport independence

  • Test DISCOVERY_SIGNATURE: geometry accepts only scene nodes and directed scene edges, discovery-bands.test.ts:188-196, asserts function arity and the literal parameter names nodes,edges obtained from Function.toString().
  • The protected production principle is scene units with no presentation inputs (packages/ui-react/src/lib/discovery-layout.ts:6, implementation starts at 53). A function with the same two parameter names can still read globalThis.innerWidth or a module-global presentation value inside its body; this test stays green. Conversely, renaming a parameter while preserving all behavior makes it red.
  • Actual geometry proof already lives in DISCOVERY_G1_G4 (discovery-bands.test.ts:81-85), permutation stability (86-98), directed minimum parent (100-133), lane threshold (134-145), demand changes (146-165), clipping/separation (166-187) and exact allocation (198-228). Keep these.
  • Actual presentation isolation is tested in native proof: discovery-bands.layout.tsx:238-263 asserts unchanged stored coordinates after selection, color/theme change, real renderer resize and camera zoom. Keep that browser boundary, including waiting for the real renderer's new dimensions (246-257).

Safe rewrite/remove: replace the parameter-name assertion with a focused behavioral independence check or remove it in favor of the existing runtime invariance owners after recording the mapping. If adding a cheap ambient-viewport test, call the real discoveryLayout on the same nonempty multi-branch data with two controlled ambient values, restoring complete descriptors. Do not recreate the layout algorithm in the test. A mutation reading viewport inside the implementation must fail the new test (and a harmless parameter rename must not).

Verification performed / count

rtk proxy bun run test ./packages/ui-react/tests/discovery-bands.test.ts ./packages/ui-react/tests/graph-helpers.test.ts -t 'DISCOVERY_COMMUNITY_BRANCH_ORDER|DISCOVERY_SIGNATURE|radialLayout'

4 pass, 33 filtered, 0 fail, 10 expect calls, Bun 1.4.3. Runner reported 111ms; wrapper's tests-complete elapsed was approximately 143ms. These are local focused-run observations only, with no source mutation. They show the weak cases currently execute; they are not evidence the proposed mutations passed.

Removable count: at most one tiny unit invocation if the syntax guard is removed rather than replaced. The ordering case should be strengthened, not deleted. No meaningful runtime saving claimed.

Scope

Strengthen branch-angle observations and replace/remove parameter-name spelling checks in favor of actual presentation-independence proof.

Out of scope

Changing product behavior, public contracts, required proof gates, offline guards, runtime pins or unrelated tests. Every distinct native, security, lifecycle and adapter obligation identified above remains. This issue does not authorize deleting the surviving owner named by another audit issue.

Acceptance criteria

  • The ordering oracle rejects collapsed/coincident/nonfinite first-hop angles while retaining fixture identity order, radius and permutation guarantees.
  • Harmless parameter renames preserve green behavioral proof; actual viewport dependence or collapsed wrapper angles fail the appropriate cheap/native owner.
  • Existing native Sigma coordinate, resize/theme/zoom invariance and direct allocation tests remain.
  • Record an assertion-to-owner mapping for every moved or removed case, including shared-helper obligations; do not count matching test names as proof of equivalence.
  • Run the proposed focused production mutation(s), observe failure on the intended assertion, restore, and record passing focused proof. A module-load error is not a behavioral receipt.
  • Any performance claim separates scenario/body cost, setup and total elapsed time and uses comparable observations; structural counts alone are not a speedup.

Verification

bun run test ./packages/ui-react/tests/discovery-bands.test.ts ./packages/ui-react/tests/graph-helpers.test.ts
node scripts/visual.mjs --project=ui-react-layout --filter=discovery-bands
bun run check:pr --base origin/main

Preserve the existing offline/keyless harness. Browser/native commands require the documented real runtime and OS-offline prerequisites; missing prerequisites are not passing or skipped proof. The mutation proposals and retained boundary checks are detailed above.

Contract impact

No integration-contract or product-behavior change is selected. This is test/proof maintenance; retain the current CLI/MCP/wire/schema/frontmatter envelopes. No release-content change is selected.

Activity

  1. added
    type: test
    area: ui-react
    on Oct 25, 2026
  2. added
    priority: p2
    agent-ready
    on Oct 25, 2026
  3. schlessera commented on Oct 25, 2026

    @schlessera
    OwnerAuthor

    2026-10-26 triage at main c670449d3bf1b0639e50ce554d728961f4313add: verified the cited current test/production boundary and native #2963 parent. The scope names the retained proof, exclusions, checkable acceptance criteria, focused verification and mutation requirements; no unresolved design, decision, access or reproduction prerequisite prevents starting this test-maintenance task. Set priority p2 for wanted, unscheduled work and add agent-ready. Keep native/browser/SDK qualification required by the brief as implementation proof; this source/readiness review supplies no completed repair, post-change equivalence or measured CI saving.

  4. added this to the 0.44.0 milestone on Oct 29, 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

    agent-readyarea: ui-reactpriority: p2type: test

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions