Skip to content

Add plan rendering to tmplrmgr writes (ENG-506)#523

Open
peer2f00l wants to merge 5 commits into
devfrom
feature/eng-506-add-print-jsonsputnik-to-render-a-tmplrmgr-write-as-a-plan
Open

Add plan rendering to tmplrmgr writes (ENG-506)#523
peer2f00l wants to merge 5 commits into
devfrom
feature/eng-506-add-print-jsonsputnik-to-render-a-tmplrmgr-write-as-a-plan

Conversation

@peer2f00l

@peer2f00l peer2f00l commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add plan-only --print json|sputnik support to every tmplrmgr write carrying SignerArgs
  • parse and redact typed signing credentials at the clap boundary while preserving normal execution
  • render single-transaction JSON plans and paste-ready Sputnik FunctionCall proposal kinds without submitting transactions
  • reject unsupported multi-step orchestration and non-FunctionCall Sputnik plans before partial output
  • support explicit or suppressed signer full-access keys for plan-only deploy/create commands

Verification

  • cargo test -p templar-manager — 141 passed
  • cargo fmt --all --check
  • cargo clippy -p templar-manager --all-targets -- -D warnings
  • Sputnik acceptance smoke test against an unreachable RPC endpoint
  • JSON generic-write, oracle-plan, deploy-key, credential-conflict, and orchestration rejection smoke tests
  • zero-finding adversarial review after fixes

Linear: https://linear.app/templar-protocol/issue/ENG-506/add-print-jsonsputnik-to-render-a-tmplrmgr-write-as-a-plan


This change is Reviewable

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f8f2e54a-d26e-4fc7-bc7f-21d12bb10379

📥 Commits

Reviewing files that changed from the base of the PR and between 274b292 and 41f4aaa.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • Cargo.toml
  • tools/manager/Cargo.toml
  • tools/manager/src/commands/proxy_oracle/governance/create_proposal.rs
  • tools/manager/src/commands/proxy_oracle/governance/execute_proposal.rs
  • tools/manager/src/commands/registry/remove_version.rs
  • tools/manager/src/context.rs
  • tools/manager/src/dispatch/proposals.rs
  • tools/manager/src/tests.rs
  • tools/manager/src/tests/proxy_oracle.rs
  • tools/manager/src/tests/registry.rs

📝 Walkthrough

Summary

  • Added --print json|sputnik plan-only output for write commands without submitting transactions.
  • Added typed, redacted signer parsing with support for explicit or suppressed signer full-access keys.
  • Added JSON transaction plans and Sputnik FunctionCall proposals, rejecting multi-step or unsupported plans before output.
  • Added CLI validation for incompatible print, credential, orchestration, and --all options.
  • Added sputnikdao2 dependency and removed the obsolete governance alias.

Validation

  • 141 templar-manager tests passed.
  • Formatting, Clippy, Sputnik acceptance, JSON smoke, and orchestration rejection checks passed.
  • Adversarial review reported no findings.

Human review focus

  • Verify signer credential handling never exposes secrets and that plan mode cannot resolve or submit credentials.
  • Review single-transaction and FunctionCall restrictions for completeness across all write paths.
  • Confirm full-access-key behavior for explicit keys and --no-signer-full-access-key.

Walkthrough

The manager CLI now supports print-only transaction planning with JSON or Sputnik output, typed secret-key parsing, mode-aware signer credentials, lazy signer public-key resolution, and validation for incompatible print and execution options.

Changes

Manager write planning

