Feature #3599
open[drcarrot-mobile-Prescription] orchestration run
0%
Description
Orchestration run tracking ticket. Not the real implementation ticket — this exists only so the live timing table has somewhere to post from step 1 onward. The real backend/mobile/web ticket(s) are created and cross-linked here once the run reaches that step.
Requirement:
"Write comprehensive Jest unit tests for the Prescription module to achieve full code coverage
(target: Stmt 90%+ | Branch 85%+ | Fn 90%+ | Ln 90%+, matching this repo's global coverage thresholds
in jest.config.js).
Scope — cover every layer that exists for the Prescription module:
Service layer: src/services/PrescriptionService.ts (or equivalent)
Hooks: src/hooks/Prescription/**
Screens: src/screens/Prescription/**
Sections/components: src/sections/Prescription/ or src/components/Prescription/
Utils: src/utils/Prescription/**
Redux slice (if present): src/store/slices/PrescriptionSlice.ts
Storybook stories (if present): src/sections/Prescription//.stories.tsx or
src/components/Prescription//.stories.tsx — verify each exported story renders without crashing
and that its args/controls match the component's prop types
Tracing (if present): src/traces/Prescription.ts — cover every exported span-builder/helper,
asserting span name, attributes, and status are set correctly for success and error paths
For EVERY test, prefix the it()/test() title with a priority tag: @p1, @p2, or @p3.
Priority rubric:
@p1 — Critical path, must-pass-before-merge:
Component/hook renders or initializes without crashing
Empty state / loading state / "no records" rendering
Core CRUD happy paths: create, edit, delete succeed and update state correctly
Primary API success AND failure handling
Required-field validation blocking submit
Status/data mapping logic
Auth/permission gates that block access entirely
@p2 — Important but secondary behavior:
Search, sort, filter interactions and API parameter wiring
Pagination
Dialog open/close/cancel flows
Permission-based UI hiding
Refresh / pull-to-refresh flows
Secondary API error handling
File upload validation
Sequence/code generation logic
@p3 — Edge cases, rare inputs:
null/undefined/boolean coercion
Malformed or partially missing API responses
Invalid date strings / boundary dates
Non-matching selections
Whitespace-only or empty-string search input
Independent toggle states
Requirements:
Use the existing mock boilerplate patterns already established in this repo.
Use these as references:
- src/tests/services/ProcurementsService.test.ts
- src/tests/hooks/procurement/usePurchaseBill.test.ts
Mock ApiClient, AsyncStorage, Logger, and navigation exactly as done in those
reference files. Do not introduce a new mocking approach.
Group tests with describe() blocks by behavior area:
- Core behavior
- Search & sort
- Pagination
- Permissions
- Error handling
- Edge cases
Check the Prescription source files line by line.
Every conditional, ternary, optional chaining fallback, switch/case branch,
validation branch, success path, and error path must be exercised.
Do not use any types in test code.
Do not add skipped/pending tests.
Do not add snapshot tests unless there is no meaningful interactive behavior
to assert.
After writing the Prescription tests, run:
npm run test:coverage --
Iterate on the tests until the required coverage thresholds are met.
Then run:
npm run test:p1 --
npm run test:p2 --
npm run test:p3 --
Confirm that the priority filters correctly select the intended tests and
that all selected tests pass.
For Storybook stories, if Prescription contains .stories.tsx files, create render
tests under:
src/tests/sections/Prescription/.stories.test.tsx
Import every named story export and render it using the same RTL helpers
already used elsewhere in the project.
Tag Storybook tests @p2 unless the story is the only meaningful coverage for
a component, in which case use @p1.
For trace helpers, if Prescription contains:
src/traces/Prescription.ts
create:
src/tests/traces/Prescription.test.ts
Mock src/utils/otel.ts exactly as existing trace tests do.
Assert:
- Span name
- Span attributes
- Successful execution
- status=ERROR and error recording on failure
Tag success-path tests @p1 and failure-path tests @p2.
Do not modify production/business logic.
Only add or update the required Jest test files and test configuration
if absolutely necessary for the priority filtering.
Do not create unnecessary documentation.
Focus on implementing and validating the Prescription test coverage.
Output:
One test file per Prescription source file following the existing tests
folder structure.
Storybook test files only when Prescription stories exist.
Trace test file only when Prescription traces exist.
A short summary table showing:
File | P1 Count | P2 Count | P3 Count | Coverage"
BA Updated by Bot AI about 1 month ago
Account status — using account 1
- Window usage so far: 4,343,396 tokens ($15.97) — 11% of its own last observed ceiling
- Total dispatches on this account: 100
BA Updated by Bot AI about 1 month ago · Edited
Phase Timeline¶
| # | Process | Start (IST) | End (IST) | Duration | Input | Output | Cache Create | Cache Read | Tokens | Cost | Model |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Requirement scope detection | 29-09-2026 16:25:20 | 29-09-2026 16:25:29 | 8s | 2 | 145 | 31,173 | 0 | 31,320 | $0.1930 | claude-sonnet-5 |
| 2 | Initialise run ticket (timing anchor) | 29-09-2026 16:25:29 | 29-09-2026 16:25:30 | 1s | not available | not available | not available | not available | not available | not available | Script |
| 3 | Probe environment | 29-09-2026 16:25:31 | 29-09-2026 16:25:36 | 5s | not available | not available | not available | not available | not available | not available | API Script |
| 4 | Extract ticket-spec, acceptance criteria & test scenarios | 29-09-2026 16:25:36 | 29-09-2026 16:27:48 | 2m | 2,563 | 19,336 | 38,492 | 0 | 60,391 | $0.5317 | claude-sonnet-5 |
| 5 | Prepare execution plan | 29-09-2026 16:27:48 | 29-09-2026 16:27:49 | 0s | not available | not available | not available | not available | not available | not available | Script |
| 6 | Initialise timing note | 29-09-2026 16:27:49 | 29-09-2026 16:27:50 | 0s | not available | not available | not available | not available | not available | not available | API Script |
| 7 | Execution plan — human gate | 29-09-2026 16:27:50 | 29-09-2026 16:28:12 | 21s | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
| 8 | Mobile task Redmine ticket creation | 29-09-2026 16:28:21 | 29-09-2026 16:28:22 | 1s | not available | not available | not available | not available | not available | not available | API Script |
| 9 | Cross-link tickets | 29-09-2026 16:28:23 | 29-09-2026 16:28:24 | 0s | not available | not available | not available | not available | not available | not available | API Script |
| 10 | Write contract file | 29-09-2026 16:28:24 | 29-09-2026 16:28:24 | 0s | 0 | 0 | 0 | 0 | 0 (SKIPPED — capability absent — sides.backend.live_verified.verdict = , want one of ['PASSED', 'SKIPPED']) | 0 (SKIPPED) | -- |
| 11 | Validate contract vs screens | 29-09-2026 16:28:25 | 29-09-2026 16:28:25 | 0s | 0 | 0 | 0 | 0 | 0 (SKIPPED — capability absent — contract.path exists=False, want True) | 0 (SKIPPED) | -- |
| 12 | Propagate contract to consumer repos | 29-09-2026 16:28:26 | 29-09-2026 16:28:26 | 0s | 0 | 0 | 0 | 0 | 0 (SKIPPED — capability absent — contract.path exists=False, want True) | 0 (SKIPPED) | -- |
| 13 | Determine backend connection | 29-09-2026 16:28:27 | 29-09-2026 16:28:27 | 0s | 0 | 0 | 0 | 0 | 0 (SKIPPED — capability absent — contract.path exists=False, want True) | 0 (SKIPPED) | -- |
| 14 | Mobile: Create feature branch | 29-09-2026 16:28:28 | 29-09-2026 16:29:13 | 45s | not available | not available | not available | not available | not available | not available | API Script |
| 15 | Mobile: Repo context | 29-09-2026 16:29:14 | 29-09-2026 16:29:19 | 5s | not available | not available | not available | not available | not available | not available | Script |
| 16 | Mobile: Resolve test target files | 29-09-2026 16:29:20 | 29-09-2026 16:29:25 | 5s | not available | not available | not available | not available | not available | not available | Script |
| 17 | Shared Context Bundle | 29-09-2026 16:29:26 | 29-09-2026 16:29:26 | 0s | not available | not available | not available | not available | not available | not available | Script |
| 18 | Git & MR | 29-09-2026 16:29:28 | 29-09-2026 16:29:30 | 2s | not available | not available | not available | not available | not available | not available | API Script |
| 19 | Validate verification evidence | 29-09-2026 16:29:31 | 29-09-2026 16:29:34 | 2s | not available | not available | not available | not available | not available | not available | API Script |
| 20 | Completion Summary | 29-09-2026 16:29:35 | 29-09-2026 16:29:35 | 0s | not available | not available | not available | not available | not available | not available | API Script |
| 21 | Write handoff doc | 29-09-2026 16:29:35 | 29-09-2026 16:29:35 | 0s | not available | not available | not available | not available | not available | not available | Script |
| 22 | Resolve tickets + post usage summary | 29-09-2026 16:29:36 | 29-09-2026 16:29:42 | 5s | not available | not available | not available | not available | not available | not available | Script |
| 23 | GAP — unattributed | 29-09-2026 16:29:42 | 30-09-2026 11:32:22 | 19h 3m | n/a | n/a | n/a | n/a | n/a — wait time, not compute | n/a — wait time, not compute | n/a |
| 24 | 1. Unit Tests (re-dispatched ×4; first attempt 29-09-2026 16:51:43) | 30-09-2026 11:32:22 | 30-09-2026 12:16:27 | 44m | 90 | 60,463 | 162,541 | 8,928,749 | 9,151,843 | $7.6189 | claude-sonnet-5 |
| 25 | Mobile: Join parallel gates | -- | 29-09-2026 16:29:27 | -- | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
| 26 | Join — all active sides implemented | -- | 29-09-2026 16:29:30 | -- | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
| 27 | Gate failure decision | -- | 29-09-2026 18:33:33 | -- | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
| — | ORCHESTRATOR TOTAL (rows 7–27) | — | — | 21s | 0 | 0 | 0 | 0 | 0 | $0.0000 | — |
| — | SHARED TOTAL (rows 1–24) | — | — | 48m | 2,655 | 79,944 | 232,206 | 8,928,749 | 9,243,554 | $8.3435 | — |
| — | GRAND TOTAL (wall clock) | 29-09-2026 16:25:20 | 30-09-2026 12:16:27 | 19h 51m | 2,655 | 79,944 | 232,206 | 8,928,749 | 9,243,554 | $8.3435 | — |
ORCHESTRATOR TOTAL: 21s, 0 tokens, $0.0000 (rows 7–27)
SHARED TOTAL: 48m, 9,243,554 tokens, $8.3435, 15 row(s) with no token data (rows 1–24)
Total Run Time: 19h 51m (wall clock, 29-09-2026 16:25:20 → 30-09-2026 12:16:27 IST — not a sum of the per-side totals above, since sides overlap)
Active time: 48m | Waiting (session limits, approvals, dead sessions): 19h 3m — 1 gap(s) still unattributed; label them with driver.py gap <slug> --from <ISO> --to <ISO> --reason '<why>'
Total Tokens Consumed: 9,243,554 (plus 15 row(s) whose usage was never captured — run execution_tracker.py enrich-audit to backfill. This is a floor, not the total.)
Token breakdown: input 2,655 · output 79,944 · cache-create 232,206 · cache-read 8,928,749 (97% of the total). Cache-read is context a node re-sends to itself across its own tool-use turns, billed at roughly a tenth of fresh input — a large Tokens number that is mostly cache-read is a long tool loop, not a large workload.
Total Cost: $8.3435 (plus 15 row(s) whose usage was never captured — run execution_tracker.py enrich-audit to backfill. This is a floor, not the total.)
BA Updated by Bot AI about 1 month ago
Account status — using account 1
- Window usage so far: 4,403,787 tokens ($16.50) — 11% of its own last observed ceiling
- Total dispatches on this account: 101
BA Updated by Bot AI about 1 month ago
Account status — account 1 hit its limit, switching away
- Reason: usage_limit
- Real usage at cutoff: 0 tokens ($0.00) — this becomes its new observed ceiling
- Cooling down until: 2026-09-29T12:46:25.049781+00:00
- Consecutive failures: 1
BA Updated by Bot AI about 1 month ago
Account status — using account 1
- Window usage so far: 0 tokens ($0.00) — 0% of its own last observed ceiling
- Total dispatches on this account: 102
BA Updated by Bot AI about 1 month ago
Account status — using account 1
- Window usage so far: 149,086 tokens ($0.55) — 3% of its own last observed ceiling
- Total dispatches on this account: 107