Skip to content

fix(protocol): unify Actor serial validation - #403

Merged
alinejun merged 2 commits into
mainfrom
claude/issue-399-actor-serial
Nov 9, 2026
Merged

alinejun merged 2 commits into
mainfrom
claude/issue-399-actor-serial

Conversation

@alinejun

@alinejun alinejun commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • centralize Actor serial parsing on one canonical rule: 0 or lowercase hexadecimal without leading zeros, up to 2^54 - 1
  • enforce the same rule in ActrUri and ActrId, so every accepted Actor URI can be converted to an ActrId
  • publish shared valid and invalid Actor URI/ActorId serial vectors in contracts/actr/test-vectors/actor-uri-serial.json, consumed directly by the Rust assertions
  • store hexadecimal serials and exact decimal expectations as strings, including the 54-bit maximum and a value above JavaScript's safe integer range
  • document the canonical grammar and shared fixture in the English and Chinese URI specifications and the contracts README

Fixes #399.

Validation

  • cargo fmt
  • cargo fmt --all --check
  • cargo clippy --fix --lib --bins --all-targets --allow-dirty -p actr-protocol --all-features --locked
  • cargo test -p actr-protocol --all-features --locked --quiet: 107 passed, 0 failed; 4 documentation tests remain ignored
  • Shared fixture: 5 valid and 8 invalid cases; JSON syntax and exact string-valued serial expectations verified
  • git diff --check
  • Verified the existing test(protocol): add shared Actr URI vectors #406 changes still apply cleanly

@kaito-harry kaito-harry left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shared parser and both URI specs agree on the canonical 54-bit serial. GitHub CI Gate passed, and an isolated actr-protocol --all-features run passed 107 tests. The shared URI test vectors required by #399 are the remaining acceptance item.

Comment thread crates/actr-protocol/src/uri.rs Resolved
Move canonical and rejected Actor URI/ActorId serial cases into a shared JSON fixture consumed by the Rust assertions. Keep exact decimal expectations as strings and cover a value above JavaScript's safe integer range.

Constraint: Keep exact serial values as JSON strings
Confidence: high
Scope-risk: narrow
@alinejun
alinejun requested a review from kaito-harry November 9, 2026 09:41

@kaito-harry kaito-harry left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The shared fixture required by #399 is in place, and the Rust URI and ActorId assertions consume all 13 cases. I verified the exact serial values with Node BigInt, including the values above JavaScript’s safe integer limit, and reran the isolated actr-protocol suite with all features. All 107 tests passed. GitHub CI Gate is still running.

@alinejun
alinejun merged commit 1dd15c8 into main Nov 9, 2026
35 checks passed
@alinejun
alinejun deleted the claude/issue-399-actor-serial branch November 9, 2026 10:00
alinejun added a commit that referenced this pull request Nov 10, 2026
## Summary

- add language-neutral `actr://` parsing and normalization vectors under
`contracts/actr/test-vectors/uri.json`
- exercise the real `ActrUri` parser, normalized output, public fields,
stable error codes, normalization idempotence, ActorId conversion, and
local-installation checks
- document the fixture and its Cargo integration-test command
- encode Unicode inputs with JSON escapes so the fixture passes the
language policy while preserving all 49 decoded vectors

Canonical Actor serial validation and its dedicated boundary fixture are
already on `main` via #403. This PR adds the broader URI conformance
fixture.

Fixes #401.

## Validation

- `cargo fmt`
- `cargo fmt --all --check`
- `cargo clippy --fix --lib --bins --all-targets --allow-dirty -p
actr-protocol --all-features --locked`
- `cargo test -p actr-protocol --all-features --locked --quiet`: **109
passed, 0 failed**; 4 documentation tests remain ignored
- `python3 .github/scripts/check_cjk.py`: **clean**
- `python3 -I -m json.tool contracts/actr/test-vectors/uri.json`
- `cargo test -p actr-protocol --test uri --all-features --locked
--quiet`: **2 passed**, covering all 49 URI vectors
- Verified the escaped fixture decodes to exactly the same JSON values
as before
- URI integration coverage: **2 tests**, consuming **10 valid and 39
invalid vectors**
- `git diff --check`

## Baseline CI blocker

[Dependency
Audit](https://github.com/Actrium/actrium/actions/runs/42598835869/job/129098104927)
reports `RUSTSEC-2026-0459` for `libsqlite3-sys 0.30.1`. `Cargo.toml`
and `Cargo.lock` are byte-identical to `main` at
`1dd15c89fef6feaa46806311dbe45b00808e9eb9`.

The advisory requires `libsqlite3-sys >=0.39.0`, while both `rusqlite
0.32.1` and `sqlx-sqlite 0.8.6` depend on the 0.30.1 line. Resolving
this baseline failure requires a coordinated database dependency update.
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.

bug(actr-protocol): align Actor serial validation between ActrUri and ActrId

2 participants