Skip to content

test(e2e): cover the act-as Safe flow end to end - #105

Open
douglance wants to merge 1 commit into
siwe/e2e-harnessfrom
siwe/act-as-specs
Open

test(e2e): cover the act-as Safe flow end to end#105
douglance wants to merge 1 commit into
siwe/e2e-harnessfrom
siwe/act-as-specs

Conversation

@douglance

Copy link
Copy Markdown
Contributor

Stacked on #104. Last of four.

Exercises GET /api/auth/safes and POST/DELETE /api/auth/act-as against the real stack (local governance testnode + ponder + Postgres):

Test Covers
by-address entry with an empty Safe list GET /api/auth/safes
not a Safe 404 safe_not_found
malformed address client-side, no round trip
switch → banner → reload → recall list → revert POST + DELETE /api/auth/act-as
not an owner 403 not_an_owner

One subtlety worth calling out

The empty-Safe-list test signs in as a key that owns no Safe, not the profile key. The indexer only records a Safe after a successful act-as, and those known_safe rows outlive a run because the app schema is not namespaced by PONDER_SCHEMA. Asserting emptiness with a key that can act-as therefore passes once and fails forever after.

This actually happened during development: the test went green, then failed on the next run. A key that structurally cannot populate the table is history-independent, which is a stronger guarantee than remembering to reset the database first.

Skip condition

The two on-chain cases need a Safe on chain 412346 and are skipped unless TEST_SAFE_ADDRESS is set. The testnode image does not bake one yet — OffchainLabs/arbitrum-governance-indexer testnode/safe-fixture adds it, and both tests pass against that Safe locally:

✓ switches subject, banners it, and reverts (1.5s)
✓ refuses a Safe the signer does not own (403 not_an_owner) (938ms)

Verification

11 passed, three consecutive runs (5 setup + 5 act-as + existing profile spec).

@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
tally-zero Ready Ready Preview Aug 27, 2026 6:10pm

Request Review

Exercises GET /api/auth/safes and POST/DELETE /api/auth/act-as against the
real stack: by-address entry, 404 safe_not_found, client-side address
validation, the full switch (banner, reload persistence, recall list, revert)
and 403 not_an_owner.

The empty-Safe-list test deliberately signs in as a key that owns no Safe
rather than the profile key. The indexer only records a Safe after a
successful act-as, and those known_safe rows outlive a run because the app
schema is not namespaced by PONDER_SCHEMA — so asserting emptiness with a key
that can act-as passes once and then fails forever. A key that structurally
cannot populate the table is history-independent.

The on-chain cases need a Safe on chain 412346 and are skipped unless
TEST_SAFE_ADDRESS is set; the testnode image does not bake one yet.
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