Skip to content

UNOMI-880 UNOMI-878 UNOMI-139: Karaf dev shell commands#763

Merged
sergehuber merged 3 commits into
masterfrom
UNOMI-880-878-shell-dev-commands
Jun 9, 2026
Merged

UNOMI-880 UNOMI-878 UNOMI-139: Karaf dev shell commands#763
sergehuber merged 3 commits into
masterfrom
UNOMI-880-878-shell-dev-commands

Conversation

@sergehuber

Copy link
Copy Markdown
Contributor

Stacked PR (merge order)

Role Branch
Base (merge into) UNOMI-904-v2-api-compatibility (#762)
Head (this PR) UNOMI-880-878-shell-dev-commands

Merge #762 (and its base #760) before this PR.


JIRA

  • UNOMI-880 — Unified multi-tenant caching (operational shell)
  • UNOMI-878 — Cluster-aware task scheduling (operational shell)
  • UNOMI-139 — Multi-tenancy (tenant / API key shell)

Summary

Adds Karaf developer shell commands in tools/shell-dev-commands/ so operators and developers can manage caches, scheduled tasks, tenants, API keys, and JSON schemas from the console. This PR delivers the shell UX and integration tests; platform services (caching core, SchedulerService, tenant APIs) are on #760.

UNOMI-880 — Cache management (unomi:cache)

CacheCommands exposes tenant-aware cache operations aligned with MultiTypeCacheService:

  • --stats, --reset, --type, --tenant
  • --clear, --inspect, --watch, --view, --remove

IT: CacheCommandsIT

UNOMI-878 — Scheduler task shell

Commands on top of the cluster-aware SchedulerService from the platform PR:

Command Purpose
unomi:task-list List tasks (status, persistence, next/last run)
unomi:task-show Task details
unomi:task-cancel Cancel a task
unomi:task-retry Retry a failed task
unomi:task-purge Purge completed tasks
unomi:task-executor Show/change executor participation for this node

IT: SchedulerCommandsIT (shell commands; platform scheduler REST coverage is separate)

UNOMI-139 — Multi-tenant shell

  • TenantContextHelper — current tenant in the shell session
  • unomi:tenant-set / unomi:tenant-get — session tenant context
  • Tenant and API key CRUD commands (tenants/*, apikeys/*)
  • TenantCompleter for tab completion

IT: TenantCommandsIT

JSON Schema shell

  • New module extensions/json-schema/shell-commands/ with SchemaCrudCommand
  • Wired into Karaf unomi-shell-dev-commands feature and BOM (unomi-json-schema-shell-commands)

Other shell ITs

  • CrudCommandsIT — exercises unomi:crud from #755 (UNOMI-879) in the dev shell context
  • RuleStatisticsCommandsIT, TailCommandsIT, OtherCommandsIT
  • Shared harness: ShellCommandsBaseIT

AllITs registers the seven shell IT classes for this phase.

Packaging

  • extensions/json-schema/pom.xml — adds shell-commands module
  • kar/src/main/feature/feature.xml — bundles json-schema shell commands with dev shell feature
  • kar/pom.xml, bom/artifacts/pom.xml — dependency pins

Legacy placeholder commands under org.apache.unomi.shell.commands (ProfileRemove, RuleView, SessionView, RuleRemove) are removed; scheduler/tenant commands live under org.apache.unomi.shell.dev.commands.

Out of scope (other PRs)

Area Where
SchedulerService implementation, REST /cxs/tasks, consumer wiring #760
unomi:crud unified CRUD shell #755 (UNOMI-879)
tools/shell-commands/ migration (unomi:migrate) #760
V2 API compatibility mode #762
Platform ITs (TenantIT, SchedulerIT, …) Follow-up PR on this stack

Tests

  • Shell IT suite registered in AllITs (Pax Exam / Karaf, same harness as other integration tests)
  • Local: full integration test run green with OpenSearch

Licence

@sergehuber sergehuber marked this pull request as ready for review May 19, 2026 13:41
@sergehuber sergehuber requested a review from Copilot May 19, 2026 13:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@sergehuber sergehuber force-pushed the UNOMI-904-v2-api-compatibility branch from 2419ae7 to a7c5f92 Compare June 2, 2026 17:47
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from 7cb94e6 to 8fef941 Compare June 2, 2026 17:49
@sergehuber sergehuber force-pushed the UNOMI-904-v2-api-compatibility branch from a7c5f92 to 39595c8 Compare June 2, 2026 18:44
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from 8fef941 to 70b8c49 Compare June 2, 2026 18:47
@sergehuber sergehuber force-pushed the UNOMI-904-v2-api-compatibility branch from 39595c8 to 3bc0172 Compare June 2, 2026 19:44
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from 70b8c49 to 7897291 Compare June 2, 2026 19:44
@sergehuber sergehuber force-pushed the UNOMI-904-v2-api-compatibility branch from 3bc0172 to 219abb7 Compare June 6, 2026 06:22
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from 7897291 to 03481dd Compare June 6, 2026 06:22
@sergehuber sergehuber requested a review from Copilot June 6, 2026 09:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 10 comments.

Comments suppressed due to low confidence (1)

tools/shell-dev-commands/src/main/java/org/apache/unomi/shell/dev/commands/scheduler/SetExecutorNodeCommand.java:27

  • This command claims it can change executor participation, but SchedulerService doesn’t expose any API to enable/disable executor mode (the setter is commented out). As written, passing an argument prints a success message without actually changing anything, which is misleading for operators and will diverge from the PR description.

@sergehuber sergehuber force-pushed the UNOMI-904-v2-api-compatibility branch from a4d2d2d to ad94a66 Compare June 7, 2026 19:39
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from 03481dd to d9512ab Compare June 7, 2026 19:39
@sergehuber sergehuber changed the base branch from UNOMI-904-v2-api-compatibility to master June 8, 2026 09:48
Add cache, scheduler, tenant/api-key, and json-schema CRUD dev shell
commands with integration tests. Wire unomi-json-schema-shell-commands
into Karaf feature and BOM.
@sergehuber sergehuber force-pushed the UNOMI-880-878-shell-dev-commands branch from d9512ab to b5003e0 Compare June 8, 2026 10:04
- ApiKeyCrudCommand: fix NPE on null apiKey return from generateApiKeyWithType;
  fix ClassCastException when validityPeriod is passed as a String
- SchedulerServiceImpl.deleteTask: cancel any in-flight execution before
  removing the persistence record, preventing task resurrection on completion
- PurgeTasksCommand: fix pagination offset advancing by full batchSize even
  when tasks are deleted, which caused records to be skipped
- GraphQLListIT: fix flaky test by moving refreshPersistence(Profile.class)
  inside the keepTrying loop so each retry sees the latest ES state after
  the async cdp-list-update event is processed
…robustness improvements

Add PollingUtils, a generic poll-until-predicate utility with full unit test coverage
(13 cases: validation, success paths, exhaustion, null returns, supplier exceptions,
and interruption handling).

Fix ApiKeyCrudCommand.create() to guard setName/setDescription individually so that
providing only one field does not silently null out the other. Simplify read() and
SchemaCrudCommand.getItems() with stream pipelines. Add per-task try-catch in
PurgeTasksCommand so a single deletion failure does not abort the purge loop.
Add missing exception handling in CacheCommands.viewCacheEntry/removeCacheEntry
and drop stale TODO comment.

Move Elasticsearch eventual-consistency handling for API keys out of production code
and into the integration test using waitForCondition, matching the pattern used by
other CRUD tests. Add testCacheRemove IT, fix tautological assertions in cache and
rule-statistics ITs, fix regex usage in SchedulerCommandsIT, and clean up stale
Javadoc in ShellCommandsBaseIT.

Minor Javadoc additions in SchedulerService and MultiTypeCacheService.
@sergehuber sergehuber merged commit ddd571d into master Jun 9, 2026
8 of 9 checks passed
@sergehuber sergehuber deleted the UNOMI-880-878-shell-dev-commands branch June 9, 2026 16:39
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.

2 participants