sails-gtest
Skill17 starsChanged 7 months agoMITView on GitHub
Use when a builder needs the standard Gear/Vara Sails gtest loop for feature verification, debugging, or regression coverage. Do not use for live-network-only validation, deployment-first workflows, or non-Sails programs.
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Run the Sails-first test loop with generated clients and explicit gtest evidence before any live-node smoke step.
- Very specific: line 23
Write the result to docs/plans/YYYY-MM-DD-<topic>-gtest.md.
- Very specific: line 28
Use generated clients or GtestEnv instead of hand-built payloads where the workspace supports them.
- Very specific: line 31
Use run_to_block when delayed work or timeout behavior spans multiple blocks.
- Very specific: line 56
Do not use green cargo test output without Sails-appropriate assertions as proof.
- Very specific: line 57
Do not start local-node smoke while gtest is still red.
- Distinctive: line 58
Do not skip gas or value reasoning when tests depend on it.
- Distinctive: line 59
Do not decode raw reply or event bytes as a bare business DTO until you have checked whether Sails routing framing is present.
- Very specific: line 60
Use #[sails_type] for test-only types that mirror service types, ensuring encoding/decoding matches on-chain behavior exactly.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Sails Gtest
Goal
Run the Sails-first test loop with generated clients and explicit gtest evidence before any live-node smoke step.
Inputs
../../assets/gtest-report-template.md— report format for gtest results../../references/gtest-cheatsheet.md— quick reference for gtest APIs../../references/gtest-patterns.md— common test patterns../../references/sails-cheatsheet.md— Sails patterns and APIs../../references/sails-gtest-and-local-validation.md— full gtest and validation guide../../references/gear-gas-reservations-and-waitlist.md— gas reasoning for tests../../references/scale-binary-decoding-guide.md— decoding raw reply bytes../../references/sails-syscall-mapping.md—Syscall::*API for gas, message, and execution context
Write the result to docs/plans/YYYY-MM-DD-<topic>-gtest.md.
Expected Loop
- Confirm the implementation target is ready for verification.
- Use generated clients or
GtestEnvinstead of hand-built payloads where the workspace supports them. - If the test must go below generated clients, first decide whether the payload or reply bytes are Sails-routed, plain SCALE, or metadata-driven state output; then apply the raw mental model:
send_bytes*returns aMessageId,run_next_blockreturns theBlockRunResult, and the reply evidence lives in the block result. - Pick the right
BlockRunModeand advance blocks explicitly when replies or deferred effects depend on progression. - Use
run_to_blockwhen delayed work or timeout behavior spans multiple blocks. - Assert behavior, replies, events, or accounting in the test result, not just compilation.
- Record failure mode, fix, and passing command output in the gtest note.
- Route to
../sails-local-smoke/SKILL.mdonly after the suite is green.
Common Pitfalls
- Rust 2024 listener lifetime: Under edition 2024 capture rules, chaining generated-client calls into
listen()can fail with "temporary value dropped while borrowed". In Sails 1.0 the service client implementsListenerdirectly, so bind the service client before listening:let client = program.service_name(); let mut events = client.listen().await.unwrap(); - Program balance accounting in gtest: The deployed program account has an existential deposit. Absolute balance assertions like
== wageror== 0will fail even when the contract accounting logic is correct. Capture the initial balance after deploy and assert deltas relative to that baseline:let initial_balance = env.balance_of(program_id); // ... perform actions ... let final_balance = env.balance_of(program_id); assert_eq!(final_balance - initial_balance, expected_delta); - Missing block advancement: Forgetting to call
run_next_blockafter sending a message means the reply is never processed. Always advance at least one block after send operations that expect replies.
Guardrails
- Do not use green
cargo testoutput without Sails-appropriate assertions as proof. - Do not start local-node smoke while
gtestis still red. - Do not skip gas or value reasoning when tests depend on it.
- Do not decode raw reply or event bytes as a bare business DTO until you have checked whether Sails routing framing is present.
- Use
#[sails_type]for test-only types that mirror service types, ensuring encoding/decoding matches on-chain behavior exactly.
In this repository27 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- vara-skillsSkill
- vara-skillsSkill
- awesome-sails-vftSkill
- gear-architecture-plannerSkill
- gear-builtin-actorsSkill
- gear-gstd-api-mapSkill
- gear-message-executionSkill
- gtest-tdd-loopSkill
- idea-to-specSkill
- sails-architectureSkill
- sails-dev-envSkill
- sails-ethexe-architectureSkill
- sails-ethexe-implementerSkill
- sails-feature-workflowSkill
- sails-frontendSkill
- sails-idl-clientSkill
- sails-indexerSkill
- sails-local-smokeSkill
- sails-new-appSkill
- sails-program-evolutionSkill
- sails-rust-implementerSkill
- ship-sails-appSkill
- task-decomposerSkill
- vara-skills-upgradeSkill
- vara-walletSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

