Skip to content

local init --json: report all created paths - #617

Open
sdairs wants to merge 2 commits into
fix/607-prometheus-json-helpfrom
fix/609-local-init-json-paths
Open

local init --json: report all created paths#617
sdairs wants to merge 2 commits into
fix/607-prometheus-json-helpfrom
fix/609-local-init-json-paths

Conversation

@sdairs

@sdairs sdairs commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • local init --json previously reported only {"path": ".clickhouse/"}, omitting the clickhouse/ and postgres/ scaffold subtrees that the human-readable output already reports (e.g. Created project scaffold in clickhouse/ (tables, materialized_views, queries, seed)).
  • init() now returns an InitResult indicating which of .clickhouse/, clickhouse/, and postgres/ were actually created during the invocation.
  • InitOutput now exposes paths: Vec<String> (replacing the single path: String field) listing .clickhouse/ always, plus clickhouse/ and/or postgres/ only when their scaffold was newly created this run — matching the conditional human-readable messages exactly.
  • Human Display output for InitOutput also grew a line per newly-created scaffold, so local init (non-JSON) now reports scaffold creation via the same output type, not just via eprintln! inside init().

This PR is part of a stacked chain based on fix/607-prometheus-json-help (not main).

Test plan

  • cargo fmt --all --check
  • cargo clippy -p clickhousectl --all-targets -- -D warnings
  • cargo test -p clickhousectl (all passing, including new tests/local_init_json_test.rs subprocess coverage for first-run vs. idempotent-run JSON payloads, and updated inline unit tests in src/init.rs / src/local/output.rs)

Fixes #609

🤖 Generated with Claude Code

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 416867f. Configure here.

Comment thread crates/clickhousectl/src/local/output.rs
@sdairs sdairs linked an issue Aug 28, 2026 that may be closed by this pull request
@sdairs
sdairs force-pushed the fix/609-local-init-json-paths branch from 83d45b0 to d30c70e Compare August 28, 2026 19:41
sdairs and others added 2 commits September 1, 2026 21:24
`local init --json` only reported `{"path": ".clickhouse/"}`, omitting the
`clickhouse/` and `postgres/` scaffold subtrees that human output already
reports. `init()` now returns which paths it actually created, and
`InitOutput` reports the full set as `paths: Vec<String>`, listing
`.clickhouse/` plus `clickhouse/`/`postgres/` only when their scaffolds were
newly created (matching the conditional human-readable messages).

Added subprocess coverage (crates/clickhousectl/tests/local_init_json_test.rs)
for the first-run and idempotent-run JSON payloads, plus updated inline unit
tests in src/init.rs and src/local/output.rs.

Fixes #609.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The install-integration classifier fails closed on unclassified test
files; local_init_json_test.rs only scaffolds directories in a temp
project and never installs a binary, so it maps to the non-install set
(mirrored in the classifier test's literal copy).

Human-mode `local init` printed every created path twice: init() eprinted
detailed absolute-path lines while print_output repeated them on stdout
via InitOutput's Display. init() is now silent and InitOutput is the
single source of human output, including the "Already initialized"
wording for idempotent runs, carried by a serde-skipped field so the
--json payload introduced for #609 is unchanged. Subprocess tests pin
first-run and second-run human output.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@sdairs
sdairs force-pushed the fix/609-local-init-json-paths branch from d30c70e to b81e59c Compare September 1, 2026 20:36
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.

local init --json omits the scaffold directories it created

1 participant