Layer / File(s) Summary
Signer parsing and credential contracts
tools/manager/src/commands/signer.rs, tools/manager/src/tests.rs, tools/manager/src/dispatch/teardown.rs
Signer arguments distinguish print mode from execution credentials, parse secret keys through clap, and expose mode-aware credential APIs with updated validation tests.
Lazy full-access-key and deployment resolution
tools/manager/src/commands/full_access_key.rs, tools/manager/src/commands/deploy_common.rs, tools/manager/src/commands/{market,proxy_oracle,redstone,registry}/*, tools/manager/src/tests/registry.rs
Full-access-key and deployment builders defer signer public-key resolution, propagate failures, and test explicit and suppressed signer keys.
Plan creation and output rendering
Cargo.toml, tools/manager/Cargo.toml, tools/manager/src/context.rs
Write and oracle-write paths create unsigned plans in print mode and render JSON or Sputnik FunctionCall proposals with transaction and action validation.
Proposal orchestration and command validation
tools/manager/src/dispatch/proposals.rs, tools/manager/src/commands/proxy_oracle/governance/*, tools/manager/src/commands/registry/remove_version.rs, tools/manager/src/tests/{proxy_oracle,registry}.rs
Proposal creation routes print requests before credential resolution, while readiness, removal, and governance command combinations receive clap conflict validation and coverage.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant SignerArgs
  participant CliContext
  participant OperationPlan
  participant Printer
  CLI->>SignerArgs: parse print mode and optional public key
  SignerArgs-->>CliContext: expose print format
  CliContext->>OperationPlan: create unsigned write plan
  OperationPlan-->>CliContext: return planned transaction
  CliContext->>Printer: render JSON or Sputnik proposal
  Printer-->>CLI: output plan
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/eng-506-add-print-jsonsputnik-to-render-a-tmplrmgr-write-as-a-plan

Warning

Review ran into problems

🔥 Problems

Errors were encountered while retrieving linked issues.

Errors (1)
  • LINEAR integration encountered authorization issues. Please disconnect and reconnect the integration in the CodeRabbit UI.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tools/manager/src/commands/signer.rs (1)

1-104: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Solid plan/execution credential split; consider modeling the exclusivity as a type instead of scattered runtime checks.

secret(), public_key(), and (indirectly) resolve() each re-check self.print.is_some() to enforce that plan mode and execution credentials are mutually exclusive. Clap's conflicts_with/requires already guarantee this at the CLI boundary, so the runtime checks are redundant safety nets scattered across three methods. A Credentials enum (Execution(SecretKey) | Plan { format: PrintFormat, public_key: Option<PublicKey> }) constructed once after clap parsing would encode the invariant in the type itself and remove the duplicated if self.print.is_some() branches.

As per path instructions: "Prefer designs where protocol states, request/response payloads, persisted records, state-machine transitions, permissions, identifiers, and bounded values are represented with concrete Rust types rather than loosely constrained primitives, maps, strings, booleans, or serde_json::Value... Flag code that permits invalid combinations and relies on scattered runtime checks when the invariant could reasonably be encoded with: enums for mutually exclusive states or variants..."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tools/manager/src/commands/signer.rs` around lines 1 - 104, Refactor
SignerArgs to construct a Credentials enum after Clap parsing, with distinct
Execution and Plan variants carrying their valid data. Update secret(),
public_key(), and resolve() to match on this typed state instead of
independently checking print.is_some(), while preserving the existing CLI
validation and error behavior. Remove the redundant scattered runtime
exclusivity checks once the invariant is encoded by Credentials.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@tools/manager/src/commands/signer.rs`:
- Around line 1-104: Refactor SignerArgs to construct a Credentials enum after
Clap parsing, with distinct Execution and Plan variants carrying their valid
data. Update secret(), public_key(), and resolve() to match on this typed state
instead of independently checking print.is_some(), while preserving the existing
CLI validation and error behavior. Remove the redundant scattered runtime
exclusivity checks once the invariant is encoded by Credentials.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 7b0b5116-42c1-48ab-81f3-798d9a528c93

📥 Commits

Reviewing files that changed from the base of the PR and between 9386a6f and 274b292.

📒 Files selected for processing (15)
  • tools/manager/src/commands/deploy_common.rs
  • tools/manager/src/commands/full_access_key.rs
  • tools/manager/src/commands/market/create.rs
  • tools/manager/src/commands/proxy_oracle/create.rs
  • tools/manager/src/commands/proxy_oracle/governance/create.rs
  • tools/manager/src/commands/proxy_oracle/mod.rs
  • tools/manager/src/commands/redstone/create.rs
  • tools/manager/src/commands/registry/deploy.rs
  • tools/manager/src/commands/signer.rs
  • tools/manager/src/context.rs
  • tools/manager/src/dispatch/proposals.rs
  • tools/manager/src/dispatch/teardown.rs
  • tools/manager/src/tests.rs
  • tools/manager/src/tests/proxy_oracle.rs
  • tools/manager/src/tests/registry.rs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant