This plan addresses test failures from bash tests/run_tests.sh, focusing on path malformation (double slashes), error handling (unexpected 500s), and graceful handling of missing Hiro keys. It is sequenced for quick wins first. After each step, re-run tests and update this file with status (e.g., [x] Completed).
-
Fix Test Script to Eliminate Double Slashes (Quick Win)
- In
tests/test_contract_calls.shandtests/run_tests.sh, trim trailing/from API_URL. - Why: Prevents // paths in requests.
- Assigned: Developer
- Status: Completed
- In
-
Normalize Paths in ContractCallsDO for Robustness
- Add path normalization in
src/durable-objects/contract-calls-do.ts. - Why: Handles double slashes gracefully.
- Assigned: Developer
- Status: Completed
- Add path normalization in
-
Improve Error Handling to Prevent Unexpected 500s
- Add try-catch in
src/durable-objects/contract-calls-do.ts,src/services/request-queue-service.ts, and debug logs insrc/services/stacks-api-service.ts. - Why: Ensures correct status codes (e.g., 404 instead of 500).
- Assigned: Developer
- Status: Completed
- Add try-catch in
-
Handle Hiro Key Absences Gracefully
- Add warnings for missing keys in
src/durable-objects/contract-calls-do.ts,src/services/stacks-api-service.ts, andsrc/config.ts. - Why: Improves debuggability without crashing.
- Assigned: Developer
- Status: Completed
- Add warnings for missing keys in
-
Test, Validate, and Document
- Re-run
bash tests/run_tests.shafter each step. - Update
docs/RETRO.mdwith resolutions. - Test edge cases (e.g., manual curls with double slashes).
- Assigned: Tester/Developer
- Status: Completed
- Re-run
- Track progress by checking boxes.
- If new issues arise, add to
docs/QUESTIONS.mdand revise this plan. - External: HIRO_API_KEYS setup is separate; monitor for rate limit impacts.
Based on latest test output (6 failures: 500s for base/known/ABI/invalid, decode error with "config2.getHiroDoNames is not a function"), root cause is a bug in src/index.ts DO routing (calling getHiroDoNames on config object instead of AppConfig instance, causing TypeError turned to 500). Read-only succeeded possibly due to fast-path cache hit. Invalid returns correct NOT_FOUND body (likely 404 status), but test reports 500—clarify in QUESTIONS.md.
-
Fix DO Selection Bug in index.ts
- Change config.getHiroDoNames() to AppConfig.getInstance(env).getHiroDoNames() in src/index.ts.
- Why: Corrects method call to avoid TypeError and ensure proper DO routing.
- Assigned: Developer
- Status: Completed
-
Investigate and Fix Test Script Status Checks
- Inspect utils.sh (add to chat if needed) and adjust test_endpoint to correctly parse status for error responses.
- Why: Test reports 500 for invalid but manual curl shows expected NOT_FOUND body; ensure test checks actual HTTP status.
- Assigned: Developer
- Status: Completed
-
Re-Test and Validate
- Re-run
bash tests/run_tests.shand manual curls after fixes. - If 500s persist for ABI/known, check server logs for requestIds (e.g., "f67162e8") to trace.
- Update RETRO.md with resolutions.
- Assigned: Tester/Developer
- Status: Completed
- Re-run