Repository navigation
Conversation
✅ Deploy Preview for genlayer-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 51 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
|
Legatus audit: Changes requested (commit 0c05bd7)
Validation: snippet lint passed; all 171 E2E tests passed in a Playwright container. Worktree removed. Nothing pushed or merged. LEGATUS-TICKET |
|
Legatus audit: Approved (commit dbb51d3) No blocking findings. The previous label-validation issue is fixed, with regression coverage for invalid labels, malformed responses, and validator disagreement. Validation passed: snippet linting, all five regression tests, additional malformed-response checks, and all 171 E2E tests. Audit worktree removed; nothing pushed or merged. |
|
/run-e2e all |
|
Legatus audit: Approved (commit dbb51d3) No blocking findings. The head and diff are unchanged from the previously approved revision. Fresh validation passed: snippet linting, all five regression tests, and all 171 E2E tests. Worktree removed; nothing pushed or merged. |
|
/run-e2e all |
|
Legatus audit: Approved (commit dbb51d3) No blocking findings. Verified the remote head and full diff are unchanged. Previous results for this exact commit remain valid: snippet linting, five regression tests, and 171 E2E tests passed. Tests were not rerun this turn. Audit worktree removed; nothing pushed or merged. |
|
/run-e2e all |
Add a Code Snippets page with complete, explained contracts for the factory pattern, passing web content to an LLM, and reading from and writing to another contract. Fix the deploy_contract example that used salt= instead of salt_nonce=, and link the new page from the Interacting with Intelligent Contracts page. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The PageClassifier snippet claimed its output was constrained to four labels but accepted any value on which leader and validators agreed. The leader now rejects malformed or off-list LLM responses with gl.vm.UserError, and the validator rejects off-list leader values. Add scripts/test-snippets.py, which executes the snippet from the MDX against a mocked genlayer module, with regression cases for off-list, malformed and disagreeing labels. lint-code-examples.py runs it, so the existing Lint Code Examples CI job covers it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
dbb51d3 to
664b134
Compare
|
Legatus audit: Approved (commit 664b134) No blocking findings. The rebase preserves the reviewed snippets and validation fix. Lint, regression tests, and export tests passed. E2E: 171 passed, one unrelated intermittent failure; all 13 Studio tests passed on retry. Worktree removed; nothing merged. LEGATUS-TICKET |
|
/run-e2e all |
Resolves DXP-346.
What changed
New page
pages/developers/intelligent-contracts/examples/snippets.mdx("Code Snippets", first entry under Examples). It has four complete contracts, each followed by a "How it works" walkthrough:MarketFactorydeploysMarketchildren withgl.deploy_contract(deterministicsalt_nonce,args,on=) and keeps a registry.PageClassifierfetches a page, prompts the LLM withresponse_format="json", and reaches consensus withgl.vm.run_nondet_unsafeand a validator function. The leader rejects malformed or off-list labels withgl.vm.UserError, and the validator rejects off-list leader values. Includes a prompt-injection warning.@gl.contract_interface) and untyped (gl.get_contract_at).view()calls..emit(on="finalized" | "accepted"), with notes on why nothing is returned, idempotency, payable calls andsender_address.Fix in
features/interacting-with-intelligent-contracts.mdx: thedeploy_contractexample passedsalt=, but the SDK parameter issalt_nonce=. The page now also links to the new snippets page.Regression tests in
scripts/test-snippets.py. They extractPageClassifierfrom the MDX and run it against a mockedgenlayermodule. Cases: a valid label is stored;{"label": "hacked"}is rejected even when the leader and validators agree; the validator rejects an off-list leader value; malformed responses ({}, a list,nulllabel) are rejected; disagreeing labels are rejected.scripts/lint-code-examples.pyruns these tests, so the existing Lint Code Examples CI job covers them.How it was tested
python scripts/test-snippets.py: 5/5 pass. Against the previous version of the snippet, 3 of the 5 fail, includinghackedbeing stored.python scripts/lint-code-examples.py(the CI "Lint Code Examples" job): all checks pass, including the 4 new contracts.genvm-lint checkon each new contract against the pinned runnerpy-genlayer:1jb45aa8…: lint and SDK validation pass. I also checked thedeploy_contract,emitandexec_prompt(response_format=...)signatures against that SDK's source.node scripts/generate-full-docs.js,node scripts/check-llm-exports.js,npm run check:protocol-docs: OK.next buildcompiles and produces/developers/intelligent-contracts/examples/snippets.tests/docs.e2e.spec.tsfor the new page, the edited page and a control page: 3 passed; after the review fix, all 171 passed. These ran locally with a Nix-provided Chromium because the bundled browser can't start on this host.Assumptions
gl.*API names (gl.deploy_contract,gl.get_contract_at) as the rest of the docs, not the newer runner.run_nondet_unsafe) that compares a constrained label, which follows the Equivalence Principle page's recommendation. It links to the non-comparative approach for free-text output.lint-code-examples.pyrather than as their own workflow step, because the push token here can't modify.github/workflows. As a result, a PR that changes onlyscripts/test-snippets.pywon't trigger the job. Any change to an MDX page or tolint-code-examples.pywill."other", so bad output is never stored silently.salt_noncefix and the new link.🤖 Generated with Claude Code