Cover both boot repair booking markers by jay23606 · Pull Request #1416 · atomantic/critical-mass · GitHub
Skip to content

Cover both boot repair booking markers - #1416

Merged
atomantic merged 1 commit into
atomantic:mainfrom
jay23606:pr-go/1394-boot-annotation-repair-overwrites-correc
Oct 21, 2026
Merged

atomantic merged 1 commit into
atomantic:mainfrom
jay23606:pr-go/1394-boot-annotation-repair-overwrites-correc

Conversation

@jay23606

Copy link
Copy Markdown
Contributor

Bug

Boot annotation repair could overwrite a correctly booked sell with negative P&L. The regression test previously covered only bodyBookedSize and bodyBooked; the bodyBooked marker was untested.

Change

Added a regression case for a negatively booked sell marked with bodyBooked; the booking guard already preserves both markers.

Testing

  • node --require ./tests/quiet-console.js --test tests/repair-historical-fill-annotations.test.js (expected failure with the booking guard removed; passed with the fix restored).

Fixes #1394

@jay23606

Copy link
Copy Markdown
Contributor Author

@atomantic atomantic left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Approved

The change correctly preserves booked sells with negative P&L by checking for booking markers, addressing a bug where historical fills were incorrectly overwritten. The included tests confirm the fix and regression.

Scope: accounting logic in src/regime-engine.js and test cases in tests/repair-historical-fill-annotations.test.js

Test evidence

  • ✅ node --require ./tests/quiet-console.js --test tests/repair-historical-fill-annotations.test.js — All tests passed, including the new tests added to cover the fix.
Claims verified against the code
  • src/regime-engine.js:833: The isBooked variable correctly identifies orders with booking markers.

@atomantic
atomantic merged commit 69a9d79 into atomantic:main Oct 21, 2026
1 check passed
@jay23606
jay23606 deleted the pr-go/1394-boot-annotation-repair-overwrites-correc branch October 22, 2026 19:51
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.

Boot annotation repair overwrites correctly booked sells whose body P&L is legitimately negative

2 participants