Skip to content
This repository was archived by the owner on Jul 27, 2026. It is now read-only.

test: drop should-not-exist assertions on removed code (APP-2570) - #1554

Merged
tofarr merged 2 commits into
mainfrom
hieptl/app-2570
Jun 30, 2026
Merged

tofarr merged 2 commits into
mainfrom
hieptl/app-2570

Conversation

@tofarr

@tofarr tofarr commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

HUMAN:

I ran the unit tests locally and reviewed the removals.

  • A human has tested these changes.

AGENT:


Why

PR #1545 added three negative-existence test assertions in the test code that all assert "this testid was never in the source" (or "this testid is no longer in the source"). The reviewer tofarr flagged this in the review:

"A test that makes sure that something which was deleted six months ago does not exist. We should probably have an agent review our tests for cases like this and remove them."

This PR is the audit + cleanup. Tracked as APP-2570.

Summary

  • Drop three orphan negative-existence assertions whose target testids have no source counterpart: login-cta, acp-credentials-save-button, and conversation-card-llm-model.
  • Surveyed all ~700 queryByTestId(...).not.toBeInTheDocument() / .toBeNull() / .not.toBeVisible() calls across __tests__/ (150 unique testids). Only 3 were true orphans. The other ~147 are still load-bearing (conditionally-rendered testids, or assertions that gate meaningful UX invariants like "don't show URL/api_key fields for a stdio server").
  • Keep the new analytics-consent-modal assertion added by fix: remove first-run analytics consent popup from onboarding #1545 — it's load-bearing for the release that removed the modal and matches the same pattern that PR fix(acp): single Save + auth banner + one toast on Settings → Agent #1251 used when it introduced acp-credentials-save-button (now itself a candidate for a future cleanup pass; APP-2570 tracks it).

Issue Number

APP-2570

How to Test

Run from the repo root:

npm ci
npm run make-i18n
node_modules/.bin/vitest run \
  __tests__/routes/device-verify.test.tsx \
  __tests__/routes/agent-settings.test.tsx \
  __tests__/components/features/conversation-panel/conversation-card.test.tsx
npm run typecheck
npm run lint

Expected: 71/71 tests green (device-verify 15, agent-settings 21, conversation-card 35); typecheck and lint clean.

To reproduce the audit:

# 1. Enumerate all unique testids referenced in negative-existence assertions
grep -rhE 'queryByTestId\("[^"]+"\)' __tests__/ \
  | grep -E 'not\.toBeInTheDocument|toBeNull|not\.toBeVisible' \
  | sed -E 's/.*queryByTestId\("([^"]+)"\).*/\1/' | sort -u

# 2. For each, verify it still appears positively somewhere in src/ or __tests__/
#    (use the same query above but with getByTestId/findByTestId).
#    If neither, the assertion is a no-op and is a candidate for removal.

Video/Screenshots

Not applicable — this is a test-only change. There is no UI delta to screenshot. The three removed test cases are visible in the diff: see the commit e681b066 for the full before/after.

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

(Test cleanup + refactor; no production code change.)

