Skip to content

Externally managed tables config#3459

Draft
callicles wants to merge 5 commits intomainfrom
nico/eng-2039-create-externally-managed-tables-in-local-dev
Draft

Externally managed tables config#3459
callicles wants to merge 5 commits intomainfrom
nico/eng-2039-create-externally-managed-tables-in-local-dev

Conversation

@callicles
Copy link
Collaborator

No description provided.

@linear
Copy link

linear bot commented Feb 5, 2026

@vercel
Copy link

vercel bot commented Feb 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs-v2 Ready Ready Preview, Comment Feb 7, 2026 0:49am

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nico/eng-2039-create-externally-managed-tables-in-local-dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@callicles callicles changed the title config Externally managed tables config Feb 5, 2026
@callicles callicles force-pushed the nico/eng-2039-create-externally-managed-tables-in-local-dev branch from a8bfe70 to b5f9d20 Compare February 5, 2026 21:04
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 11

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/framework-cli/src/utilities/constants.rs (1)

118-146: ⚠️ Potential issue | 🟡 Minor

Add rustdoc for new public constants (and the updated prompt).
Public API constants should use /// docs; the current line comment won’t appear in rustdoc.

Proposed fix
-// Keychain keys for remote ClickHouse credentials (separate from URL)
+/// Keychain key for remote ClickHouse username (separate from URL).
 pub const KEY_REMOTE_CLICKHOUSE_USER: &str = "remote_clickhouse_user";
-// Keychain keys for remote ClickHouse credentials (separate from URL)
+/// Keychain key for remote ClickHouse password (separate from URL).
 pub const KEY_REMOTE_CLICKHOUSE_PASSWORD: &str = "remote_clickhouse_password";

+/// Prompt shown when remote ClickHouse credentials are required for dev mirroring.
 pub const STORE_CRED_PROMPT: &str = r#"You have externally managed tables in your code base.

As per coding guidelines "Document all public APIs and breaking changes".

🤖 Fix all issues with AI agents
In `@apps/framework-cli/src/cli/routines/mod.rs`:
- Around line 618-621: The parse_clickhouse_connection_string(remote_url).ok()
call swallows parsing errors and causes silent fallback; change this to handle
the Result explicitly (match or map_err) so parsing failures are logged or
warned before proceeding. Locate parse_clickhouse_connection_string and the
creation of remote_ch (used by ClickHouseRemote::from_config and
create_external_mirrors) and, on Err(e), emit a clear warning or error including
remote_url and e (using the existing logger), then pass None or bail depending
on desired behavior; ensure the log message mentions remote_url, the parse
error, and that local schema creation will be used if you keep the fallback.
- Around line 498-512: The PR adds a new config flag
project.dev.externally_managed.tables.create_local_mirrors but the dev
environment docs lack any mention; update the dev-environment.mdx reference to
document the [dev.externally_managed.tables] table and the create_local_mirrors
boolean: describe what setting create_local_mirrors = true does (creates local
mirrors for externally managed tables in dev), list default/behavior when false,
and include a short example TOML snippet showing the config and a brief note on
when to toggle it; ensure the section mentions the config key exactly as
project.dev.externally_managed.tables.create_local_mirrors so readers can map
docs to the code.

In `@apps/framework-cli/src/cli/routines/seed_data.rs`:
- Around line 792-894: The code duplicates the "check exists, optionally
drop-if-refresh" logic between create_external_tables_from_local_schema and
create_single_mirror; extract a helper (e.g., ensure_table_absent_or_skipped)
that accepts (&ClickHouseClient, &str db, &str table_name, bool
refresh_on_startup) and returns a Result<enum {Skipped, Ready}, String> (or
Result<bool, String> where true=ready) so both functions call it instead of
repeating local_client.table_exists, local_client.drop_table_if_exists and
pushing format_warning/format_error; update
create_external_tables_from_local_schema and create_single_mirror to call this
helper, handle the Skipped/Ready result, and keep existing calls to
format_warning/format_error/format_success unchanged.

In `@apps/framework-cli/src/framework/core/infrastructure_map.rs`:
- Around line 2971-2982: get_mirrorable_external_tables currently returns values
from a HashMap which is non-deterministic; collect the filtered Table references
into a Vec, sort that Vec by a stable key (e.g., Table::name or a stable id
field) using a deterministic comparator (lexicographic on name or numeric on
id), then return the sorted Vec so mirror creation/logs are reproducible; update
get_mirrorable_external_tables to perform the collect -> sort -> return sequence
while still filtering by life_cycle == LifeCycle::ExternallyManaged and
engine.supports_select().

In `@apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs`:
- Around line 295-298: The SELECT query builder uses remote_database directly in
format!("SELECT * FROM `{}`.`{}` LIMIT 0", remote_database, table_name) without
validation; add the same identifier validation/sanitization used for
local_database and table_name (e.g., the validate_identifier or
sanitize_identifier helper used elsewhere) to verify or escape remote_database
before interpolation, and return an error if it contains invalid characters so
the constructed query is safe and consistent with the checks on
local_database/table_name.
- Around line 340-343: The call building select_query in insert_from_remote uses
remote_database without validation; add the same validation used elsewhere to
check remote_database (e.g., non-empty and matches the allowed identifier
pattern) before constructing select_query and return an error if invalid; update
the insert_from_remote function to validate remote_database (and reuse any
helper or regex used for table_name validation) so select_query =
format!("SELECT * FROM `{}`.`{}` LIMIT {}", remote_database, table_name, limit)
only runs with a sanitized/validated remote_database.

In `@apps/framework-cli/src/infrastructure/olap/clickhouse/config_resolver.rs`:
- Around line 1-14: Add unit tests for the public resolver behavior: write tests
exercising resolve_remote_clickhouse (or the public function that resolves
config) using ClickHouseRemote/RemoteClickHouseConfig inputs to cover (1) when
no config exists (defaults applied), (2) when config exists and is used, (3)
rejection of empty passwords (simulate prompt_password/KeyringSecretRepository
returning empty and assert failure), and (4) port defaulting logic (when
protocol is Protocol::Http vs ClickHouseProtocol ensure port defaults match
expected values). Mock or stub SecretRepository/KeyringSecretRepository and
prompt_user/prompt_password to control inputs and assertions.
- Around line 108-139: store_credentials currently can leave the username saved
if storing the password fails; update store_credentials to perform a rollback on
partial success: after repo.store(project_name, KEY_REMOTE_CLICKHOUSE_USER,
user) succeeds but repo.store(...KEY_REMOTE_CLICKHOUSE_PASSWORD...) returns Err,
call the repository deletion method (e.g., repo.delete or repo.remove) to remove
KEY_REMOTE_CLICKHOUSE_USER for that project, map any errors to RoutineFailure
similarly, and then return the original error; reference the function
store_credentials and the constants KEY_REMOTE_CLICKHOUSE_USER /
KEY_REMOTE_CLICKHOUSE_PASSWORD and the repo.store call to locate where to add
the rollback.

In `@apps/framework-cli/src/project.rs`:
- Around line 271-276: Add a Rust doc comment for the public field `tables` on
the `DevExternallyManagedTablesConfig` struct: describe that it holds the
configuration for externally managed tables used in development mode, note that
it defaults via serde (#[serde(default)]), and mention the contained type
`DevExternallyManagedConfig` so users know what configuration is expected and
how it is used.
- Around line 288-307: Update the doc comment on the
RemoteClickHouseConfig::port field to clarify that the numeric defaults are not
set on the struct but are applied later during resolution in config_resolver.rs;
specifically change the comment to something like "Optional port; resolved to
8443 for SSL or 8123 for non-SSL during config resolution" so readers know the
defaults are applied by the config resolver rather than by the struct itself.
- Around line 310-321: DevConfig exposes two user-facing options that are
undocumented: externally_managed and remote_clickhouse; update the
dev-environment documentation to add entries for dev.externally_managed (explain
it maps to DevConfig.externally_managed / DevExternallyManagedTablesConfig, what
it controls, default behavior and an example of enabling externally managed
tables) and dev.remote_clickhouse (explain it maps to
DevConfig.remote_clickhouse / RemoteClickHouseConfig, describe that it is an
optional read-only ClickHouse connection, what credentials are expected to be
provided externally, defaults, and an example config snippet). Ensure both
entries mention types, defaults, and short examples so users know how to set
them in their config.
📜 Review details

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 6f4eab1 and dd00c42.

📒 Files selected for processing (11)
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/cli/routines/seed_data.rs
  • apps/framework-cli/src/framework/core/infra_reality_checker.rs
  • apps/framework-cli/src/framework/core/infrastructure_map.rs
  • apps/framework-cli/src/framework/core/plan.rs
  • apps/framework-cli/src/framework/core/plan_validator.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/config_resolver.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/mod.rs
  • apps/framework-cli/src/project.rs
  • apps/framework-cli/src/utilities/constants.rs
🧰 Additional context used
📓 Path-based instructions (4)
**/*.rs

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Run cargo clippy to ensure Rust code passes Clippy's linting standards before each commit

**/*.rs: Use thiserror with #[derive(thiserror::Error)] for error handling in Rust; define errors near the fallibility unit, never use anyhow::Result
Use snake_case for functions and variables, PascalCase for types and traits, SCREAMING_SNAKE_CASE for constants in Rust
Place constants in constants.rs at the appropriate module level in Rust
Use tuple structs with validation constructors (newtypes) for Rust type safety (e.g., struct UserId(String))
Write inline tests with #[cfg(test)] modules in Rust
Documentation is required for all public APIs in Rust
Run cargo clippy --all-targets -- -D warnings before committing Rust code; no warnings allowed

Files:

  • apps/framework-cli/src/infrastructure/olap/clickhouse/mod.rs
  • apps/framework-cli/src/framework/core/infra_reality_checker.rs
  • apps/framework-cli/src/framework/core/plan_validator.rs
  • apps/framework-cli/src/utilities/constants.rs
  • apps/framework-cli/src/cli/routines/seed_data.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/config_resolver.rs
  • apps/framework-cli/src/framework/core/infrastructure_map.rs
  • apps/framework-cli/src/framework/core/plan.rs
  • apps/framework-cli/src/project.rs
apps/framework-cli/**/*.rs

📄 CodeRabbit inference engine (apps/framework-cli/AGENTS.md)

apps/framework-cli/**/*.rs: Always run cargo clippy --all-targets -- -D warnings before commits; fix all warnings - no Clippy warnings may remain (treat warnings as errors)
Use rustfmt --edition 2021 for consistent formatting
Write meaningful names for functions, variables, and types
Document all public APIs and breaking changes
Use thiserror crate instead of anyhow::Result for error handling
Define errors near their unit of fallibility (no global Error types)
Use #[derive(thiserror::Error)] with #[error()] messages for error definitions
Define newtypes as tuple structs: struct UserId(u64);
Add validation constructors for newtypes: UserId::new(id: u64) -> Result<Self, Error>
Derive standard traits for newtypes: #[derive(Debug, Clone, PartialEq)]
Implement From/TryFrom for newtype conversions
Use derive_more or nutype to reduce newtype boilerplate
Use const for static values (prefer over static)
Use UPPER_SNAKE_CASE naming for constants
Scope constant visibility with preference: pub(crate) > pub(super) > pub
Group related constants together
Write unit tests for all public functions
Test error conditions and edge cases

Files:

  • apps/framework-cli/src/infrastructure/olap/clickhouse/mod.rs
  • apps/framework-cli/src/framework/core/infra_reality_checker.rs
  • apps/framework-cli/src/framework/core/plan_validator.rs
  • apps/framework-cli/src/utilities/constants.rs
  • apps/framework-cli/src/cli/routines/seed_data.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/config_resolver.rs
  • apps/framework-cli/src/framework/core/infrastructure_map.rs
  • apps/framework-cli/src/framework/core/plan.rs
  • apps/framework-cli/src/project.rs
**/framework-cli/src/**

⚙️ CodeRabbit configuration file

**/framework-cli/src/**: When reviewing changes to Moose CLI:

  1. Check if any user-facing changes were made (commands, flags, configs, apis, etc)
  2. If yes, verify the documentation for THAT SPECIFIC feature is updated in apps/framework-docs-v2/content
  3. If docs for that feature doesn't exist yet, it should be added. If the change removes public apis, the documentation for those should also be removed. Changing unrelated docs doesn't satisfy this requirement.
  4. In addition to reviewing for docs discrepancies, you should also review the code as per usual guidelines.

Files:

  • apps/framework-cli/src/infrastructure/olap/clickhouse/mod.rs
  • apps/framework-cli/src/framework/core/infra_reality_checker.rs
  • apps/framework-cli/src/framework/core/plan_validator.rs
  • apps/framework-cli/src/utilities/constants.rs
  • apps/framework-cli/src/cli/routines/seed_data.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/config_resolver.rs
  • apps/framework-cli/src/framework/core/infrastructure_map.rs
  • apps/framework-cli/src/framework/core/plan.rs
  • apps/framework-cli/src/project.rs
apps/framework-cli/**/constants.rs

📄 CodeRabbit inference engine (apps/framework-cli/AGENTS.md)

Place constants in constants.rs at deepest common module level

Files:

  • apps/framework-cli/src/utilities/constants.rs
🧠 Learnings (9)
📓 Common learnings
Learnt from: callicles
Repo: 514-labs/moosestack PR: 3143
File: apps/framework-cli/src/cli/routines/seed_data.rs:614-641
Timestamp: 2025-12-17T23:48:30.295Z
Learning: In apps/framework-cli/src/cli/routines/seed_data.rs, the create_mirror_schema function uses CREATE TABLE ... AS SELECT ... LIMIT 0 to create dev mirrors for EXTERNALLY_MANAGED tables. This intentionally does not preserve column codecs, TTL expressions, or materialized column definitions from the remote table, which is acceptable for local dev-only mirrors where matching column types is sufficient for materialized view sources.
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Document all public APIs and breaking changes

Applied to files:

  • apps/framework-cli/src/infrastructure/olap/clickhouse/mod.rs
  • apps/framework-cli/src/framework/core/infra_reality_checker.rs
  • apps/framework-cli/src/utilities/constants.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs
  • apps/framework-cli/src/framework/core/plan.rs
  • apps/framework-cli/src/project.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/constants.rs : Place constants in `constants.rs` at deepest common module level

Applied to files:

  • apps/framework-cli/src/infrastructure/olap/clickhouse/mod.rs
  • apps/framework-cli/src/utilities/constants.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Test error conditions and edge cases

Applied to files:

  • apps/framework-cli/src/framework/core/infra_reality_checker.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Write unit tests for all public functions

Applied to files:

  • apps/framework-cli/src/framework/core/infra_reality_checker.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Group related constants together

Applied to files:

  • apps/framework-cli/src/utilities/constants.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `const` for static values (prefer over `static`)

Applied to files:

  • apps/framework-cli/src/utilities/constants.rs
📚 Learning: 2025-12-16T23:09:10.917Z
Learnt from: CR
Repo: 514-labs/moosestack PR: 0
File: apps/framework-cli/AGENTS.md:0-0
Timestamp: 2025-12-16T23:09:10.917Z
Learning: Applies to apps/framework-cli/**/*.rs : Use `UPPER_SNAKE_CASE` naming for constants

Applied to files:

  • apps/framework-cli/src/utilities/constants.rs
📚 Learning: 2025-12-17T23:48:30.295Z
Learnt from: callicles
Repo: 514-labs/moosestack PR: 3143
File: apps/framework-cli/src/cli/routines/seed_data.rs:614-641
Timestamp: 2025-12-17T23:48:30.295Z
Learning: In apps/framework-cli/src/cli/routines/seed_data.rs, the create_mirror_schema function uses CREATE TABLE ... AS SELECT ... LIMIT 0 to create dev mirrors for EXTERNALLY_MANAGED tables. This intentionally does not preserve column codecs, TTL expressions, or materialized column definitions from the remote table, which is acceptable for local dev-only mirrors where matching column types is sufficient for materialized view sources.

Applied to files:

  • apps/framework-cli/src/cli/routines/seed_data.rs
  • apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs
  • apps/framework-cli/src/cli/routines/mod.rs
  • apps/framework-cli/src/framework/core/infrastructure_map.rs
  • apps/framework-cli/src/project.rs
🧬 Code graph analysis (4)
apps/framework-cli/src/cli/routines/seed_data.rs (4)
apps/framework-cli/src/cli/display/status.rs (3)
  • format_error (47-49)
  • format_success (25-27)
  • format_warning (36-38)
apps/framework-cli/src/infrastructure/olap/clickhouse/queries.rs (2)
  • table (3331-3336)
  • create_table_query (3019-3430)
apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs (2)
  • config (49-51)
  • new (36-47)
apps/framework-cli/src/infrastructure/olap/clickhouse/mapper.rs (1)
  • std_table_to_clickhouse_table (350-379)
apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs (1)
apps/framework-cli/src/infrastructure/olap/clickhouse/errors.rs (1)
  • validate_clickhouse_identifier (41-63)
apps/framework-cli/src/infrastructure/olap/clickhouse/config_resolver.rs (4)
apps/framework-cli/src/cli.rs (2)
  • prompt_password (131-215)
  • prompt_user (78-126)
apps/framework-cli/src/utilities/validate_passthrough.rs (1)
  • None (515-515)
apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs (1)
  • host (105-107)
apps/framework-cli/src/cli/display/message_display.rs (1)
  • show_message_wrapper (70-82)
apps/framework-cli/src/project.rs (6)
apps/framework-cli/src/framework/core/infrastructure_map.rs (1)
  • default (3576-3594)
packages/py-moose-lib/moose_lib/main.py (1)
  • default (80-83)
apps/framework-cli/src/project/python_project.rs (1)
  • default (66-92)
apps/framework-cli/src/infrastructure/olap/clickhouse/model.rs (1)
  • default (586-588)
apps/framework-cli/src/cli/processing_coordinator.rs (1)
  • default (97-99)
apps/framework-cli/src/infrastructure/olap/clickhouse/diagnostics/mod.rs (1)
  • default (157-163)
🔇 Additional comments (16)
apps/framework-cli/src/framework/core/infra_reality_checker.rs (1)

865-907: LGTM: test fixture initializes DevConfig.

apps/framework-cli/src/project.rs (2)

390-392: LGTM: Project now includes dev with serde default.


444-468: LGTM: Project::new initializes DevConfig::default().

apps/framework-cli/src/framework/core/plan.rs (1)

857-896: LGTM: test project includes DevConfig::default().

apps/framework-cli/src/framework/core/plan_validator.rs (1)

103-140: LGTM: test project includes DevConfig::default().

apps/framework-cli/src/infrastructure/olap/clickhouse/mod.rs (1)

73-73: New module declaration looks good.

Module is correctly placed alphabetically and follows existing patterns.

Per coding guidelines: this PR introduces user-facing external table mirroring functionality. Verify that documentation for this feature exists or is added in apps/framework-docs-v2/content.

[approve_code_changes, request_verification]

#!/bin/bash
# Check for documentation related to external mirrors or externally managed tables
fd -e md -e mdx . apps/framework-docs-v2/content --exec grep -l -i "external\|mirror" {} 2>/dev/null || echo "No matching docs found"
apps/framework-cli/src/framework/core/infrastructure_map.rs (2)

2971-2982: Update Moose CLI docs for external mirror discovery.
This adds a new externally managed table mirroring capability. Verify the feature-specific docs under apps/framework-docs-v2/content are updated.

As per coding guidelines: “/framework-cli/src/: Check if any user-facing changes were made… verify the documentation for THAT SPECIFIC feature is updated in apps/framework-docs-v2/content.”


7790-7924: Verify linting and formatting compliance before merge.

Unable to run cargo clippy --all-targets -- -D warnings and cargo fmt --all -- --check in the sandbox environment due to timeout. Please confirm locally that:

  1. cargo fmt --all -- --check passes (no formatting changes needed)
  2. cargo clippy --all-targets -- -D warnings produces no warnings
apps/framework-cli/src/cli/routines/mod.rs (1)

358-431: LGTM: Well-structured mirror orchestration.

Clean separation of remote vs local-schema paths. Error messages are user-friendly. Early return on !create_local_mirrors is efficient.

apps/framework-cli/src/infrastructure/olap/clickhouse/client.rs (1)

269-312: Good documentation and structure.

Clear doc comments explaining behavior, proper use of #[allow(dead_code)] for future use, and consistent error propagation pattern.

Also applies to: 314-357

apps/framework-cli/src/cli/routines/seed_data.rs (3)

738-779: LGTM: Clean external mirror creation.

Properly uses get_mirrorable_external_tables(), handles empty case, and iterates with clear status collection. Based on learnings, the schema-only approach (LIMIT 0) is intentional for dev mirrors.


646-652: Well-designed context struct.

Clean encapsulation of mirror operation state. Lifetime annotation is correct.


657-724: LGTM: Solid single-mirror orchestration.

Correct flow: check existence → skip/drop → create schema → seed data. Error handling returns formatted status strings consistently.

apps/framework-cli/src/infrastructure/olap/clickhouse/config_resolver.rs (3)

21-74: LGTM: Clean credential resolution flow.

Good early returns, proper validation of required fields, sensible port defaults (8443 for SSL, 8123 otherwise). Keychain integration is well-structured.


76-106: LGTM: User-friendly credential prompting.

Clear messaging with host/database context. Empty password validation prevents silent failures.


141-173: LGTM: Correct partial credential handling.

Returns None if either user or password is missing, forcing re-prompt. Handles the partial storage scenario gracefully.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@callicles
Copy link
Collaborator Author

Addressed all CodeRabbit review feedback:

Implemented:

  • Added documentation for [dev.externally_managed.tables] and [dev.remote_clickhouse] config to dev-environment.mdx
  • Added warning log when parse_clickhouse_connection_string fails
  • Made get_mirrorable_external_tables() return deterministic ordering (sorted by name)
  • Added validate_clickhouse_identifier for remote_database in both create_mirror_table_from_remote and insert_from_remote
  • Added 8 unit tests for config_resolver.rs
  • Added rustdoc for tables field in DevExternallyManagedTablesConfig
  • Clarified port default behavior in doc comment

Skipped (with reasoning):

  • Code duplication in seed_data.rs: The duplication is intentional - functions have different control flows (early return vs batch processing). Extracting a helper would add complexity without significant benefit for only 2 use cases.
  • Partial credential storage rollback: Reviewer acknowledged re-prompting is acceptable behavior. Adding atomic storage would over-engineer for a rare edge case.

@callicles callicles force-pushed the nico/eng-2039-create-externally-managed-tables-in-local-dev branch from 9fa3675 to 0f65e28 Compare February 6, 2026 22:45
config resolved

mirrorable external tables

seed data function

last step integration!

fixes

docs
@callicles callicles force-pushed the nico/eng-2039-create-externally-managed-tables-in-local-dev branch from 0f65e28 to ed58565 Compare February 6, 2026 22:45
@blacksmith-sh

This comment has been minimized.

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