Skip to content

Add a CLI round-trip test for storage export/restore - #285

Merged
hugs merged 2 commits into
mainfrom
test/storage-round-trip
Aug 3, 2026
Merged

Add a CLI round-trip test for storage export/restore#285
hugs merged 2 commits into
mainfrom
test/storage-round-trip

Conversation

@hugs

@hugs hugs commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

vibium storage / storage restore had no coverage on the agent code path, which is how the double-encoding bug in #217 shipped unnoticed.

The storage tests that already exist do not catch it. I confirmed that by reintroducing the bug:

  • tests/js/async/storage.test.js and tests/py/test_storage.py do a full capture/clear/restore round trip, but against api.Router, which is a separate implementation. Both pass with the bug present.
  • tests/mcp/server.test.js does hit the affected code, but only asserts the call does not error. The bug produced valid, error-free JSON, so it passes too.

Three cases, all failing against pre-#217 code and passing after:

  1. export writes storage as a nested object rather than a double-encoded string
  2. restore round trip repopulates localStorage and sessionStorage
  3. restore still reads state files written in the old shape

Adapted from a test contributed by @Jhoan0714 in #218.

Full make test passes.

vibium storage / storage restore had no test coverage at all, which is
how the double-encoding bug in #217 shipped and stayed unnoticed.

Covers the export shape, the restore round trip, and the unwrap that
keeps state files written in the old shape loading. All three fail
against the pre-#217 code.

Adapted from a test contributed by @Jhoan0714 in #218.
@hugs
hugs force-pushed the test/storage-round-trip branch from 04edcc3 to 220912f Compare August 3, 2026 12:49
@hugs
hugs merged commit 8935d15 into main Aug 3, 2026
2 checks passed
@hugs
hugs deleted the test/storage-round-trip branch August 3, 2026 19:44
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.

1 participant