Repository navigation
Releases
v2.1.0: Asynchronous Operations & Job Queue Engine
API Executor v2.1.0 Release Notes — Asynchronous Operations & Priority Job Engine
Release Tag: v2.1.0
Previous Tag: v2.0.0
Date: 2026-11-09
Repository: go-admin-tool
License: Apache 2.0
Executive Overview
API Executor v2.1.0 introduces a high-performance Asynchronous Action Execution and Priority Queue Subsystem (Milestones 1–5), decoupling long-running infrastructure commands, multi-domain plugin workflows, and database queries from synchronous HTTP server threads.
This release provides non-blocking job submission (POST /api/v1/jobs), priority heap queuing (High, Normal, Low), worker pool management, OS process-group cancellation, concurrency-safe circular log buffering, two-tier RBAC authorization, Prometheus telemetry, SHA-256 tamper-evident audit chaining, and an interactive Web Administration Console (Tab 9: Async Jobs & Queue) with real-time log tailing.
Every feature is backed by a comprehensive 4-Tier End-to-End (E2E) Test Suite (88/88 E2E tests passing, 464 unit/integration tests passing, 100% pass rate, zero race conditions under Go's race detector) and certified across all 11 packages exceeding the >=80% statement coverage standard.
Key Highlights & Architectural Enhancements
HTTP Client / Web Console (Tab 9)
│
▼
┌───────────────────────────────────────────────┐
│ internal/api/ │
│ POST /api/v1/jobs ──► Two-Tier RBAC Check │
│ GET /api/v1/jobs ──► List & Query Filters │
│ GET /api/v1/jobs/{id}/logs ──► Chunked Stream│
│ POST /api/v1/jobs/{id}/cancel ──► Cancel Job │
└──────────────────────┬────────────────────────┘
│
▼
┌───────────────────────────────────────────────┐
│ internal/jobs/ │
│ │
│ ┌─────────────────────────────────────────┐ │
│ │ JobQueue (container/heap Priority) │ │
│ │ High > Normal > Low (FIFO Tie-Breaker) │ │
│ │ Capacity Bound: 1000 (ErrQueueFull) │ │
│ └────────────────────┬────────────────────┘ │
│ │ │
│ ▼ │
│ ┌─────────────────────────────────────────┐ │
│ │ WorkerPool (Bounded Goroutines) │ │
│ │ Consumes jobs, passes Context & Buffer │ │
│ └────────────────────┬────────────────────┘ │
│ │ │
│ ┌──────────────┴──────────────┐ │
│ ▼ ▼ │
│ ┌───────────┐ ┌───────────┐ │
│ │ Core Exec │ │ Plugins │ │
│ │ (Process │ │ (Native / │ │
│ │ Group) │ │ Declarat.)│ │
│ └─────┬─────┘ └─────┬─────┘ │
│ └──────────────┬──────────────┘ │
│ ▼ │
│ ┌─────────────────────────────────────────┐ │
│ │ JobLogBuffer (2 MiB Max, Thread-Safe)│ │
│ │ Simultaneous Subprocess Write & Read │ │
│ └─────────────────────────────────────────┘ │
└──────────────────────┬────────────────────────┘
│
▼
┌───────────────────────────────────────────────┐
│ Persistence & Audit │
│ JobStore (SQLite / In-Memory Fallback) │
│ AuditLogger (SHA-256 Chained Hash Log) │
│ Prometheus Metrics (Normalized Route Labels) │
└───────────────────────────────────────────────┘
- Non-Blocking Execution Engine (Milestone 1): Long-running system diagnostics, container operations, and database inspections run asynchronously in a managed worker pool without tying up HTTP server threads.
- Prioritized Workload Scheduling (Milestone 1): Three-tier heap priority queue (
High,Normal,Low) ensures urgent operational tasks leapfrog normal batches while preserving strict FIFO ordering within each tier. - OS Process-Group Termination (Milestone 1): Subprocess cancellations propagate down the entire OS process hierarchy (
SIGKILLto process groups on Unix;taskkill /T /Fon Windows), eliminating orphan background processes. - Circular Streaming Log Buffers (Milestone 1): Concurrency-safe memory buffers capture stdout and stderr streams in real time up to 2 MiB per job with offset-based chunked client polling and automatic EOF signaling.
- Two-Tier RBAC & Scope Protection (Milestone 2): Callers must possess the specific
jobs:*scope AND have authorization for the underlying command or plugin action. - Prometheus Telemetry with DoS Protection (Milestone 2): Dynamic job IDs in routes are normalized to static label templates (
/api/v1/jobs/:id), preventing unbounded label cardinality DoS. - Tamper-Evident SHA-256 Audit Trail (Milestone 2): Complete cryptographic hash chaining for every lifecycle transition (
job.enqueued,job.started,job.completed,job.failed,job.cancelled,job.timed_out). - Web Administration Console Tab 9 (Milestone 3): Interactive single-page operational dashboard featuring queue telemetry cards, background dispatcher, execution table, and real-time streaming log viewer modal.
- 4-Tier E2E Test Suite (Milestone 4): 88 opaque-box end-to-end tests exercising feature workflows, boundary conditions, concurrency races, and real-world multi-tenant scenarios.
- Enterprise Governance Compliance (Milestone 5): OpenAPI 3.0 / Swagger 2.0 specifications updated, architecture documentation published, and statement coverage exceeding 80% across all 11 packages.
Detailed Breakdown by Milestone
Milestone 1: Core Asynchronous Job Engine (internal/jobs/)
-
Domain Models & Thread Safety (
internal/jobs/job.go):-
Jobstruct with fine-grainedsync.RWMutexprotection. - Lifecycle states:
queued->running->completed|failed|cancelled|timed_out. - Immutable terminal state guarantees: once terminal, a job cannot be transitioned or modified (
IsTerminal() == true). - Thread-safe
Snapshot()returning an immutable shallow clone without copying mutexes. - Custom
MarshalJSON()synchronization preventing data races during concurrent worker mutations.
-
-
Priority Heap Queue (
internal/jobs/queue.go):- Max-heap backed by Go standard library
container/heap. - Priority levels:
High(weight 3),Normal(weight 2),Low(weight 1). - Monotonic
queueSeqtie-breaking guaranteeing strict FIFO ordering within identical priority tiers. - Bounded capacity (
capacity: 1000, configurable) returningErrQueueFullwhen full. - Efficient
$O(\log N)$ queue-time cancellation viaRemove(jobID)and internal lookup hash map.
- Max-heap backed by Go standard library
-
Worker Pool Management (
internal/jobs/worker.go):- Fixed pool of worker goroutines (default: 4 workers).
- Per-job execution context with timeout enforcement (
DefaultJobTimeout = 30s). - Active jobs map (
activeJobs map[string]context.CancelFunc) enabling immediate mid-flight cancellation. - Panic recovery converting unexpected runtime panics into graceful
StatusFailedterminal states. - Graceful draining on server shutdown (
Shutdown(ctx)), allowing active jobs up to the shutdown context deadline to complete.
-
Process-Tree Execution & Cancellation (
internal/core/executor.go):- Enhanced
ExecuteCommandWithContextacceptingcontext.Contextand real-timeio.Writer. - Unix:
SysProcAttr{Setpgid: true}andsyscall.Kill(-cmd.Process.Pid, syscall.SIGKILL). - Windows:
taskkill /T /F /PID <pid>terminates child and grandchild processes. -
cmd.WaitDelay = 200 * time.Millisecondprevents dangling pipe deadlocks on child exit.
- Enhanced
-
Circular In-Memory Log Buffer (
internal/jobs/buffer.go):- Thread-safe bounded memory buffer (
DefaultMaxLogBytes = 2 << 20/ 2 MiB). - Implements
io.Writer: excess output beyond 2 MiB is dropped, setstruncated = true, and returnslen(p), nilto prevent broken pipe errors on child processes. - Chunked reading via
ReadChunk(offset int) (logs string, nextOffset int, truncated bool, eof bool).
- Thread-safe bounded memory buffer (
-
Dual Persistence Store (
internal/jobs/store.go):-
SQLiteJobStore: Backed by SQLite tablejob_historywith composite indexes onstatus,action,actor_id, andcreated_at DESC. -
MemoryJobStore: Pure-Go in-memory store using deep-cloning snapshots, providing full functionality when compiled withCGO_ENABLED=0. - Automatic background retention pruner running every 10 minutes, pruning terminal jobs older than
MaxJobAge(7 days) or exceedingMaxRetainedJobs(10,000).
-
Milestone 2: REST API Endpoints, Security & Telemetry
- 6 New REST API Endpoints (
internal/api/job_handlers.go,router.go):POST /api/v1/jobs: Submit asynchronous command or plugin job (returns HTTP 202 Accepted).GET /api/v1/jobs: Query and list background jobs with status/type/action/actor filtering and pagination.GET /api/v1/jobs/{id}: Retrieve detailed job execution metadata, timestamps, and results.GET /api/v1/jobs/{id}/logs: Stream real-time chunked execution logs with byte offset tracking.POST /api/v1/jobs/{id}/cancel: Abort an active queued or running job.GET /api/v1/jobs/queue: Retrieve live queue depth, capacity, and active worker metrics.
- Two-Tier RBAC Scopes (
internal/auth/manager.go):- New scopes:
jobs:submit,jobs:read,jobs:cancel. - Role inheritance:
admin(*),operator(jobs:submit,jobs:read,jobs:cancel),viewer(jobs:read),service(jobs:submit,jobs:read). - Two-tier validation: Job submission requires
jobs:submitscope ANDcommands:executeorplugins:executefor the underlying action. - Machine-to-machine service accounts are additionally checked against their
allowed_actionsallowlist.
- New scopes:
- Prometheus Metric Collectors (
internal/api/job_metrics.go):
...
v2.0.0 — Zero-Trust Remote Command & MCP Platform with High-Scale Optimizations
Overview
API Executor (go-admin-tool v2.0.0) is an enterprise zero-trust administration and Model Context Protocol (MCP) platform designed for secure remote command execution, container-testable OS preset management, and high-throughput AI agent orchestration.
This release consolidates comprehensive security hardening, a 305+ plugin ecosystem across 10 operational domains, and four major performance optimizations eliminating hot-path lock contention, memory bloat, and syscall overhead.
🚀 Key Performance Optimizations
-
O(1) Credential Authentication Indexing (PR #77, Closes #76)
- Replaced linear O(N) credential scans under exclusive memory locks with O(1) secondary hash lookup maps (
tokenByHashandserviceAccountByHash). - Maintains constant-time verification (
crypto/subtle.ConstantTimeCompare) and synchronized lifecycle across user deletion, token revocation, and key rotation.
- Replaced linear O(N) credential scans under exclusive memory locks with O(1) secondary hash lookup maps (
-
Pre-Compiled Regexes & Sorted Plugin Catalog Caching (PR #79, Closes #78)
- Pre-compiles all declarative parameter validation regular expressions at initialization.
- Caches the sorted
[]PluginInfocatalog snapshot inRegistryacross 305 plugins, eliminating O(N log N) sorting overhead on catalog queries. - Rejects non-scalar composite parameter types and fixes character class ranges.
-
Subprocess Output Buffer Bounding (PR #81, Closes #80)
- Replaced unbounded
cmd.CombinedOutput()with a boundedlimitedOutputBuffercapped atMaxCommandOutputBytes = 1 << 20(1 MiB). - Drains excess bytes safely without triggering
SIGPIPEor broken pipe failures on child processes, preventing heap exhaustion (OOM) on runaway commands.
- Replaced unbounded
-
Persistent File Handles, Lock Decoupling & Direct db.Exec (PR #83, Closes #82)
- Persists open file descriptors (
*os.File) inAuditLoggerandmcp.Server, eliminating per-eventos.OpenFile/Closesyscall storms. - Decoupled disk and SQLite I/O from the in-memory ring-buffer lock (
al.mu), ensuring non-blocking reads for audit queries and chain verification. - Replaced per-insert
db.Preparewith directdb.Exec.
- Persists open file descriptors (
🛡️ Core Capabilities
- Zero-Trust Security: HTTPS/TLS 1.3 by default with automatic ECDSA P-256 certificate generation, live zero-downtime certificate rotation (
POST /api/v1/tls/renew), and optional mTLS client authentication. - Model Context Protocol (MCP): Full JSON-RPC 2.0 MCP server (
POST /api/v1/mcp) implementing the Meta-Tool pattern (execute_pluginandexecutor://plugins/catalog) with immutable trace retention. - 305+ Plugins Across 10 Domains: 24 native pure-Go plugins + 281 declarative YAML plugins spanning
SysAdmin,NetOps,SecOps,ContainerOps,Kubernetes,DataOps,DevOps,SRE,AIOps, andWebUtils. - Tamper-Evident Audit Trail: Cryptographic SHA-256 hash chaining (
prev_hash->entry_hashfromGENESIS) with verifiable integrity (GET /api/v1/audit/verify). - OS Task Presets: Ready-to-run container-safe system inspection catalogs for Ubuntu 24.04 and RedHat UBI 9.
- Web Administration Console: Single-page 8-tab dark console with instant client-side catalog filtering, dynamic parameter forms, and telemetry monitoring.
🧪 Verification & Test Coverage
- 100% Test Pass Rate: 339 unit and integration tests passing across all 10 packages.
- Zero-CGO Pure-Go Fallback: Tested and validated under both CGO-enabled SQLite and pure-Go in-memory modes.
- Docker Hygiene: Multi-stage builds for Ubuntu and RedHat UBI9 with optimal layer caching.