Skip to content

Fix 118 validate time remaining address - #386

Merged
godamongstmen897 merged 1 commit into
Goldii-locks:mainfrom
Davoski1:fix-118-validate-time-remaining-address
Aug 30, 2026
Merged

Fix 118 validate time remaining address#386
godamongstmen897 merged 1 commit into
Goldii-locks:mainfrom
Davoski1:fix-118-validate-time-remaining-address

Conversation

@Davoski1

Copy link
Copy Markdown
Contributor

Closes #118

🎯 Problem & Goal

The issue required ensuring that all addresses passed to the GET /api/jobs/:contractId/milestones/:index/time-remaining endpoint are strictly validated for their Stellar address format, and that invalid inputs correctly return a 400 Bad Request. While the contractMilestoneParamsSchema zod schema was correctly wired to perform this validation, the test cases proving and guaranteeing this contract behavior were missing.

🛠 Context & Components

  • Target Repository: escrow-backend
  • Module/Component: GET /api/jobs/:contractId/milestones/:index/time-remaining
  • Files Modified:
    • __tests__/time-remaining.test.ts

🚀 Implementation Details

  • Verified the runtime validation logic (isValidStellarContractId) used by contractIdSchema in src/schemas/jobs.ts.
  • Inserted a new test suite block Address Validation (#118) specifically targeting the time-remaining route.

✅ Verification & Testing Requirements

  • Validation check (Invalid Format): Added a test asserting that passing a malformed string returns a 400 Bad Request containing a clear ValidationError payload with the contractId field highlighted.
  • Validation check (Incorrect Address Type): Added a test asserting that passing a structurally valid Stellar Account Address (G...) into the contractId parameter (which expects C...) correctly rejects it with a 400.
  • Suite Compilation: Executed npm test -- __tests__/time-remaining.test.ts and confirmed all 26 tests compile and pass seamlessly.

@drips-wave

drips-wave Bot commented Aug 29, 2026

Copy link
Copy Markdown

@Davoski1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Davoski1
Davoski1 force-pushed the fix-118-validate-time-remaining-address branch from 1b8a0d9 to 74c10c7 Compare August 29, 2026 17:40
@godamongstmen897
godamongstmen897 merged commit ac3ea5e into Goldii-locks:main Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Validate Stellar address formats on GET /api/jobs/:contractId/milestones/:index/time-remaining

2 participants