feat(solana): core::arg_rendering + Marginfi preset; bootstrap-only solana-add-idl skill#375
Conversation
|
Finding from commit 3 (regeneration test): The skill's use std::collections::HashMap;
// ...
let mut programs = HashMap::new();
let mut instructions = HashMap::new();But pub struct SolanaIntegrationConfigData {
pub programs: BTreeMap<&'static str, BTreeMap<&'static str, Vec<&'static str>>>,
}A contributor following the template verbatim would get a type mismatch compile error. The template needs to be updated to |
|
Finding from commit 3 (regeneration test): Step 4 of the skill is stale — Step 4 currently says:
But //! ... Do NOT edit this file — it has no hand-maintained content.
include!(concat!(env!(\OUT_DIR\), \/generated_presets_mod.rs\));
|
|
Finding from commit 3 (regeneration test): skill requires The updated skill prescribes: use crate::core::{
InstructionView, ...
};
// ...
let view = InstructionView::from_context(context);
The skill should document this precondition — either a note at the top ("requires PR #367 / the |
|
Comparison: generated vs prior neutral_trade and onre_app implementation (template gap fix) Finding that triggered this commit: the generated template was missing Fix applied:
After fix, the generated expanded view is now consistent with the prior implementations on this point, while still being strictly better on: OnceLock caching, recursive push_arg_fields, BTreeMap for named_accounts, Remaining Account N handling, and InstructionView pattern. |
…y-name subtitle in neutral_trade and onre_app Code review (PR #375) identified that regenerated neutral_trade and onre_app silently regressed from the display-name subtitle to an empty string, because the dflow_aggregator template (which always had an empty subtitle) was used verbatim. Fix: add subtitle as a gathered input in Step 1 (defaulting to display_name), template it in Step 3, and restore "Neutral Trade" / "Onre App" in the affected presets. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…p; expand skill required-tests list Code review (PR #375) identified that neutral_trade and onre_app were missing the six rendering tests present in dflow_aggregator. Backfill push_arg_fields (scalars, arrays, objects, empty collections), build_named_accounts_surfaces_extra_accounts, and remaining_account_label_is_human_readable into both presets. Also update SKILL.md: expand required-tests list to include all ten tests, add field_label_value and serde_json/IdlSource imports to the prescribed test helpers, and document the build_named_accounts signature with argument order. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Validates and updates the solana-add-idl scaffolding skill by regenerating multiple Solana IDL-based presets to match the newer InstructionView::from_context() pattern (graceful handling for v0 + ALT / unresolved accounts), plus aligning config generation and test-helper conventions.
Changes:
- Regenerated
onre_app,neutral_trade, anddflow_aggregatorpreset implementations to useInstructionView, IDL caching viaOnceLock,BTreeMapnamed accounts, anddummy_account_stringstest helpers. - Improved expanded/fallback field rendering consistency (e.g., ensuring expanded views include a human-readable
Programfield). - Updated
.claude/skills/solana-add-idl/SKILL.mdto document the new patterns (BTreeMap config, no manualpresets/mod.rsregistration, additional tests, etc.).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/chain_parsers/visualsign-solana/src/presets/onre_app/mod.rs |
Regenerated IDL visualizer using InstructionView, cached IDL, fallback rendering, recursive arg field rendering, and expanded “Remaining Account N” support + tests. |
src/chain_parsers/visualsign-solana/src/presets/onre_app/config.rs |
Simplifies config map construction (type inference) while keeping BTreeMap backing. |
src/chain_parsers/visualsign-solana/src/presets/neutral_trade/mod.rs |
Regenerated visualizer and tests in the same InstructionView/fallback/recursive-args pattern. |
src/chain_parsers/visualsign-solana/src/presets/dflow_aggregator/mod.rs |
Small regeneration deltas: formatting, expanded/fallback “Program” field, and test helper conversion to dummy_account_strings. |
.claude/skills/solana-add-idl/SKILL.md |
Updates skill instructions to match current preset patterns (InstructionView, BTreeMap config, no manual module registration, extended required tests). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| **Subtitle field uses `{subtitle_text}`.** In the `preview_layout` construction inside `visualize_tx_commands`, set the subtitle to the value gathered in Step 1: | ||
| ```rust | ||
| subtitle: Some(SignablePayloadFieldTextV2 { | ||
| text: "{subtitle_text}".to_string(), | ||
| }), | ||
| ``` | ||
| If the user provided no subtitle (or said to leave it empty), use `String::new()` instead. |
There was a problem hiding this comment.
Fixed in 76e32a3 — replaced the single "{subtitle_text}".to_string() placeholder with two explicit forms: one showing a custom subtitle as a string literal with .to_string(), and one showing the empty-default case as String::new() directly. This matches what the generated presets actually emit.
Review summaryStacked on: #367 (fix/362-idl-preset-alt-accounts — introduces What this PR doesValidates the Skill changes (SKILL.md)
Generated preset changes vs prior implementationsAll three presets are strictly better than the hand-written versions they replace:
Strengths
|
684ae17 to
41c82e4
Compare
…y-name subtitle in neutral_trade and onre_app Code review (PR #375) identified that regenerated neutral_trade and onre_app silently regressed from the display-name subtitle to an empty string, because the dflow_aggregator template (which always had an empty subtitle) was used verbatim. Fix: add subtitle as a gathered input in Step 1 (defaulting to display_name), template it in Step 3, and restore "Neutral Trade" / "Onre App" in the affected presets. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…p; expand skill required-tests list Code review (PR #375) identified that neutral_trade and onre_app were missing the six rendering tests present in dflow_aggregator. Backfill push_arg_fields (scalars, arrays, objects, empty collections), build_named_accounts_surfaces_extra_accounts, and remaining_account_label_is_human_readable into both presets. Also update SKILL.md: expand required-tests list to include all ten tests, add field_label_value and serde_json/IdlSource imports to the prescribed test helpers, and document the build_named_accounts signature with argument order. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Rebased onto The diff is now just the real change — 5 files: Verified locally against the merged baseline:
Ready for re-review. |
…ly skill Additive only -- no existing preset is modified. Consolidates the solana-add-idl skill work into a single PR. Code: - Add `core::arg_rendering::format_arg_value` (+ charset_safe, bytes_as_hex): a charset-safe, single-field-per-arg renderer (byte arrays -> 0x hex) for IDL-based presets. New presets import it from crate::core; existing presets keep their current renderers untouched. - Add Marginfi IDL-based preset as a live validation of the skill; auto-registered via build.rs. Skill (SKILL.md): - Dispatch scaffolding as a Sonnet subagent (model enforced at the API layer); compare mode dispatches Sonnet + Opus and diffs outputs. - Import format_arg_value from crate::core rather than embedding it. - Bootstrap-only scope: scaffold a NEW preset; never regenerate an existing one. - Subtitle convention (Step 1 + preview_layout emission). - Live-fuzz validation via the surfpool label (Step 3). - "Improving this skill": two non-destructive validation loops -- corpus diff (regenerate to a scratch dir, diff vs committed, fix the skill) and Sonnet-vs-Opus model compare. Neither overwrites a committed preset. Closes #397 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
41c82e4 to
3cc61da
Compare
|
Consolidating the What changed in approach: we're dropping the regenerate-existing-presets validation (the delete+regenerate of dflow/neutral_trade/onre_app) in favor of bootstrap-then-own: the skill scaffolds a new preset and never regenerates an owned one. Net effect here is additive only — Preserved from the prior branch: the regeneration-loop framing you'd added (reframed non-destructive — regenerate to a scratch dir, diff vs committed, fix the skill), plus the subtitle convention and surfpool live-fuzz docs. Added the Sonnet-subagent dispatch + compare mode (closes #397). Follow-up (separate issue, not this PR): neutral_trade + onre_app still use the buggy Tests: 270/270, clippy clean (default + diagnostics). Requesting your review given the merge-approval policy. |
Summary
Single, additive PR consolidating the
solana-add-idlskill work (supersedes #401, closed into this).core::arg_rendering— addsformat_arg_value(+charset_safe,bytes_as_hex): a charset-safe, single-field-per-arg renderer (byte arrays ->0xhex). New presets import it fromcrate::core; existing presets are left untouched.build.rs, as a live validation of the skill.format_arg_valuefromcrate::core; bootstrap-only scope (scaffold a new preset, never regenerate an existing one); subtitle convention; surfpool live-fuzz validation; and an "Improving this skill" section with two non-destructive validation loops (corpus diff + model compare).No existing preset is modified — clean on
main.Test plan
cargo clippy -p visualsign-solana --all-targets -- -D warningscargo clippy -p visualsign-solana --features diagnostics --all-targets -- -D warningscargo test -p visualsign-solana— 270 passedcargo test -p visualsign-solana --features diagnosticssurfpoollabel to run live fuzz CI (incl. Marginfi)Closes #397