Skip to content

refactor(bayn): totalize evidence core - #13349

Merged
gregkonush merged 1 commit into
mainfrom
codex/bayn-total-evidence-core
Jul 28, 2026
Merged

refactor(bayn): totalize evidence core#13349
gregkonush merged 1 commit into
mainfrom
codex/bayn-total-evidence-core

Conversation

@gregkonush

@gregkonush gregkonush commented Jul 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Totalize owned canonicalization and reference replay identities with local typed failures while preserving every canonical hash input and historical golden.
  • Replace the generic EvidenceStore lifting boundary and test-only live constructor with pure row decisions, explicit error mapping, and dependency-record initialization.
  • Prove exact replay no-write behavior, typed divergent conflicts, duplicate-row failures, and transaction rollback in focused and PostgreSQL integration tests.
  • Remove eight exported one-to-one wrappers/aliases and reduce Effect generator orchestration without splitting cohesive modules.

Related Issues

None.

Compatibility and scope evidence

  • Base: 3a2d6aad649a5ec935b6efc291273f0818628ca5.
  • Exact canonical bytes remain {"a":{"10":1,"2":2},"z":[null,true,false,0,1.25,"é","😀"]} with SHA-256 eb5c6929cd35d9590df65fb9db0caf13177df754b1d99e17c8d58e30735486c9.
  • Independent reference replay and qualification-audit golden tests pass unchanged, including immutable historical protocol evidence.
  • PostgreSQL exact replay preserves the complete evidence graph byte-for-byte; divergent deterministic reuse returns typed PersistenceMismatch without writes; terminal constraint failure rolls back every evidence table.
  • Rechecked gh pr diff --name-only for refactor(bayn): make qualification decisions explicit #13342, refactor(bayn): extract autonomous cycle reconciliation core #13344, and test(bayn): add real Alpaca sandbox contract proof #13325 immediately before commit: zero changed-path overlap. No execution, broker, config/application, risk/capital-authority schema, strategy/market-data, workflow/Nix/GitOps, qualification, cycle, or reconciliation path is changed.
  • The final tree has exactly the same tracked directory set as base and changes no depsSource manifest or patch input, preserving the existing Bayn fixed-output dependency hash without touching excluded Nix files.

Metrics

Changed production surface, before → after:

  • LOC: 3,803 → 3,946.
  • Largest file: 481 → 487 LOC; no changed production file exceeds 500 LOC.
  • Exports: 135 → 143; added exports are typed identity/failure data and explicit initialization. Exported wrapper/alias family: 10 → 2.
  • Effect.gen: 16 → 13.
  • throw: 0 → 0; OperationalError: 0 → 0; Result.try: 2 → 2, limited to typed hostile-reflection/crypto containment.
  • Removed dependency edges from replay modules to the throwing hash facade and from four PostgreSQL programs to evidence-store/boundary; added one cohesive replay identity edge and consolidated typed database-error mapping.

Testing

  • bun run lint
  • bun run lint:oxlint
  • bun run lint:oxlint:type
  • bun run lint:effect — 331/331 files, zero errors, warnings, or messages.
  • bun run tsc
  • bun run build — 679 modules bundled.
  • bun run test — 820 passed, 0 failed, 122 PostgreSQL-gated tests skipped.
  • BAYN_TEST_POSTGRES_URL=postgresql://postgres@127.0.0.1:55432/bayn_total_evidence_test bun run test:postgres against an isolated local-forwarded test database — 114 passed, 0 failed: cycle observability 5, evidence store 66, accounting persistence 30, cycle store 13.
  • Final focused exact-head run — 89 passed, 0 failed across canonical hashing, independent replay, qualification audit, evidence recovery, qualification row decisions, and startup composition.
  • Pre-commit Oxfmt/Oxlint and commitlint hooks passed.

Breaking Changes

None. The removed canonical JSON aliases and EvidenceStore test constructor had no active production callers; the retained canonical hash compatibility alias still serves active out-of-scope callers.

Checklist

  • Testing section documents the exact validation performed.
  • Screenshots are not applicable; Breaking Changes is filled in.
  • No documentation or release-note change is required; compatibility and migration behavior are covered by tests and this PR evidence.

@gregkonush
gregkonush force-pushed the codex/bayn-total-evidence-core branch from 2570172 to 23de744 Compare July 28, 2026 09:12
@gregkonush

Copy link
Copy Markdown
Member Author

:shipit:

@gregkonush

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 23de744561

ℹ️ 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".

@gregkonush

Copy link
Copy Markdown
Member Author

Exact-head review/CI disposition before merge:

  • Codex reviewed 23de744561 and found no major issues.
  • Bayn pr-checks, Effect compatibility, broker sandbox contract, changed-area validation, repository CI, and PostgreSQL integration all pass on the exact head. The PostgreSQL rerun passed after one excluded cycle-recovery concurrency flake.
  • Both image jobs fail at the pre-existing Bayn Bun fixed-output hash (specified sha256-TnXW...). The exact base SHA 3a2d6aad649a5ec935b6efc291273f0818628ca5 has the same failed image workflow: run 30340552093.
  • This PR changes no Nix/workflow path, no package manifest/lock/patch input, and preserves the base tracked directory set. The image repair is explicitly outside this PR's ownership.

@gregkonush
gregkonush merged commit fed9a99 into main Jul 28, 2026
17 of 20 checks passed
@gregkonush
gregkonush deleted the codex/bayn-total-evidence-core branch July 28, 2026 09:24
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.

1 participant