Commit cb63c58
Support mooseRuntimeEnv.get() for dictionary external source credentials (#3954)
## Summary
- Extends `resolve_runtime_credentials_from_env()` in
`InfrastructureMap` to resolve `__MOOSE_RUNTIME_ENV__` markers in
dictionary external source credential fields
- Covers all credentialed sources: ClickHouse, MySQL, PostgreSQL, Redis,
MongoDB, and S3
- Uses the same `resolve_runtime_env` / `resolve_optional_runtime_env`
infrastructure already used for S3Queue/S3/IcebergS3 table engines
## Motivation
ClickHouse Cloud does not support named collections, so dictionary
sources require inline `user`/`password` credentials in the DDL. Without
this change, users had no way to avoid hardcoding secrets. With this
change, they can write:
```typescript
OlapDictionary("my_dict", {
source: {
clickhouse: {
host: "ch.cloud.example.com",
user: mooseRuntimeEnv.get("CH_DICT_USER"),
password: mooseRuntimeEnv.get("CH_DICT_PASSWORD"),
...
}
}
})
```
## Test plan
- [x] 8 unit tests added covering all 6 credentialed source types plus
error and passthrough cases
- [x] `cargo clippy --all-targets -- -D warnings` clean
- [x] All existing dictionary tests continue to pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Touches credential-resolution logic for ClickHouse external
dictionaries (including error reporting) and adjusts masking/comparison
semantics; mistakes could break deployments or leak/ignore credential
changes. Changes are well-covered by new regression/unit tests, reducing
risk.
>
> **Overview**
> Adds runtime resolution of `__MOOSE_RUNTIME_ENV__` markers for
**external-source ClickHouse dictionaries**
(ClickHouse/MySQL/Postgres/Redis/MongoDB/S3) in
`InfrastructureMap::resolve_runtime_credentials_from_env`, enabling
`mooseRuntimeEnv.get()` for dictionary credentials.
>
> Clarifies and enforces credential-masking semantics: **secrets are
masked but usernames remain plaintext** so username changes trigger
dictionary rebuilds/diffs; expands drift detection normalization to
ignore dictionary `metadata` and password-only differences to avoid
false drift.
>
> Adds extensive regression/unit tests covering dictionary env
resolution, masking behavior, diff detection for username changes, and
drift detection ignoring metadata-only differences.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9689a57. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 23b7ef0 commit cb63c58
2 files changed
Lines changed: 906 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2232 | 2232 | | |
2233 | 2233 | | |
2234 | 2234 | | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
| 2264 | + | |
| 2265 | + | |
| 2266 | + | |
| 2267 | + | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
| 2272 | + | |
| 2273 | + | |
2235 | 2274 | | |
2236 | 2275 | | |
2237 | 2276 | | |
| |||
0 commit comments