feat(studio): read-from-view-function config-call arg kind (#147) - #149
Merged
Conversation
Wires @redeploy/config's ReadArg (merged in PR #146) into the studio's config-call argument editors, so a user can pass a value read from a deployed contract's view/pure function (e.g. token.decimals()) as an argument to another config call, alongside the existing literal and address-ref arg kinds. - manifest: add getViewFunctions(name), mirroring getStateChangingFunctions but filtered to view/pure functions, for the read-source function picker. - spec/types.ts: add StudioReadRef ({ kind: "read", contract, function, args? }) to the StudioConfigArg union, mirroring ReadArg's shape 1:1. - ConfigPanel.tsx, ContractNode.tsx, OrderedConfigPanel.tsx: add a "read" option to each arg-kind toggle; selecting it lets the author pick a source contract from the existing deployTargets list and a view/pure function on it via getViewFunctions. Defaults to the first deploy target and its first view function. v1 keeps it simple (no nested-arg editor for the view call's own args) but the type carries an optional `args` field for a future editor. - graph-to-spec.ts: extend normalizeStudioArg to pass StudioReadRef through to ReadArg unchanged (contract/function pass straight through; any own args are normalized via a new normalizeReadCallArg, ref/literal only, no nested reads — matching ReadCallArg's restriction). - Tests: getViewFunctions unit tests (manifest.test.ts); read-arg rendering and interaction tests in all three editors (ConfigPanel.test.tsx, config-panel-ordered.test.tsx); graph-to-spec read normalization tests (config-panel-ordered.test.tsx), including own-arg normalization and validateConfig round-trip. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
… tests (#147) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
robercano
approved these changes
Jul 20, 2026
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.
Closes #147
Summary
Follow-up to #140 / PR #146 (which added the
readconfig-call arg kind to@redeploy/config). This wires thatreadarg kind into the Studio config-call argument editor: a user can now pass a value read from a deployed contract's view/pure function as an argument to another config call. Module:studio only — no changes outsideapps/studio/.What changed (all under
apps/studio/)src/manifest/index.ts— newgetViewFunctions(name)helper (filters ABI bystateMutability === "view" | "pure", mirrorsgetStateChangingFunctions: dedup-by-signature, manifest order).src/spec/types.ts— newStudioReadRefvariant in theStudioConfigArgunion (source contract deployId, function name, optional nested ref/literal args).src/spec/graph-to-spec.ts—normalizeStudioArgemits{ kind: "read", contract, function, args? }matching@redeploy/config'sReadArgexactly (omits emptyargs, never nests a read;argsrestricted to ref/literal).src/components/{ConfigPanel,ContractNode,OrderedConfigPanel}.tsx— added areadoption to the arg-kind toggle in all three arg editors, reusing the existingdeployTargetsdeployId picker for the source contract andgetViewFunctionsfor the view-function picker.src/hooks/useGraph.ts—stepReferencesDeployIdnow also tracks references made through areadarg (itscontractand nested addressRef call-args) so deleting a source-contract node prunes the referencing config step (prevents exporting a spec with a danglingread.contract).Tests (vitest + RTL,
apps/studio/test/)getViewFunctionsunit tests (view/pure inclusion, exclusion of state-changing, no-argdecimals(), dedup via a forced-collision fixture, declared order, partition vsgetStateChangingFunctions).readtoggle rendering; source-contract + view-function pickers; default-first selection; switching source contract re-picks the new contract's first view function (asserted full emitted arg); empty "— no view functions —" fallback.graph-to-specemits a validreadConfigArg (no-arg, ordered-step, own ref/literal args, mixed arrays, exact key shape) with avalidateSpec+validateConfiground-trip.useGraphnode-deletion pruning for read-arg references (unit + integration).Gates
Studio module gates via
.claude/scripts/gate.sh/pnpm -F @redeploy/studio: build, typecheck, lint, test (1142/1142), coverage all pass. Studio coverage 97.04% stmts / 88.64% branch; every touched file >80% (DoD threshold).Review
Routed through all four review lenses (
.claude/gates.json, consensus "all"): correctness, tests, security, performance — all APPROVE (correctness + tests approved after a fix pass that added read-arg reference tracking on node delete and strengthened the read-arg assertions/coverage).🤖 Generated with Claude Code