Skip to content

Expand unit-test coverage, pin known quirks, polish docs - #2

Merged
chiliec merged 16 commits into
masterfrom
test-coverage-expansion
May 16, 2026
Merged

chiliec merged 16 commits into
masterfrom
test-coverage-expansion

Conversation

@chiliec

@chiliec chiliec commented May 16, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Unit test coverage 56 → 108 tests in <0.05s. Covers every modeled operation (round-trip for the 23 encode-supported ops, decode-only for the 14 virtual ones), pins 27 currently-Unknown-mapped op ids, and pins 14 encode-asymmetric cases. Strengthens Asset and VIZEncoder primitive coverage.
  • Pinned 5 known quirks with both a test and a grep-discoverable // TODO: in Sources/VIZ/ (Share parse-failure fallback, currentEnergy Date(), Convert missing OperationId, custom encode/decode type mismatch, testNet prefix). Behavior unchanged.
  • Source-side change is one line: removed a dead print in Client.swift:233. All other source diffs are TODO comments.
  • Linux CI fix: corrected long-standing SeemURLTest → VIZURLTest typo in XCTestManifests.swift (was silently disabling 2 tests on Linux).
  • Docs polish: rewrote README (TOC, clearer structure, fixed code samples that referenced undefined identifiers). Added AGENTS.md + CLAUDE.md for AI coding agents.

What's deferred

Two ops (Custom round-trip, DeleteContent round-trip) are intentionally not tested in this round — they're incompatible with current encode/decode dispatch and pinned via the asymmetry test + source TODOs. Documented at the test site.

Plan and design docs live under docs/superpowers/ for the next round.

Test plan

  • swift test --filter UnitTests — 108 tests, 0 failures, ~0.05s locally
  • swift build succeeds
  • All 5 source TODOs reachable via grep -n "TODO:" Sources/VIZ/*.swift
  • No behavioral source drift (git diff master..HEAD -- Sources/ shows only the dead-print removal, 5 TODO comments, and 1 explanatory comment)
  • Linux CI run

🤖 Generated with Claude Code

chiliec added 16 commits May 16, 2026 15:52
Captures the scope, test plan, and pinned quirks for an upcoming
unit-test coverage push (covering every modeled Operation, Asset
edge cases, VIZEncoder primitives) plus the narrow set of
behavior-preserving source corrections. Also adjusts .gitignore
so design docs under docs/superpowers/ are tracked while generated
docs under /docs remain ignored.
Deletes the commented-out debug print in Client.urlRequest and adds
TODO/explanatory comments at five known-quirk locations (Share decode
fallback, currentEnergy clock injection, Operation.Convert missing
OperationId, custom/CustomJson encode-decode asymmetry, testNet prefix
collision). No behavior changes.
Adds testRoundTrip_<op> for every operation that AnyOperation.encode
dispatches on, verifying binary encode, JSON decode, and AnyOperation
wrapped JSON round-trip in one helper.

Custom and DeleteContent are omitted: both have encode/decode asymmetries
in AnyOperation (Custom encodes as Custom but decodes as CustomJson;
delete_content is missing from the OperationId string switch). These are
documented as comments and tracked for Task 6.
Comment said 'absent from OperationId string-switch in AnyOperation.init(from:)'
when the actual missing entry is in OperationId.init(from:). No code change.
The typo on the affected line meant VIZURLTest was silently skipped
on Linux. Fix restores those 2 tests to Linux CI.
- Add a table of contents
- Promote the feature list to the top, drop the philosophy section
- Normalize headers to sentence case, add consistent dividers
- Fix code samples that referenced undefined identifiers
  (Error.invalidKey, regularKey, publicKey)
- Cover .codingError in the error-handling example
- Show all three swift test invocations
- Note that XCTestManifests.swift is hand-edited
AGENTS.md captures: project layout, build/test commands, code
conventions (async/actor/Sendable, VIZCodable contracts, JSON
snake_case, raw-Data no-length-prefix), the Linux manifest
hand-edit workflow, the 5 grep-discoverable known quirks with
source locations, and commit style.

CLAUDE.md is a one-line pointer to AGENTS.md so Claude Code
picks up the same guidance.

Also gitignores .claude/settings.local.json (user-local).
IntegrationTests hit https://node.viz.cx and fail when chain state
drifts from fixtures (block heights, balances). The unit suite is
the load-bearing contract; integration tests can be run manually
or in a scheduled job later.

This is the open question flagged in
docs/superpowers/specs/2026-05-16-test-coverage-and-safe-fixes-design.md
under 'CI: filter the badge workflow to --filter UnitTests'.
@chiliec
chiliec merged commit 84cd0b3 into master May 16, 2026
1 check passed
@chiliec
chiliec deleted the test-coverage-expansion branch May 16, 2026 11:12
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