fix(bayn): preserve bar evidence and enforce replay completeness - #14593
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 35bf18d780
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
missing-decision-dataandINCOMPLETEeven with flat, exact accounting.Related Issues
None. These changes address four independently reproduced correctness defects in the Bayn follow-up audit.
Testing
3da7138658: 5 failures reproduced before the fixes, with 39 other focused tests passing.bun run --filter @proompteng/bayn test: 1,274 passed, 101 integration/environment cases skipped, 0 failed.bun run --filter @proompteng/bayn test:postgres: 68 passed against isolated PostgreSQL 17.11.bun test src/intraday-replay/runtime.integration.test.ts src/intraday-replay/durable-broker.integration.test.ts: 10 passed. Includes production fallback MARKET/DAY liquidation with exact accounting, native missing-benchmark/no-trade controls, fractional fill accounting and client restart. Coverage controls exercise a bounded native decision interval, not a full economic study.bun test src/intraday-replay/restart.integration.test.ts: 1 passed in the required disposablebayn_testdatabase. The first attempt used another_testdatabase and was correctly rejected by the test's environment guard.bun test services/bayn/src/market-data/streaming/bar-publication.test.ts: 10 passed, including live and simulated reconstruction, legacy cuts, changed late data, feature mismatch, publication tampering and stale/future data.bun run --filter @proompteng/bayn tsc,lint,lint:oxlint,lint:oxlint:type, andbuild: passed. Bun 1.4.0 and pinned Node 24.11.1 were used.nix developwas unavailable because the local Nix daemon was stopped; the pinned Node binary was available in the Nix store.Breaking Changes
No database migration. New cuts include a versioned bar-publication policy and optional publication witnesses; this version still reproduces legacy cuts. Older binaries cannot interpret the new evidence fields.
The replay market-close model requires enough fresh displayed liquidity for a complete fill. It fails explicitly for an unsupported DAY remainder instead of estimating later fills. This change does not qualify a strategy's profitability or change trading authority, quote-size units, or strategy thresholds.
Checklist