Skip to content

feat(discipline): add bond slashing curves - #814

Draft
jay23606 wants to merge 1 commit into
TheVicky1:mainfrom
jay23606:feat/802-bond-slashing
Draft

jay23606 wants to merge 1 commit into
TheVicky1:mainfrom
jay23606:feat/802-bond-slashing

Conversation

@jay23606

Copy link
Copy Markdown
Contributor

PACT Pull Request

1. Related Issue

Closes #802

2. Summary of Changes

Adds a pure commitment-bond slashing calculator with the requested linear, quadratic, and grace-cliff models. The quadratic model is the default; bond amounts remain integer cents.

3. Motivation & Context

Progressive penalties preserve a refund for commitments completed late within the configured maximum window, while still allowing full forfeiture after that window.

4. Implementation Details

  • Applies a configurable grace period, then normalizes elapsed lateness up to the maximum.
  • Implements linear, quadratic, and 25%-cliff-then-linear rates.
  • Validates safe integer cents and duration settings, rounds the penalty to cents, and derives the refund from the actual rounded amount.
  • Extends the existing bond-slashing test file without removing its finance-policy coverage.

5. Testing & Local Validation

  • npm run test:file -- bond-slashing.test.ts — 25 tests passed twice; the new tests fail on base because the discipline module is absent.
  • npx tsc --noEmit — passed.
  • npm run lint -- --no-ignore src/lib/discipline/bond-slashing.ts tests/bond-slashing.test.ts — passed.
  • node scratch/secret-scan.mjs — passed.

The full test matrix and production build were not run.

10. Reviewer Notes

This PR adds the requested utility and tests; it does not wire the utility into an existing commitment workflow.

Closes TheVicky1#802

Signed-off-by: jay23606 <4602056+jay23606@users.noreply.github.com>
@vercel

vercel Bot commented Nov 23, 2026

Copy link
Copy Markdown

@jay23606 is attempting to deploy a commit to the Vicky's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

This branch has not been deployed

No deployments
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.

[Discipline] Add Commitment Bond Forfeiture Slashing Velocity & Grace Decay Curve in src/lib/discipline/bond-slashing.ts

1 participant