Skip to content

Add rehearsal metadata browser sandbox#139

Merged
punk6529 merged 3 commits into
mainfrom
codex/live-fork-metadata-browser
Jun 12, 2026
Merged

Add rehearsal metadata browser sandbox#139
punk6529 merged 3 commits into
mainfrom
codex/live-fork-metadata-browser

Conversation

@punk6529

@punk6529 punk6529 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds script/RehearseMetadataBrowser.s.sol, a local Anvil deployment rehearsal that deploys the stack, registers a deterministic metadata dependency, mints through the EIP-712 drop authorization path, finalizes token metadata inputs, and returns generated on-chain metadata evidence.
  • Adds scripts/check_rehearsal_metadata_browser_sandbox.py plus focused unit coverage to decode the Forge ABI return payload and execute the generated final animation through the existing Playwright/Chromium sandbox policy.
  • Wires the rehearsal browser check into Makefile, Windows/Unix check wrappers, and CI, then updates metadata/deployment/status docs, roadmap/run-state, changelog, and generated release manifest/checksum evidence.

Closes #135.

Local Validation

  • forge build
  • forge fmt script/RehearseMetadataBrowser.s.sol
  • python -m py_compile scripts\check_metadata_browser_sandbox.py scripts\check_rehearsal_metadata_browser_sandbox.py scripts\test_rehearsal_metadata_browser_sandbox.py
  • python scripts\test_rehearsal_metadata_browser_sandbox.py
  • .venv-tools\Scripts\python.exe scripts\check_rehearsal_metadata_browser_sandbox.py
  • make metadata-fixtures-check
  • python scripts\test_release_manifest.py
  • python scripts\generate_release_manifest.py --check
  • python scripts\test_release_checksums.py
  • python scripts\generate_release_checksums.py --check
  • python scripts\check_changelog.py
  • make check
  • bash -n scripts/check.sh scripts/bootstrap-ec2.sh
  • PowerShell parser checks for scripts/check.ps1 and scripts/bootstrap-windows.ps1
  • git diff --check
  • git diff --cached --check

Summary by CodeRabbit

  • New Features

    • Added a local deployment rehearsal that mints and validates generated metadata via a Chromium sandbox.
  • Tests

    • Added rehearsal-specific browser-sandbox validation and unit tests; integrated them into verification targets and CI checks.
  • Documentation

    • Updated deployment, metadata, status, roadmap, and testing docs to describe the local rehearsal and evidence expectations.
  • Chores

    • Updated release artifacts and checksums to reflect the documentation and manifest updates.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b03d418d-eef5-4989-aa27-159000b4feed

📥 Commits

Reviewing files that changed from the base of the PR and between f00f598 and 13f9045.

📒 Files selected for processing (3)
  • ops/AUTONOMOUS_RUN.md
  • scripts/check_rehearsal_metadata_browser_sandbox.py
  • scripts/test_rehearsal_metadata_browser_sandbox.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • scripts/test_rehearsal_metadata_browser_sandbox.py
  • scripts/check_rehearsal_metadata_browser_sandbox.py

📝 Walkthrough

Walkthrough

This PR implements local deployment-rehearsal metadata browser validation by combining a Foundry Solidity rehearsal script that performs deploy/mint/finalize and returns on-chain evidence with a Python checker that decodes the ABI return, validates the evidence envelope, loads the produced tokenURI, and executes the generated animation in a Chromium sandbox; CI, Makefile, tests, docs, and release checksums are updated accordingly.

Changes

Local deployment-rehearsal metadata browser execution

Layer / File(s) Summary
Solidity rehearsal script and VM interface
script/RehearseMetadataBrowser.s.sol
MetadataScriptVm VM interface; MetadataRehearsalRandomizer sets token hashes; RehearseMetadataBrowser.run() deploys local stack, registers randomizer, builds/signs a DropAuthorization, mints with deterministic TOKEN_DATA, finalizes metadata inputs, and returns MetadataBrowserResult (including tokenUri).
Python checker and ABI decoding
scripts/check_rehearsal_metadata_browser_sandbox.py
Resolves forge, runs the rehearsal script with JSON capture, parses Forge stdout records, ABI-decodes the returned payload with bounds/UTF-8 checks, validates evidence fields (including evidenceKind and external script URL), loads the fixture from the on-chain tokenUri, runs the Chromium sandbox (--timeout-ms, --headed), and validates bootstrap/sandbox results.
Animation loading refactor
scripts/check_metadata_browser_sandbox.py
Adds load_animation_from_token_uri(token_uri: str, *, label: str) helper to centralize JSON data-URI decoding/loading for both committed fixtures and rehearsal-generated tokenURIs.
Python checker unit tests
scripts/test_rehearsal_metadata_browser_sandbox.py
Dynamic import of the checker module, ABI-encoding helpers to synthesize Forge-style return payloads (including wrapped form), and unit tests covering return decoding, noisy stdout parsing, evidence validation, tokenData parsing, and expected bootstrap construction.
Build system and CI integration
.github/workflows/ci.yml, Makefile, scripts/check.sh, scripts/check.ps1
CI hygiene step syntax-checks new rehearsal scripts; metadata-fixture-safety stage runs rehearsal test and check with separate logs; Makefile metadata-fixtures-check invokes rehearsal test/check; scripts/check.sh and check.ps1 run the new test and check scripts.
Documentation and CHANGELOG updates
CHANGELOG.md, docs/deployment.md, docs/metadata.md, docs/status.md, docs/known-blockers.md, script/README.md, test/README.md
Adds changelog entry for the local rehearsal gate; documents how to run the local rehearsal and check scripts; updates metadata/status/known-blockers/roadmap to reflect local rehearsal coverage and remaining fork/testnet/live production evidence requirements.
Operational state tracking
ops/AUTONOMOUS_RUN.md, ops/ROADMAP.md
Adds Queue Item #72 worklog and decision entries recording PR #139 state, validation outcomes, and roadmap adjustments referencing local rehearsal coverage.
Release artifact checksums
release-artifacts/latest/SHA256SUMS, release-artifacts/latest/release-checksums.json, release-artifacts/latest/release-manifest.json
Updates SHA256 digests and size_bytes for modified documentation artifacts across checksum/manifest files.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🐰 I hopped to run a little test,
Foundry, Python, Chromium in jest;
I minted, parsed, sandboxed with care,
The tokenUri danced in browser air—
Rehearsal passed, the logs attest.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding a rehearsal metadata browser sandbox capability.
Linked Issues check ✅ Passed The PR comprehensively addresses #135's requirements: adds local rehearsal metadata browser execution via RehearseMetadataBrowser.s.sol, implements Chromium sandbox validation with check_rehearsal_metadata_browser_sandbox.py reusing existing Playwright policy, wires checks into CI/Makefile, and updates docs to distinguish committed-fixture from live/fork/rehearsal evidence.
Out of Scope Changes check ✅ Passed All changes are in-scope: core implementation (Solidity/Python scripts, CI/Makefile), documentation updates (deployment/status/metadata guides, roadmap, blockers), and release artifacts reflecting documentation changes. No unrelated modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/live-fork-metadata-browser

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
scripts/test_rehearsal_metadata_browser_sandbox.py (2)

99-185: 💤 Low value

Consider adding test case for empty tokenDataRaw.

The test coverage is solid, but an explicit test for empty tokenDataRaw would make the edge case handling more visible. The implementation (context snippet 2) handles empty strings by returning an empty tuple, but this behavior isn't directly tested.

💡 Optional test addition
def test_parse_empty_token_data(self) -> None:
    """Empty tokenDataRaw maps to empty tuple."""
    
    self.assertEqual(rehearsal_checker.parse_token_data(""), ())
    self.assertEqual(rehearsal_checker.parse_token_data("  "), ())
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/test_rehearsal_metadata_browser_sandbox.py` around lines 99 - 185,
Add a unit test in the RehearsalMetadataBrowserTests class to cover the empty
tokenDataRaw edge case: create a method named test_parse_empty_token_data that
calls rehearsal_checker.parse_token_data with "" and with a whitespace-only
string and asserts both return an empty tuple (); this ensures
parse_token_data's empty-string handling is explicitly tested.

17-17: ⚡ Quick win

Add assertion message for clearer debugging.

If the module spec or loader is None, the assertion will raise a generic AssertionError without explaining which component failed or why. Adding a message helps developers quickly diagnose module loading issues.

📝 Suggested improvement
-assert SPEC is not None and SPEC.loader is not None
+assert SPEC is not None and SPEC.loader is not None, (
+    f"Failed to load module spec from {SCRIPT_PATH}"
+)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/test_rehearsal_metadata_browser_sandbox.py` at line 17, The assertion
`assert SPEC is not None and SPEC.loader is not None` should include a
descriptive message to aid debugging; update it to assert with a clear message
(or separate assertions) that states whether `SPEC` is None or `SPEC.loader` is
None and include their repr/values for context so
test_rehearsal_metadata_browser_sandbox.py surfaces which component failed
(reference: SPEC and SPEC.loader).
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/check_rehearsal_metadata_browser_sandbox.py`:
- Around line 71-79: The current run_forge_rehearsal() treats completed.stdout
as a single JSON document and calls json.loads(completed.stdout), which fails if
forge emits logs or multiple JSON records; change the parsing to scan
completed.stdout for individual JSON objects/lines (e.g., splitlines and attempt
json.loads on each line or use a regex/stream parser to extract JSON blobs),
collect/merge parsed objects, and then locate the record that contains the ABI
"returned" field (or aggregate records) rather than assuming a single top-level
object; update references to completed.stdout and the code that accesses the
"returned" data to use the parsed list/merged object.

---

Nitpick comments:
In `@scripts/test_rehearsal_metadata_browser_sandbox.py`:
- Around line 99-185: Add a unit test in the RehearsalMetadataBrowserTests class
to cover the empty tokenDataRaw edge case: create a method named
test_parse_empty_token_data that calls rehearsal_checker.parse_token_data with
"" and with a whitespace-only string and asserts both return an empty tuple ();
this ensures parse_token_data's empty-string handling is explicitly tested.
- Line 17: The assertion `assert SPEC is not None and SPEC.loader is not None`
should include a descriptive message to aid debugging; update it to assert with
a clear message (or separate assertions) that states whether `SPEC` is None or
`SPEC.loader` is None and include their repr/values for context so
test_rehearsal_metadata_browser_sandbox.py surfaces which component failed
(reference: SPEC and SPEC.loader).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 4d97939b-8e61-4352-a526-55d2a89f791a

📥 Commits

Reviewing files that changed from the base of the PR and between 9510a0f and f00f598.

📒 Files selected for processing (20)
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • Makefile
  • docs/deployment.md
  • docs/known-blockers.md
  • docs/metadata.md
  • docs/status.md
  • ops/AUTONOMOUS_RUN.md
  • ops/ROADMAP.md
  • release-artifacts/latest/SHA256SUMS
  • release-artifacts/latest/release-checksums.json
  • release-artifacts/latest/release-manifest.json
  • script/README.md
  • script/RehearseMetadataBrowser.s.sol
  • scripts/check.ps1
  • scripts/check.sh
  • scripts/check_metadata_browser_sandbox.py
  • scripts/check_rehearsal_metadata_browser_sandbox.py
  • scripts/test_rehearsal_metadata_browser_sandbox.py
  • test/README.md

Comment thread scripts/check_rehearsal_metadata_browser_sandbox.py

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@punk6529 punk6529 merged commit e09e422 into main Jun 12, 2026
2 checks passed
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.

Add live/fork metadata browser execution coverage

1 participant