Add rehearsal metadata browser sandbox#139
Conversation
There was a problem hiding this comment.
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.
|
@coderabbitai review |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThis 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. ChangesLocal deployment-rehearsal metadata browser execution
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
scripts/test_rehearsal_metadata_browser_sandbox.py (2)
99-185: 💤 Low valueConsider adding test case for empty tokenDataRaw.
The test coverage is solid, but an explicit test for empty
tokenDataRawwould 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 winAdd assertion message for clearer debugging.
If the module spec or loader is None, the assertion will raise a generic
AssertionErrorwithout 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
📒 Files selected for processing (20)
.github/workflows/ci.ymlCHANGELOG.mdMakefiledocs/deployment.mddocs/known-blockers.mddocs/metadata.mddocs/status.mdops/AUTONOMOUS_RUN.mdops/ROADMAP.mdrelease-artifacts/latest/SHA256SUMSrelease-artifacts/latest/release-checksums.jsonrelease-artifacts/latest/release-manifest.jsonscript/README.mdscript/RehearseMetadataBrowser.s.solscripts/check.ps1scripts/check.shscripts/check_metadata_browser_sandbox.pyscripts/check_rehearsal_metadata_browser_sandbox.pyscripts/test_rehearsal_metadata_browser_sandbox.pytest/README.md
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
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.scripts/check_rehearsal_metadata_browser_sandbox.pyplus focused unit coverage to decode the Forge ABI return payload and execute the generated final animation through the existing Playwright/Chromium sandbox policy.Closes #135.
Local Validation
forge buildforge fmt script/RehearseMetadataBrowser.s.solpython -m py_compile scripts\check_metadata_browser_sandbox.py scripts\check_rehearsal_metadata_browser_sandbox.py scripts\test_rehearsal_metadata_browser_sandbox.pypython scripts\test_rehearsal_metadata_browser_sandbox.py.venv-tools\Scripts\python.exe scripts\check_rehearsal_metadata_browser_sandbox.pymake metadata-fixtures-checkpython scripts\test_release_manifest.pypython scripts\generate_release_manifest.py --checkpython scripts\test_release_checksums.pypython scripts\generate_release_checksums.py --checkpython scripts\check_changelog.pymake checkbash -n scripts/check.sh scripts/bootstrap-ec2.shscripts/check.ps1andscripts/bootstrap-windows.ps1git diff --checkgit diff --cached --checkSummary by CodeRabbit
New Features
Tests
Documentation
Chores