Skip to content

feat(db): add example values to all protobuf schemas#23

Open
cooper (czxtm) wants to merge 1 commit intomainfrom
claude/frosty-moore-bc08a0
Open

feat(db): add example values to all protobuf schemas#23
cooper (czxtm) wants to merge 1 commit intomainfrom
claude/frosty-moore-bc08a0

Conversation

@czxtm
Copy link
Copy Markdown
Contributor

Summary

  • Adds example values to every field across the 18 protobuf schemas that were missing them (apps, aws, config, databases, deployment, extensions, files, healthchecks, modules, onboarding, scripts, secrets, services, shells, sst, step-ca, tasks, variables).
  • Plumbs examples through the existing buf-gen pipeline: proto.nix now appends (example: ...) to each field's proto comment, with strings JSON-escaped so embedded quotes/newlines don't break proto3 syntax. protobuf-ts carries those comments through to TypeScript JSDoc, so the studio (and any consumer of the generated .d.ts) gets examples for free — no separate fixtures pipeline.
  • Adds apps/web/scripts/demo-smoke.ts — a standalone Bun smoke test that drives the studio's MSW-backed demo agent directly and verifies /health, /api/state, /api/nix/data?entity=apps, and /api/process-compose/processes return the expected fixture data.

Why

The studio panels and forms benefit from realistic placeholder values, and the protonix schema is the natural place to author them once and have them flow to TS, Go, and JSON Schema outputs together. Threading them through the existing .proto comment path means we don't introduce a new generation pipeline or proto extension — buf generate already preserves comments as JSDoc.

Reviewer notes

  • The apps/stackpanel-go/internal/agent/server/connect_entities_gen.go diff is a reordering of generated handler methods (it falls out of buf generate after the proto regeneration) and contains no semantic changes.
  • The pre-existing theme.proto.nix schema already used the new proto.mkField-style example = ...; the new schemas use the legacy positional API via proto.withExample since most schemas in the codebase use that style. Both APIs converge in proto.mkField and produce identical proto output.
  • Example values are not part of the proto wire format and only show up in comments; no changes to message shapes or field numbers.

Test plan

  • bash packages/proto/generate.sh proto — all 26 protos regenerate cleanly, (example: ...) annotations present
  • buf generate (in packages/proto/) — succeeds, examples flow into packages/proto/gen/ts/*_pb.d.ts JSDoc
  • bun apps/web/scripts/demo-smoke.ts — 11/11 assertions pass against the demo agent's MSW handlers
  • Visual smoke test of /demo route in the studio (manual)

🤖 Generated with Claude Code

Adds `example` annotations to every field across the 18 schemas that
were missing them (apps, aws, config, databases, deployment, extensions,
files, healthchecks, modules, onboarding, scripts, secrets, services,
shells, sst, step-ca, tasks, variables) so the studio can surface
realistic placeholders and downstream tooling has a single source of
truth for sample values.

Threads examples through the existing buf-gen pipeline by appending
`(example: ...)` to each field's proto comment in `proto.nix`'s renderer.
String examples are JSON-escaped so embedded quotes/newlines (INI
fragments, JSON snippets) don't break proto3 syntax. `protobuf-ts`
preserves these comments, so the generated TypeScript .d.ts files now
carry examples as JSDoc — visible in the studio without a separate
fixtures pipeline.

Verified end to end:
- `packages/proto/generate.sh proto` regenerates all 26 .proto files
  cleanly with `(example: ...)` annotations
- `buf generate` succeeds; examples surface in
  `packages/proto/gen/ts/*_pb.d.ts` JSDoc
- `bun apps/web/scripts/demo-smoke.ts` exercises the demo agent's MSW
  handlers and confirms `/health`, `/api/state`,
  `/api/nix/data?entity=apps`, and `/api/process-compose/processes`
  return the expected fixture data (11/11 assertions pass)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 30, 2026

PR Summary

Medium Risk
Mostly comment/metadata plumbing, but it touches code generation outputs and adds/reshuffles agent RPC handlers, so mismatches between generated clients/servers or entity names could cause runtime integration issues.

Overview
Adds field-level example annotations across the Nix-defined protobuf schemas and updates proto.nix rendering to append (example: ...) to field comments with proper escaping so examples flow through generated artifacts.

Regenerates Go protobuf bindings to include these examples in doc comments (and adds a new optional description field accessor on EnvironmentVariable), and adds apps/web/scripts/demo-smoke.ts, a Bun script that exercises the demo agent MSW handlers for key endpoints. The connect_entities_gen.go changes are generated method reordering plus new Get/SetSecrets and Get/SetAws handlers in the expected entity map.

Reviewed by Cursor Bugbot for commit e055f9c. Configure here.

@github-actions
Copy link
Copy Markdown

Preview deployed to pr-23https://pr-23.stackpanel.com

@github-actions
Copy link
Copy Markdown

Docs preview deployed to pr-23

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue. You can view the agent here.

Reviewed by Cursor Bugbot for commit e055f9c. Configure here.

// the variable is missing.
//
// (example: "Postgres connection string used by the API server")
Description *string `protobuf:"bytes,7,opt,name=description,proto3,oneof" json:"description,omitempty"`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Undocumented protobuf message shape change in EnvironmentVariable

Medium Severity

The proto regeneration adds a new Description field (proto field 7, oneOf index 3) to the EnvironmentVariable Go struct and raw descriptor. The old generated code only had fields 1–6; now field 7 is materialized with a new GetDescription() accessor and an updated rawDesc. This is a real protobuf wire-format and JSON-serialization change — not just a comment update — despite the PR description explicitly claiming "no changes to message shapes or field numbers." Consumers deserializing EnvironmentVariable will now see a description key in JSON output when set, which could break snapshot tests or downstream expectations.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit e055f9c. Configure here.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Bugbot Autofix determined this is a false positive.

Comparing this branch to its base shows no diff in packages/proto/gen/gopb/apps.pb.go, and EnvironmentVariable.description already exists in both, so this PR does not introduce the reported message-shape change.

You can send follow-ups to the cloud agent here.

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