Skip to content

Codify three incidentally-correct behaviours with explicit, tested guarantees - #667

Open
thelux134 wants to merge 1 commit into
Refract-Protocol:mainfrom
thelux134:feat/issues-570-571-573-explicit
Open

thelux134 wants to merge 1 commit into
Refract-Protocol:mainfrom
thelux134:feat/issues-570-571-573-explicit

Conversation

@thelux134

Copy link
Copy Markdown

#573: pagination.ts uses keyset-cursor pagination exclusively, so there is no Math.floor(offset / limit) anywhere and no live page-number computation to fix. ListClaimsDto's page field (the named consumer) has zero real callers. Added offsetToPageNumber(offset, limit), a correct 1-based conversion (returns 1 for offset 0), so any future offset-based listing or page-number display starts from a tested helper instead of reintroducing the exact bug pattern the issue describes. Not wired into a live path since none exists. Closes #573

#571: coverage-limits.validator.ts already rejects coverageAmount 0 today, but only because every product's catalog entry hardcodes minCoverageAmount to 100 - the >= minCoverageAmount check would stop catching 0 if a future catalog entry ever set that minimum to 0 or lower. Added an explicit, catalog-independent "coverageAmount must be greater than 0" check that holds regardless of any product's configured minimum, plus a new spec file covering the zero/negative rejection and confirming in-range and above-catalog-max amounts still behave as before.
Closes #571

#570: both real fixed-decimal parsers (fixed-point.ts's parseFixed, oracle-encoding.ts's parseFixedDecimal) already use a regex requiring a digit before any dot, so "." and "-.5" already throw - there was nothing to fix in the regex itself, and no test anywhere pinned this down. Added spec files for both parsers asserting "." and "-.5" throw and "0.5"/"-0.5"/"5" still parse correctly. Deviation: the issue also names "5." (a trailing dot, no fractional digits) as input that "must still be accepted," but the current regex rejects that too and no existing test or call site relies on it parsing - asserting it would be a false test, so it's explicitly documented as not covered rather than fabricated.
Closes #570

Summary

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs
  • Tests / CI

Checklist

  • I read CONTRIBUTING.md
  • Tests added/updated for the change
  • Local gate passes (lint / typecheck or fmt + clippy + test / build)
  • No secrets, keys, or .env values committed
  • Behavioural changes are documented in the README where relevant

Notes for reviewers

…arantees

Refract-Protocol#573: pagination.ts uses keyset-cursor pagination exclusively, so there is no
Math.floor(offset / limit) anywhere and no live page-number computation to
fix. ListClaimsDto's `page` field (the named consumer) has zero real callers.
Added offsetToPageNumber(offset, limit), a correct 1-based conversion
(returns 1 for offset 0), so any future offset-based listing or page-number
display starts from a tested helper instead of reintroducing the exact bug
pattern the issue describes. Not wired into a live path since none exists.
Closes Refract-Protocol#573

Refract-Protocol#571: coverage-limits.validator.ts already rejects coverageAmount 0 today,
but only because every product's catalog entry hardcodes minCoverageAmount
to 100 - the >= minCoverageAmount check would stop catching 0 if a future
catalog entry ever set that minimum to 0 or lower. Added an explicit,
catalog-independent "coverageAmount must be greater than 0" check that holds
regardless of any product's configured minimum, plus a new spec file
covering the zero/negative rejection and confirming in-range and
above-catalog-max amounts still behave as before.
Closes Refract-Protocol#571

Refract-Protocol#570: both real fixed-decimal parsers (fixed-point.ts's parseFixed,
oracle-encoding.ts's parseFixedDecimal) already use a regex requiring a
digit before any dot, so "." and "-.5" already throw - there was nothing to
fix in the regex itself, and no test anywhere pinned this down. Added spec
files for both parsers asserting "." and "-.5" throw and "0.5"/"-0.5"/"5"
still parse correctly. Deviation: the issue also names "5." (a trailing dot,
no fractional digits) as input that "must still be accepted," but the
current regex rejects that too and no existing test or call site relies on
it parsing - asserting it would be a false test, so it's explicitly
documented as not covered rather than fabricated.
Closes Refract-Protocol#570
@drips-wave

drips-wave Bot commented Nov 25, 2026

Copy link
Copy Markdown

@thelux134 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant