Sparklend test authoring skill - #37
Open
tobal-g wants to merge 7 commits into
Open
Conversation
Add .github/workflows/claude-test-authoring.yml: @claude-triggered Claude Code sessions (Fable 5) that write/review SparkLend tests, run the full Foundry suite incl. mainnet-fork tests, and open PRs. Remove the duplicate .opencode skill copy; the .claude skill is canonical. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SparkLend test-authoring skill and Claude workflow
What this adds
.claude/skills/sparklend-testing/for authoring, debugging, and reviewing SparkLend Foundry tests against the protocol revision pinned underlib/.WadRayMathboundary/fuzz coverage through a thin wrapper, and a tree-first BTT suite for recovery from a synthetic stale collateral flag at a non-identity liquidity index.@claudecomments, runs Claude Code with the skill, and reports results back to the triggering issue or PR.No protocol source, dependency metadata, global Foundry configuration, or submodule pin changes relative to
origin/master.Tests included
test/fuzz/WadRayMath.t.solandtest/fuzz/wrappers/WadRayMathWrapper.solcall the pinned core'srayMulandrayDiv, cover deterministic zero, identity, half-up rounding, denominator, and overflow boundaries, and compare bounded fuzz inputs with explicit half-up oracles.test/integration/btt/IndexedCollateralSafety.treespecifies independent failure and recovery leaves around the first mintable scaled amount.test/integration/btt/IndexedCollateralSafety.t.solexecutes the live Pool proxy path from a deliberately constructed stale collateral configuration. It checks the exact named reverts below the boundary, successful resupply at the boundary, subsequent collateral disablement, and complete relevant reserve, token, account, treasury, debt, and cash state before and after each action.Skill contents
SKILL.md: entry point, required reading, core operating rules, and the prohibition on changing the protocol target to make a test pass.references/repository-principles.md: pinned-source hierarchy, suite taxonomy, BTT conventions, proxy/caller/accounting semantics, fixture units, assertion requirements, and non-vacuous fuzz/invariant criteria.references/authoring-workflow.md: the end-to-end procedure from target selection and tree design through literal source tracing, scenario construction, full-state assertions, arithmetic anchoring, inheritance audit, and narrow-to-broad verification.references/anti-patterns.md: concrete failure modes extracted from the SC-1569 history, including green known-bug oracles, gated or vacuous invariants, incomplete liabilities, unproven tolerances, missing deterministic boundaries, and incorrect provenance.references/review-rubric.md: severity-ordered adversarial review criteria, comment review rules, and the merge-readiness gate.Local use
Run Claude Code from the repository root and ask it to use
sparklend-testingfor any task that writes, revises, debugs, or reviews tests. For example:Claude loads
.claude/skills/sparklend-testing/SKILL.md; authoring requires the repository principles and workflow references, while review or revision also requires the anti-patterns and rubric. Initialize submodules, install Foundry, and setMAINNET_RPC_URLwhen fork coverage is required.GitHub workflow use
The workflow must first exist on the default branch. It has no
workflow_dispatchinterface or structured inputs; create either an issue/PR conversation comment (issue_comment) or an inline PR review comment (pull_request_review_comment) whose body contains@claude. Put the test-authoring, revision, or review task in that same comment.The job:
@claude; runs for the same issue/PR share a concurrency group and are not canceled in progress.contents: write,pull-requests: write,issues: write,id-token: write, andactions: read.MAINNET_RPC_URLandETHERSCAN_API_KEYfrom repository secrets.actions/checkout@v4with recursive submodules, depth 1, and persisted credentials. No explicit checkoutrefis configured.forge build, then invokesanthropics/claude-code-action@v1withCLAUDE_CODE_OAUTH_TOKEN, modelclaude-fable-5, and the allowed toolsBash,Edit,Write,Read,Glob,Grep,Task.forge test, report exact commands and counts, and never weaken a failing safety property. Changes worth landing are committed on a new branch and opened as a PR only when the full suite passes; otherwise Claude reports the failures on the triggering issue/PR.Repository operators must configure
CLAUDE_CODE_OAUTH_TOKENand a usableMAINNET_RPC_URLfor the configured full-suite requirement;ETHERSCAN_API_KEYis also passed through for fork setups that resolve it.Methodology and verification
The skill was derived from the repository's existing BTT, fuzz, ACL, fork, fixture, and helper conventions; the pinned
sparklend-v1-coreexecution paths; and an ancestry-aware review of the historical SC-1569 test chain. The two added suites were then derived independently from the pinned math and Pool behavior, implemented with deterministic boundary anchors and live-path state assertions, and reviewed adversarially against the rubric and anti-pattern catalog. Follow-up review tightened comment scope and added explicit comment-quality gates without changing the tested behavior.Current targeted verification passes
forge test --match-contract WadRayMathTests(9/9) andforge test --match-contract IndexedCollateralSafetyTests(4/4). A localforge testrun passed 410 tests and failed onlyStableBorrowTests.setUp()because the available mainnet RPC endpoint returned HTTP 402; the workflow is configured to require a validMAINNET_RPC_URLand must not open a completed PR on that result.git diff --check origin/master...HEADis clean, and the core pin remains8120e495061dc3315f0a86f682f4ca645a418bf7.