Skip to content

Add preview mock support for secrets RPCs#3071

Open
Copilot wants to merge 2 commits intomainfrom
copilot/add-rpcs-to-mockwaveenv
Open

Add preview mock support for secrets RPCs#3071
Copilot wants to merge 2 commits intomainfrom
copilot/add-rpcs-to-mockwaveenv

Conversation

Copy link
Contributor

Copilot AI commented Mar 15, 2026

The preview mock WaveEnv was missing the secrets RPC surface used by config/secrets flows. This adds mock implementations for the four secrets commands so preview and test environments can exercise secrets behavior without a backend.

  • Added mock secrets RPC handlers

    • Implemented GetSecretsLinuxStorageBackendCommand
    • Implemented GetSecretsNamesCommand
    • Implemented GetSecretsCommand
    • Implemented SetSecretsCommand
  • Backed secrets RPCs with in-memory state

    • Added a per-env in-memory secret store inside makeMockRpc
    • SetSecretsCommand now supports both upsert and delete (null => remove)
    • GetSecretsNamesCommand returns sorted secret names for stable behavior
    • GetSecretsCommand returns only requested keys that exist
    • GetSecretsLinuxStorageBackendCommand returns "libsecret" on Linux previews and "" elsewhere
  • Kept the change scoped to preview/mock behavior

    • Wired platform into the mock RPC layer without changing production RPC behavior
    • Updated the mock environment contract comments to reflect the newly supported RPCs
  • Added focused coverage

    • Extended frontend/preview/mock/mockwaveenv.test.ts to cover set/get/list/delete semantics and Linux backend reporting
const env = makeMockWaveEnv({ platform: "linux" });

await env.rpc.SetSecretsCommand(null as any, {
    OPENAI_API_KEY: "sk-test",
    ANTHROPIC_API_KEY: "anthropic-test",
} as any);

const names = await env.rpc.GetSecretsNamesCommand(null as any);
// ["ANTHROPIC_API_KEY", "OPENAI_API_KEY"]

const secret = await env.rpc.GetSecretsCommand(null as any, ["OPENAI_API_KEY"]);
// { OPENAI_API_KEY: "sk-test" }

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

Co-authored-by: sawka <2722291+sawka@users.noreply.github.com>
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Mar 15, 2026

Deploying waveterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: b05b0f6
Status: ✅  Deploy successful!
Preview URL: https://9d5b68bf.waveterm.pages.dev
Branch Preview URL: https://copilot-add-rpcs-to-mockwave.waveterm.pages.dev

View logs

Copilot AI changed the title [WIP] Add RPCs to mockwaveenv.ts Add preview mock support for secrets RPCs Mar 15, 2026
Copilot AI requested a review from sawka March 15, 2026 21:54
@sawka sawka marked this pull request as ready for review March 15, 2026 22:02
@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Mar 15, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • frontend/preview/mock/mockwaveenv.ts - Adds mock implementations for secrets-related RPC commands (getsecrets, setsecrets, getsecretsnames, getsecretslinuxstoragebackend)
  • frontend/preview/mock/mockwaveenv.test.ts - Adds test coverage for secrets commands with in-memory storage

The changes implement mock versions of the secrets-related RPC commands for the preview/test environment. The implementation:

  • Correctly handles setting, getting, and deleting secrets via null values
  • Returns "libsecret" for Linux platform and empty string otherwise
  • Returns sorted secret names
  • Includes proper null coalescing for input parameters
  • Follows existing patterns in the mockwaveenv.ts file

No issues found.

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.

2 participants