REPL.2 — Connection config precedence: CLI flag > env var > config file > default - #165
Draft
fupelaqu wants to merge 3 commits into
Draft
REPL.2 — Connection config precedence: CLI flag > env var > config file > default#165fupelaqu wants to merge 3 commits into
fupelaqu wants to merge 3 commits into
Conversation
… file > default
- CliConfig: layered Typesafe chain (only passed flags in the primary layer via
ConfigValueFactory; explicit env layer with empty-equals-unset filtering; no-arg
ConfigFactory.load() so -Dconfig.file works; builtin softnetwork-elastic.conf
as defaults tail) + sanitize guard for empty/null scheme/host/port
- parseArgs/printUsage moved from Cli (App/delayedInit untestable) to the
CliConfig companion; usage text documents the precedence
- softnetwork-elastic.conf: drop 'method = "noauth"' so supplied credentials
auto-detect their auth method (api-key > bearer > basic > none) - previously
-u/-P/ELASTIC_USERNAME/... produced an UNAUTHENTICATED client
- install.sh: launcher unsets empty ELASTIC_*/ELASTIC_WATCHER_* env vars
(HOCON ${?VAR} treats empty as present); conf template documents precedence
- NEW CliConfigSpec: 12-test precedence matrix through the two-parameter
buildElasticConfig(env, external) seam - no JVM-global sysprop mutation
- docs: repl.md gains a Configuration Precedence section
Release note: library-visible change for ElasticConfig consumers - configs that
supply credentials without an explicit 'method' now authenticate (auto-detect)
instead of silently sending no Authorization header.
Closed Issue #162
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jul 30, 2026
#162) Follow-up to PR #165 CI: since the builtin conf no longer forces method = "noauth", an unauthenticated setup resolves authMethod to None and JestClientCompanion.buildHttpConfig fell into its catch-all 'Invalid authentication configuration' throw at client creation (172 es6jest CI failures). None now behaves exactly like Some(NoAuth); an explicitly selected method with missing credentials still fails loudly. Audit of every authMethod matcher: es6rest/es7rest/es8java/es9java companions and the Jest interceptor/factory already fall through to no-auth - the Jest buildHttpConfig was the only gap. Tests: JestClientCompanionSpec gains an embedded-ES regression case (CI); NEW pure-JVM JestClientNoAuthSpec covers creation-time behaviour without a server (embedded ES 6.8 cannot start on Apple Silicon: x86-only -XX:UseAVX=2), 2/2 green locally under sbt17. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements story REPL.2 (epic REPL — REPL Hardening). Closes #162.
What
Fixes the three verified defects that made the documented configuration surface dead:
CliConfignow builds a layered Typesafe chain: CLI layer (ONLY flags actually passed, viaConfigValueFactory— also kills the HOCON-injection bug for passwords containing"/\) > explicit env layer >ConfigFactory.load()> builtinsoftnetwork-elastic.confdefaults tail, plus asanitizeguard for empty/null scheme/host/port.conf/application.confnever loaded — the external layer is the no-argConfigFactory.load(), the only variant that honours the launcher's-Dconfig.file.method = "noauth"default is deleted;ElasticCredentialsauto-detection (api-key > bearer > basic > none) now engages. Release note: library-visible forElasticConfigconsumers — configs that supply credentials without an explicitmethodnow actually authenticate.Also:
parseArgs/printUsagemoved fromobject Cli extends App(delayedInit-untestable) to theCliConfigcompanion; empty env var ≡ unset (JVM filter + launcher unset loop incl. theELASTIC_WATCHER_*family); credential env values verbatim, coordinates trimmed;ELASTIC_IP>ELASTIC_HOSTandELASTIC_<X>>ELASTIC_CREDENTIALS_<X>alias precedence;repl.mdprecedence docs.Verification
CliConfigSpec: 12-test precedence matrix through a two-parameter test seam (no JVM-globalconfig.file/invalidateCachesmutation — root-scopedparallelExecutionmakes a sysprop bracket a cross-suite race).core/test: 617/617 green; cross-compile 2.12.20 + 2.13.16; scalafmt + headerCheck green.install.sh, Docker ES 8.18.3 on :19200): env var connects, file connects,-pwins over conflicting env+file, all-unset dialslocalhost:9200,ELASTIC_HOST=""treated as unset.elastic.credentials.methodunguarded.Version bumped 0.20.1 → 0.20.2-SNAPSHOT.
🤖 Generated with Claude Code
Part of epic #169 (REPL Hardening). Follow-up spun off during review: #172 (watcher block dotted-path literals — outside this PR's sanitize coverage).