Skip to content

Expose notebooks as a chronoctl entity - #127

Draft
crob611 wants to merge 1 commit into
mainfrom
notebooks-chronoctl-entity
Draft

Expose notebooks as a chronoctl entity#127
crob611 wants to merge 1 commit into
mainfrom
notebooks-chronoctl-entity

Conversation

@crob611

@crob611 crob611 commented Aug 5, 2026

Copy link
Copy Markdown

Summary

Notebooks are already served by the unstable config API but had no CLI surface, so they could not be managed declaratively alongside the other config entities. This adds notebooks to the UNSTABLE_ENTITIES allowlist in the Makefile and checks in the regenerated output.

The Makefile line is the only hand-written change; src/generated/cli/configunstable/notebooks.gen.go and the two hunks in cli.gen.go are make gen-cli output. Regeneration is idempotent, so make test-gen stays clean.

No extra wiring was needed for apply: the generated init() calls types.MustRegisterObject(NotebookTypeMeta, &Notebook{}), and the generated ApplyMappings() entry upserts via UpdateNotebook(..., UpdateOptions{CreateIfMissing: true}).

Command surface

Worth calling out, since it differs from how this is sometimes described: unstable entities are registered under the hidden unstable root command (src/cmd/pkg/unstable/root.go), and this repo has no get/delete <slug> top-level verbs. Notebooks land exactly where the other five unstable entities do:

chronoctl unstable notebooks {create,read,update,delete,list,scaffold}

chronoctl apply -f notebook.yaml works from the top level as usual.

Testing

  • make gen-cli re-run — output identical, working tree unchanged (satisfies the test-gen CI check)
  • go test ./src/... — pass, 17 packages
  • golangci-lint run -D gosec — clean
  • go mod tidy — no-op
  • Binary builds; unstable notebooks --help lists all six subcommands; scaffold emits the expected YAML
  • apply -f on a notebook YAML decodes the object and issues PUT /api/unstable/config/notebooks/{slug}

Not run: a round trip against a real test tenant. Local verification reached the network boundary with the correct upsert request but no tenant was available in this environment. Worth a quick manual apply + read before relying on this.

🤖 Generated with Claude Code

Notebooks are already served by the unstable config API but had no CLI
surface, so they could not be managed declaratively alongside the other
config entities. Adding `notebooks` to the generator's UNSTABLE_ENTITIES
allowlist gives them the same treatment as dashboards and link templates.

The only hand-written change is the Makefile line; everything else is the
output of `make gen-cli`. The generated init() registers the Notebook type
into types.Registry and the generated ApplyMappings entry does an upsert
with CreateIfMissing, so `apply` round-trips a Notebook YAML object with no
additional wiring.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@crob611
crob611 requested a review from a team as a code owner August 5, 2026 16:02
@crob611
crob611 marked this pull request as draft August 5, 2026 16:02
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