Notes

  • Audit method: for every queryByTestId(<id>).not.toBeInTheDocument() / .toBeNull() / .not.toBeVisible() in __tests__/, confirmed: (a) the testid is not set anywhere in src/ today, (b) there is no positive getByTestId / findByTestId assertion for it in the suite, and (c) it is not provided by a vi.mock that still applies. Only 3 of the 150 unique testids met all three "orphan" criteria.
  • Decisions documented in the commit message for each removal: which PR introduced the assertion, which PR removed the underlying testid, and why the test is now a no-op.
  • No production source changes; diff is test-only. No migrations, no config changes, no rollout concerns.
  • Follow-up tracked in APP-2570 for the next time a similar pattern decays (e.g. when analytics-consent-modal eventually gets re-added in some form and the assertion in fix: remove first-run analytics consent popup from onboarding #1545 becomes stale again).

🐳 Docker images for this PR

• GHCR package: https://github.com/OpenHands/agent-canvas/pkgs/container/agent-canvas

Component Value
Image ghcr.io/openhands/agent-canvas
Architectures amd64, arm64
Agent Server ghcr.io/openhands/agent-server:1.29.3-python
Automation openhands-automation==1.0.0a13
Commit 5c91c5bd8dd5da3692283a48caf737b45747e040

Pull (multi-arch manifest)

# Multi-arch manifest — Docker automatically pulls the correct architecture
docker pull ghcr.io/openhands/agent-canvas:sha-5c91c5b

Run

docker run -it --rm \
  -p 8000:8000 \
  ghcr.io/openhands/agent-canvas:sha-5c91c5b

All tags pushed for this build

ghcr.io/openhands/agent-canvas:sha-5c91c5b-amd64
ghcr.io/openhands/agent-canvas:hieptl-app-2570-amd64
ghcr.io/openhands/agent-canvas:pr-1554-amd64
ghcr.io/openhands/agent-canvas:sha-5c91c5b-arm64
ghcr.io/openhands/agent-canvas:hieptl-app-2570-arm64
ghcr.io/openhands/agent-canvas:pr-1554-arm64
ghcr.io/openhands/agent-canvas:sha-5c91c5b
ghcr.io/openhands/agent-canvas:hieptl-app-2570
ghcr.io/openhands/agent-canvas:pr-1554

About Multi-Architecture Support

  • Each tag (e.g., sha-5c91c5b) is a multi-arch manifest supporting both amd64 and arm64
  • Docker automatically pulls the correct architecture for your platform
  • Individual architecture tags (e.g., sha-5c91c5b-amd64) are also available if needed

Removes three negative-existence test assertions that have decayed into
no-ops because the testids they target no longer exist in source. Each
was added in the same PR that deleted the related component (or, for
login-cta, in the OSS-strip PR) and was useful as a regression guard at
the time. Once the deletion is several weeks old, an assertion of the
form `expect(queryByTestId("deleted-testid")).not.toBeInTheDocument()`
is always trivially true and only adds maintenance noise.

Follow-up to PR #1545 review feedback (tofarr): 'A test that makes sure
that something which was deleted six months ago does not exist. We
should probably have an agent review our tests for cases like this and
remove them.' See APP-2570 for the audit inventory and follow-ups.

* __tests__/routes/device-verify.test.tsx — drop the entire
  'keeps the device verification view OSS-only without login CTA chrome'
  test. The testid 'login-cta' has no source counterpart; the assertion
  was always trivially true. Test was added in #17 (the OSS-strip PR).

* __tests__/routes/agent-settings.test.tsx — drop the orphan
  queryByTestId('acp-credentials-save-button') assertion (and the
  obsolete explanatory comment) from the 'a single Save persists ACP
  credentials' test. The testid has no source counterpart; the rest of
  the test (the single Save flow) is unaffected.

* __tests__/components/features/conversation-panel/conversation-card.test.tsx
  — drop the entire 'should not render the llm model in the conversation
  card' test. The testid 'conversation-card-llm-model' was removed in
  6e545c5 ('Move LLM model name from conversation lists/title to chat
  input'); the inverted test added at the same time is now a no-op.

All three test files still pass. typecheck clean. No new lint issues.
The PR's own new analytics-consent-modal assertion is intentionally kept
— it is load-bearing for the release that removed the modal and matches
the same pattern that PR #1251 used for acp-credentials-save-button
(now itself a candidate for a future cleanup pass; APP-2570 tracks).

Co-authored-by: openhands <openhands@all-hands.dev>
@vercel

vercel Bot commented Jun 30, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agent-canvas Ready Ready Preview, Comment Jun 30, 2026 6:01pm

Request Review

@tofarr
tofarr merged commit 5ce65c2 into main Jun 30, 2026
18 checks passed
@tofarr
tofarr deleted the hieptl/app-2570 branch June 30, 2026 18:34
@openhands-release-bot openhands-release-bot Bot added the released: v1.2.0 Shipped in v1.2.0 label Jul 9, 2026
@openhands-release-bot

Copy link
Copy Markdown
Contributor

🚀 Released in v1.2.0.

This branch was successfully deployed

1 active deployment
Preview — 5c91c5bd Deployed Jun 30, 2026 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

released: v1.2.0 Shipped in v1.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants