refactor: restructure package to mirror vct-cribl-cli's API-endpoint framework - #81
Merged
Merged
Conversation
…framework Reorganize the package from a core/ + commands/ split into the same layered layout as vct-cribl-cli, so both CLIs expose a consistent API surface: - api/client.py: layered httpx transport stack (AuthTransport -> RetryTransport -> HTTPTransport). Auth is now resolved and injected per request by AuthTransport instead of set once at client construction, so a long-running embedder re-authenticates transparently when a session key expires. - api/endpoint_factory.py: generic CRUD engine renamed to EndpointConfig / Field / Endpoints (was Spec / CrudResource); scope replaces the namespaced flag. - api/endpoints/: hand-written endpoint modules; api/acs/: Cloud ACS client. - auth/session.py: credential resolution + login with lazy session-key caching. - config/ (loader.py, types.py): profile/env/flag merging; SplunkConfig carries token/session_key/username/password separately. - utils/, output/formatter.py, commands/command_factory.py: remaining packages. Behavior is unchanged: 1023 unit tests pass, ruff/pyright clean, and the CLI is verified live against Splunk Enterprise 10.4. Adds docs/architecture.md and updates the AGENTS.md architecture section. .envrc now loads a local .env via direnv's dotenv_if_exists. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
werd-drew
requested review from
InverseTachyon and
JacobPEvans-personal
as code owners
August 18, 2026 02:06
markdownlint MD040 requires a language on fenced code blocks; the three plain fences (project tree, transport diagram, config chain) now use ```text. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The per-request session-key cache (added with the transport-stack auth) held a stale key across a Splunk restart: a restart invalidates session keys server-side, but the client kept sending the cached one, so every request 401'd until the 55-minute TTL expired. This broke server-info reconnect polling after 'server restart' (caught by the live enterprise integration suite) and would break any long-running embedder on username/password auth. AuthTransport now treats a 401 as a possibly-stale session when the credential is a username/password (re-mintable): it drops the cache, logs in again, and retries the request once. A static token or session key is not refreshable, so its 401 still surfaces immediately. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
JacobPEvans-personal
approved these changes
Aug 18, 2026
JacobPEvans-personal
left a comment
Contributor
There was a problem hiding this comment.
Looks great, thank you @werd-drew
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.
Summary
Reorganizes the package from a
core/+commands/split into the same layered layout asvct-cribl-cli, so both CLIs expose a consistent API surface. Behavior is unchanged.What changed
api/client.py— layered httpx transport stack (AuthTransport→RetryTransport→HTTPTransport). Auth is now resolved and injected per request byAuthTransportinstead of set once at client construction, so a long-running embedder re-authenticates transparently when a session key expires.api/endpoint_factory.py— generic CRUD engine renamed toEndpointConfig/Field/Endpoints(wasSpec/CrudResource); ascopefield ("global"/"namespaced") replaces thenamespacedboolean.api/endpoints/— hand-written endpoint modules;api/acs/— Splunk Cloud ACS client.auth/session.py— credential resolution + login with lazy session-key caching.config/(loader.py,types.py) — profile/env/flag merging;SplunkConfigcarriestoken/session_key/username/passwordseparately.utils/,output/formatter.py,commands/command_factory.py— the remaining cribl-parallel packages.docs/architecture.md; updates the AGENTS.md architecture section..envrcnow loads a local.envvia direnv'sdotenv_if_exists.Verification
server info,index list, boundedsearch run, namespacedsaved-search list,health check, rawapi get).🤖 Generated with Claude Code