forked from cleveragents/cleveragents-core
837ff4217b
- Add AsyncJob domain model with status state machine and Pydantic validation
- Add AsyncWorker service with configurable concurrency and job store
- Add CancellationToken, WorkerHealthReport, InMemoryJobStore
- Add AsyncJobModel SQLAlchemy model and Alembic migration (m6_003)
- Add 5 async config keys to Settings (worker_id, concurrency, poll_interval, max_retries, timeout)
- Add _check_async_worker_health diagnostic check in system.py
- Add comprehensive Behave BDD tests (~60 scenarios) with full step definitions
- Add Robot Framework integration tests (6 smoke tests)
- Add ASV benchmark suite for async execution
- Add architecture documentation
- Update vulture_whitelist with new public API symbols
- All quality gates pass: lint, typecheck, unit_tests, integration_tests, coverage_report (97%)
1. Wire async job creation into PlanLifecycleService:
- Add optional job_store parameter to __init__
- Add _maybe_enqueue_async_job() helper that checks settings.async_enabled
and job store presence before creating and enqueuing an AsyncJob
- Call helper from execute_plan() (phase="execute") and apply_plan()
(phase="apply") after phase transitions
- When async is disabled or no job store is configured, behaviour is
unchanged (silent no-op)
2. Redact secrets in failed job error messages:
- Apply shared.redaction.redact_value() to the error string before
persisting to AsyncJob.error_message, preventing accidental secret
leakage (e.g. API keys in exception text) into the audit trail
Documentation:
- S1: Added specification reconciliation note (ADR-style) to
async_architecture.md addressing tension between "No Plan Queuing"
clause and the async subsystem authorised by issue #312
ISSUES CLOSED: #312
53 lines
2.5 KiB
Plaintext
53 lines
2.5 KiB
Plaintext
*** Settings ***
|
|
Documentation Smoke tests for async job execution: domain model, worker,
|
|
... payload serialization, and config validation.
|
|
Resource ${CURDIR}/common.resource
|
|
Suite Setup Setup Test Environment
|
|
Suite Teardown Cleanup Test Environment
|
|
|
|
*** Variables ***
|
|
${HELPER_SCRIPT} robot/helper_async_execution.py
|
|
|
|
*** Test Cases ***
|
|
Async Job Status Transitions
|
|
[Documentation] Verify job status transitions follow the state machine
|
|
[Tags] async domain transitions
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} status-transitions cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} status-transitions-ok
|
|
|
|
Async Worker Pickup And Execute
|
|
[Documentation] Verify worker picks up and executes a queued job
|
|
[Tags] async worker execution
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} worker-execute cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} worker-execute-ok
|
|
|
|
Async Job Payload Serialization
|
|
[Documentation] Verify payload serialization round-trip
|
|
[Tags] async serialization
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} payload-roundtrip cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} payload-roundtrip-ok
|
|
|
|
Async Worker Health Report
|
|
[Documentation] Verify worker health report contains expected fields
|
|
[Tags] async worker health
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} health-report cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} health-report-ok
|
|
|
|
Async Stuck Job Detection
|
|
[Documentation] Verify stuck jobs are detected and marked failed
|
|
[Tags] async worker stuck
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} stuck-detection cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} stuck-detection-ok
|
|
|
|
Async Job Cleanup
|
|
[Documentation] Verify completed jobs are cleaned up after TTL
|
|
[Tags] async worker cleanup
|
|
${result}= Run Process ${PYTHON} ${HELPER_SCRIPT} job-cleanup cwd=${WORKSPACE}
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} job-cleanup-ok
|