Skip to content

feat: namespace (owner+app) support and the full search lifecycle - #22

Merged
JacobPEvans-personal merged 3 commits into
mainfrom
feat/phase-1-search
Jun 23, 2026
Merged

feat: namespace (owner+app) support and the full search lifecycle#22
JacobPEvans-personal merged 3 commits into
mainfrom
feat/phase-1-search

Conversation

@JacobPEvans-personal

Copy link
Copy Markdown
Contributor

Summary

Owner's #1 priority for 0.2.0: makes Splunk namespaces first-class and
completes the search surface. Stacked on #21 (Phase 0).

Namespaces (owner + app)

  • core/namespace.py: ns_path() builds /servicesNS/<owner>/<app>/...;
    resolve_ns() applies a safe policy:
    • reads default to the - wildcard (every owner and app),
    • writes require an explicit app and never fall back to the default
      search app, with owner defaulting to nobody.
  • Universal --app / --owner options (and SPLUNK_APP / SPLUNK_OWNER),
    resolved on Ctx with precedence flag > env > policy. These mirror Splunk's
    own -app / -owner universal parameters; the official field names app
    and owner are used throughout, and output surfaces app/owner/sharing.

Search (#3)

  • search list / get / cancel for the job lifecycle (core/jobs.py);
    cancel is a gated write.
  • search run --export streams from the export endpoint (no job created),
    bounded by --max-rows, parsing the newline-delimited JSON it returns — so a
    caller cannot trigger an unbounded export.

Saved searches (namespaced)

  • saved-search list / get / create / update / delete / run
    (core/saved_searches.py). update sends only the fields you pass (Splunk
    merges server-side); run dispatches the search and returns the new SID.

Testing

ruff, pyright (0 errors), and pytest (52 passed, 1 integration skipped) all
green. New tests cover the namespace policy, job lifecycle, saved-search CRUD +
dispatch, and export parsing/bounding. README, CHANGELOG, and .env.example updated.

Note: stacked on #21 — review/merge that first, or review this diff against the
feat/phase-0-foundation base.

Closes #3

Pointing SPLUNK_URL at the web UI (or any non-management port) made
`server info` return all-null fields with exit 0. It now raises a usage
error (exit 2) naming the likely cause.

Also adds the unit coverage flagged in review and bumps the dev version:
- tests for `_request` explicit-timeout passthrough and `_table` column
  union across heterogeneous rows (#19)
- isolated CliRunner tests for the command adapters: server info, index
  list/get, api get (namespaced path), search run, health-check non-zero
  exit, and error-to-exit-code mapping (#20)
- VERSION -> 0.2.0 with a CHANGELOG entry

Closes #18
Closes #19
Closes #20
Adds the owner+app namespace foundation and completes the search surface (#3).

Namespaces:
- core/namespace.py: ns_path() builds /servicesNS/<owner>/<app>/...; resolve_ns()
  applies a safe policy -- reads default to the "-" wildcard, writes require an
  explicit app and never fall back to "search", write-owner defaults to "nobody".
- Universal --app/--owner options (and SPLUNK_APP/SPLUNK_OWNER), resolved on Ctx
  with precedence flag > env > policy. Output surfaces app/owner/sharing.

Search:
- search list/get/cancel for the job lifecycle (core/jobs.py); cancel is gated.
- search run --export streams from the export endpoint, bounded by --max-rows
  (parses newline-delimited JSON), so a caller cannot trigger an unbounded export.

Saved searches (namespaced):
- saved-search list/get/create/update/delete/run (core/saved_searches.py). update
  sends only changed fields (Splunk merges server-side); run dispatches the search
  and returns the new job's SID.

Tests cover the namespace policy, job lifecycle, saved-search CRUD + dispatch,
export parsing/bounding, and CLI smokes (52 passing total). README, CHANGELOG,
and .env.example updated.

Closes #3
# Conflicts:
#	CHANGELOG.md
#	tests/unit/test_commands.py
@JacobPEvans-personal
JacobPEvans-personal merged commit 9e83d68 into main Jun 23, 2026
2 checks passed
@JacobPEvans-personal
JacobPEvans-personal deleted the feat/phase-1-search branch June 23, 2026 15:41
@JacobPEvans-personal
JacobPEvans-personal restored the feat/phase-1-search branch July 11, 2026 02:28
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.

search: job lifecycle and saved searches

1 participant