Skip to content

api: generated CLI and schema snapshot with api_test (part of #13178) - #13276

Merged
TrapsterDK merged 1 commit into
mainfrom
api-snapshot-13178
Nov 17, 2026
Merged

TrapsterDK merged 1 commit into
mainfrom
api-snapshot-13178

Conversation

@TrapsterDK

Copy link
Copy Markdown
Collaborator

Part of #13178.

Adds the first two files of the public API snapshot and the test that holds code to it.

  • bazel run //tools/api:update writes api/cli.json (every dx command and subcommand: flags, aliases, accepted values, defaults, exit codes, from help_surface()) and api/schemas.txt (version from SCHEMA_MAJOR/SCHEMA_MINOR and CURRENT_SCHEMA_VERSION, plus the sha256 of events.schema.json and dx.schema.json).
  • //tools/api:api_test re-renders and fails when api/ is stale. A schema digest change with an unchanged version fails both the test and update.
  • HelpFlag now carries values and defaults (switches report neither).
  • api/ is added to the root layout list (docs/design/layout.md, root_layout_test).

Remaining for #13178:

  • Spike: does starlark_doc_extract resolve upstream repos? The repo has no bzl_library targets yet, so this needs those first.
  • api/starlark.json (load paths, symbols, macro signatures, rule attrs, providers, tag classes; aspect for **kwargs macros).
  • api/labels.txt (public non-.bzl labels, hub use_repo names from lang.json).
  • cli.json: env vars and positional args; then retire the help goldens (cli/cli/tests/fixtures/help_goldens).

Tests run locally:

  • bazel test //tools/api:api_test //tools/testing:root_layout_test //cli/plan:dx_plan_test: pass. Hand-editing api/cli.json makes api_test fail as intended.
  • //tools/ci:command_docs_test fails the same way on main (audit-update.md unknown-flag --type/--upgrade, stale allowlist lines); this PR does not touch those docs.
  • tools/dx lint on the new Rust files: clean. tools/dx check --affected stopped at generate on untouched packages (erlang/tests/conformance/lock, deploy/private/release/tests).
  • No nested-Bazel or consumer tests were run locally.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hvgPbKqbuDgsTasg7K

`bazel run //tools/api:update` writes api/cli.json (every command's
flags, aliases, accepted values, defaults and exit codes, from
help_surface()) and api/schemas.txt (version plus sha256 of the events
and dx.toml schemas). //tools/api:api_test fails when code and snapshot
differ, and both refuse a schema digest change without a version bump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xut2hvgPbKqbuDgsTasg7K
@TrapsterDK
TrapsterDK merged commit c957405 into main Nov 17, 2026
1 check failed
@TrapsterDK
TrapsterDK deleted the api-snapshot-13178 branch November 17, 2026 22:58
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