sails-gtest
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.
What this skill does
# 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 1. Confirm the implementation target is ready for verification. 2. Use generated clients or `GtestEnv` instead of hand-built payloads where the workspace supports them. 3. 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 a `MessageId`, `run_next_block` returns the `BlockRunResult`, and the reply evidence lives in the block result. 4. Pick the right `BlockRunMode` and advance blocks explicitly when replies or deferred effects depend on progression. 5. Use `run_to_block` when delayed work or timeout behavior spans multiple blocks. 6. Assert behavior, replies, events, or accounting in the test result, not just compilation. 7. Record failure mode, fix, and passing command output in the gtest note. 8. Route to `../sails-local-smoke/SKILL.md` only 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 implements `Listener` directly, so bind the service client before listening: ```rust 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 `== wager` or `== 0` will fail even when the contract accounting logic is correct. Capture the initial balance after deploy and assert deltas relative to that baseline: ```rust 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_block` after 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 test` output without Sails-appropriate assertions as proof. - Do not start local-node smoke while `gtest` is 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.
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.