testing-opportunity-loop

Tests the opportunity dispatch and refill API pipeline end-to-end including sqlite state and revenue packets.

Updated Aug 5, 2026
One-click install
npx skills add https://github.com/AmitabhainArunachala/dharma_swarmv.01 --skill testing-opportunity-loop-amitabhainarunachala
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: testing-opportunity-loop
Source: https://github.com/AmitabhainArunachala/dharma_swarmv.01/tree/main/.agents/skills/testing-opportunity-loop
Command: npx skills add https://github.com/AmitabhainArunachala/dharma_swarmv.01 --skill testing-opportunity-loop-amitabhainarunachala

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Verifying that the Authority and Revenue loop actually works requires more than checking HTTP 200 responses: durable sqlite state, six-stage execution, telic provenance, and revenue packet economics must all be validated together, which is error-prone to do ad hoc. ## Core Features & Use Cases - End-to-end API verification: Exercises the stages, dispatch, and refill endpoints and checks exact stage ordering and success criteria. - Durable state assertions: Inspects task_claims and delegation_runs tables in an isolated sqlite runtime database via Python's sqlite3 module. - Quarantine and governance checks: Validates quarantine mode behavior for the deep_research stage and runs pre-commit hooks. - Use Case: After modifying the opportunity dispatch logic, run this loop to confirm all six stages complete, claims and runs persist, and the revenue packet's net value arithmetic is coherent. ## Quick Start Run the opportunity loop gauntlet against a local uvicorn server with an isolated DHARMA_STATE_DIR and report the verdict.

Frequently Asked Questions about testing-opportunity-loop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test the opportunity dispatch and refill API endpoints?▼

Start uvicorn on port 8420 with an isolated DHARMA_STATE_DIR, then POST to /api/opportunities/dispatch and /api/opportunities/refill. Dispatch must return exactly 6 stage results with success true and non-empty task_id, claim_id, and run_id.

How do I verify sqlite state after running the dispatch endpoint?▼

Use Python's sqlite3 module to connect to $DHARMA_STATE_DIR/runtime.db and count rows in task_claims and delegation_runs filtered by your test opportunity id. Expect at least 6 claims and 6 runs per dispatch call.

Why is the sqlite3 CLI not working for database inspection?▼

The sqlite3 CLI is often not installed in this environment, so all database inspection must use Python's built-in sqlite3 module instead. Connect with sqlite3.connect and execute COUNT queries against task_claims and delegation_runs.

Does quarantine mode require env vars on the curl client?▼

No, DHARMA_RESEARCH_BACKEND=quarantine must be set on the uvicorn server process, not the curl client. Setting it on the client has no effect and leads to false conclusions that the feature is broken.

What are the limitations of the dispatch endpoint's telic provenance?▼

The proposal_id field is empty unless the dispatcher is wired with a TelicSeam instance, which is a known gap rather than a bug. Telic provenance is proven by the pytest suite, not the API path.