Feature #3418
open[drcarrot-mobile-reports] 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 Reports module to achieve full code coverage.
Target Coverage¶
- Statements: 90%+
- Branches: 85%+
- Functions: 90%+
- Lines: 90%+
These targets must match the repo's global coverage thresholds in jest.config.js.
Scope¶
Cover every layer that exists for the Reports module:
- Service:
src/services/ReportsService.tsor equivalent - Hooks:
src/hooks/reports/** - Screens:
src/screens/Reports/** - Sections/components:
src/sections/reports/**orsrc/components/reports/** - Utils:
src/utils/reports/** - Redux slice, if present:
src/store/slices/reportsSlice.ts - Storybook stories, if present:
src/sections/reports/**/*.stories.tsxsrc/components/reports/**/*.stories.tsx
- Tracing, if present:
src/traces/reports.ts
Storybook Tests¶
If Reports contains .stories.tsx files:
- Create tests under:
src/__tests__/sections/reports/<Component>.stories.test.tsx - Import every named story export.
- Render every exported story using the same RTL helpers already used elsewhere in the project.
- Verify every story renders without crashing.
- Verify story args/controls match the component prop types.
- Tag Storybook tests with
@p2, unless the story is the only meaningful coverage for a component, in which case use@p1.
Trace Tests¶
If src/traces/reports.ts exists, create:
src/__tests__/traces/reports.test.ts
Mock src/utils/otel.ts exactly as existing trace tests do.
For every exported span-builder/helper, verify:
- Span name
- Span attributes
- Successful execution
status=ERRORon failure- Error recording on failure
Use:
@p1for successful execution tests@p2for failure-path tests
Test Priority Tags¶
Every it() / test() title must start with @p1, @p2, or @p3.
@p1 — Critical Path¶
Cover:
- Component/hook renders or initializes without crashing
- Empty/loading/no-records states
- Core Reports happy paths
- Primary API success and failure handling
- Required-field validation
- Status/data mapping
- Auth/permission gates that block access
@p2 — Important Secondary Behavior¶
Cover:
- Search/sort/filter interactions
- API parameter wiring
- Pagination
- Dialog open/close/cancel
- Permission-based UI hiding
- Refresh/pull-to-refresh
- Secondary API errors
- File upload validation, if applicable
- Report generation/download/sequence behavior, if applicable
@p3 — Edge Cases¶
Cover:
null/undefined/ boolean coercion- Malformed or partial API responses
- Invalid/boundary dates
- Non-matching selections
- Whitespace-only/empty search
- Independent toggle states
Test Implementation Requirements¶
-
Inspect all Reports source files line by line before writing tests.
-
Exercise every:
- Conditional
- Ternary
- Optional-chaining fallback
- Switch/case branch
- Validation branch
- Success path
- Error path
- Use the existing mock boilerplate patterns in this repo.
Use these reference tests:
src/__tests__/services/ProcurementsService.test.tssrc/__tests__/hooks/procurement/usePurchaseBill.test.ts
- Mock the following exactly as the reference tests do:
ApiClientAsyncStorageLogger- Navigation
Do not introduce a new mocking approach.
- Organize tests using
describe()blocks by behavior area:
- Core behavior
- Search & sort
- Pagination
- Permissions
- Error handling
- Edge cases
-
Do not use
anyor other explicit unsafe types in test code. -
Do not add:
- Skipped tests
- Pending tests
- Unnecessary snapshot tests
-
Do not modify production/business logic.
-
Only add or update the required Jest test files and test configuration if absolutely necessary for priority filtering.
-
Do not create unnecessary documentation.
Coverage Validation¶
After implementing the tests, run:
BA Updated by Bot AI about 1 month ago
Account status — using account 3
- Window usage so far: 10,787,167 tokens ($6.66) — 423% of its own last observed ceiling
- Total dispatches on this account: 11
BA Updated by Bot AI about 1 month ago
Account status — using account 3
- Window usage so far: 10,846,320 tokens ($7.09) — 426% of its own last observed ceiling
- Total dispatches on this account: 12
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 | 17-09-2026 16:56:56 | 17-09-2026 16:57:06 | 9s | 2 | 129 | 18,893 | 11,171 | 30,195 | $0.1218 | claude-sonnet-5 |
| 2 | Initialise run ticket (timing anchor) | 17-09-2026 16:57:06 | 17-09-2026 16:57:07 | 1s | not available | not available | not available | not available | not available | not available | Script |
| 3 | Probe environment | 17-09-2026 16:57:07 | 17-09-2026 16:57:21 | 13s | not available | not available | not available | not available | not available | not available | API Script |
| 4 | GAP — unattributed | 17-09-2026 16:57:21 | 17-09-2026 17:49:11 | 52m | n/a | n/a | n/a | n/a | n/a — wait time, not compute | n/a — wait time, not compute | n/a |
| 5 | Extract ticket-spec, acceptance criteria & test scenarios (re-dispatched ×2; first attempt 17-09-2026 16:57:22) | 17-09-2026 17:49:11 | 17-09-2026 17:51:53 | 3m | 2,545 | 22,249 | 22,201 | 15,644 | 62,639 | $0.4823 | claude-sonnet-5 |
| 6 | Prepare execution plan | 17-09-2026 17:51:53 | 17-09-2026 17:51:53 | 0s | not available | not available | not available | not available | not available | not available | Script |
| 7 | Initialise timing note | 17-09-2026 17:51:54 | 17-09-2026 17:51:55 | 0s | not available | not available | not available | not available | not available | not available | API Script |
| 8 | Execution plan — human gate | 17-09-2026 17:51:55 | 17-09-2026 17:52:28 | 33s | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
| 9 | Mobile & Web task redmine ticket creations — mobile | 17-09-2026 17:52:37 | 17-09-2026 17:52:39 | 2s | not available | not available | not available | not available | not available | not available | API Script |
| 10 | Cross-link tickets | 17-09-2026 17:52:40 | 17-09-2026 17:52:41 | 0s | not available | not available | not available | not available | not available | not available | API Script |
| 11 | Write contract file | 17-09-2026 17:52:41 | 17-09-2026 17:52:41 | 0s | 0 | 0 | 0 | 0 | 0 (SKIPPED — capability absent — sides.backend.live_verified.verdict = , want one of ['PASSED', 'SKIPPED']) | 0 (SKIPPED) | -- |
| 12 | Validate contract vs screens | 17-09-2026 17:52:42 | 17-09-2026 17:52:42 | 0s | 0 | 0 | 0 | 0 | 0 (SKIPPED — capability absent — contract.path exists=False, want True) | 0 (SKIPPED) | -- |
| 13 | Propagate contract to consumer repos | 17-09-2026 17:52:42 | 17-09-2026 17:52:42 | 0s | 0 | 0 | 0 | 0 | 0 (SKIPPED — capability absent — contract.path exists=False, want True) | 0 (SKIPPED) | -- |
| 14 | Determine backend connection | 17-09-2026 17:52:42 | 17-09-2026 17:52:42 | 0s | 0 | 0 | 0 | 0 | 0 (SKIPPED — capability absent — contract.path exists=False, want True) | 0 (SKIPPED) | -- |
| 15 | Mobile: Create feature branch | 17-09-2026 17:52:43 | 17-09-2026 17:53:01 | 17s | not available | not available | not available | not available | not available | not available | API Script |
| 16 | Mobile: Repo context | 17-09-2026 17:53:01 | 17-09-2026 17:53:09 | 7s | not available | not available | not available | not available | not available | not available | Script |
| 17 | Mobile: Resolve test target files | 17-09-2026 17:53:10 | 17-09-2026 17:53:10 | 0s | not available | not available | not available | not available | not available | not available | Script |
| 18 | Shared Context Bundle | 17-09-2026 17:53:11 | 17-09-2026 17:53:11 | 0s | not available | not available | not available | not available | not available | not available | Script |
| 19 | GAP — account 2 usage_limit cooldown | 17-09-2026 17:53:11 | 17-09-2026 20:07:45 | 2h 15m | n/a | n/a | n/a | n/a | n/a — wait time, not compute | n/a — wait time, not compute | n/a |
| 20 | 1. Unit Tests (re-dispatched ×2; first attempt 17-09-2026 17:53:12) FAILED | 17-09-2026 20:07:45 | 17-09-2026 20:09:55 | 2m | not available | not available | not available | not available | not available | not available | not recorded |
| 21 | Human intervention (escape hatch) | -- | 17-09-2026 17:49:06 | -- | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
| 22 | Gate failure decision | -- | 18-09-2026 11:26:43 | -- | n/a | n/a | n/a | n/a | n/a | n/a | n/a |
| — | ORCHESTRATOR TOTAL (rows 8–22) | — | — | 33s | 0 | 0 | 0 | 0 | 0 | $0.0000 | — |
| — | SHARED TOTAL (rows 1–20) | — | — | 6m | 2,547 | 22,378 | 41,094 | 26,815 | 92,834 | $0.6041 | — |
| — | GRAND TOTAL (wall clock) | 17-09-2026 16:56:56 | 18-09-2026 11:26:43 | 18h 30m | 2,547 | 22,378 | 41,094 | 26,815 | 92,834 | $0.6041 | — |
ORCHESTRATOR TOTAL: 33s, 0 tokens, $0.0000 (rows 8–22)
SHARED TOTAL: 6m, 92,834 tokens, $0.6041, 11 row(s) with no token data (rows 1–20)
Total Run Time: 18h 30m (wall clock, 17-09-2026 16:56:56 → 18-09-2026 11:26:43 IST — not a sum of the per-side totals above, since sides overlap)
Active time: 15h 23m | Waiting (session limits, approvals, dead sessions): 3h 6m — 1 gap(s) still unattributed; label them with driver.py gap <slug> --from <ISO> --to <ISO> --reason '<why>'
Total Tokens Consumed: 92,834 (plus 11 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,547 · output 22,378 · cache-create 41,094 · cache-read 26,815 (29% 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: $0.6041 (plus 11 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 3
- Window usage so far: 10,908,959 tokens ($7.57) — 428% of its own last observed ceiling
- Total dispatches on this account: 13
BA Updated by Bot AI about 1 month ago
Account status — using account 3
- Window usage so far: 10,908,959 tokens ($7.57) — 428% of its own last observed ceiling
- Total dispatches on this account: 14
BA Updated by Bot AI about 1 month ago
Account status — using account 3
- Window usage so far: 10,908,959 tokens ($7.57) — 428% of its own last observed ceiling
- Total dispatches on this account: 15
BA Updated by Bot AI about 1 month ago
Account status — using account 3
- Window usage so far: 10,908,959 tokens ($7.57) — 428% of its own last observed ceiling
- Total dispatches on this account: 16
BA Updated by Bot AI about 1 month ago
Account status — using account 3
- Window usage so far: 10,908,959 tokens ($7.57) — 428% of its own last observed ceiling
- Total dispatches on this account: 17