Skip to content

feat(erp-engine): op-group atomicity (I-K) + rate-as-op-input (I-J) + BigDecimal enforced#8

Open
red1oon wants to merge 6 commits into
fullfrom
feat/erp-write-path-ik-ij
Open

feat(erp-engine): op-group atomicity (I-K) + rate-as-op-input (I-J) + BigDecimal enforced#8
red1oon wants to merge 6 commits into
fullfrom
feat/erp-write-path-ik-ij

Conversation

@red1oon

@red1oon red1oon commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Browser write-path engine work under the delegate-to-install spine decision (prompts/ENGINE_FULL_ERP_ISSUES.md §0.0).

What landed

  • I-K op-group atomicity — kernel commitGroup (N ops, ONE group hash, all-or-none, sealed once from the tip → also flattens the I-D O(n²) per-op reseal). UI commitProcess commits the doc action via commitGroup. Consequence ops (ship/invoice/postings) are a NON-INVENT, clearly-marked DELEGATED extension point (install-side I-C/I-G) — never fabricated in the browser.
  • I-J rate-as-op-inputassertRateAsInput guard wired into commitGroup: a conversion-bearing op MUST carry rate/rateDate/rateSource or the whole group rejects (multi-currency disabled until rate-as-input).
  • BigDecimal enforcedbigdecimal.js loaded in glassbowl.html before the kernel; the I-J conversion math uses exact BigDecimal, never raw JS float.

Verification (all re-run independently)

  • Witnesses PASS: poc_opgroup, poc_crud_group, poc_rate_input, poc_chain, poc_kernel.
  • Real-browser localhost probe PASS (kernel v8, no page errors, in-browser commitGroup + rate guard + BigDecimal present).
  • Postgres-15 primitive benchmark (bench_oplog_pg) — honest storage-only scope, no over-claim (mature PG is faster at the raw primitive; the browser edge is locality, not speed).

site/ is the gitignored publish mirror of build/erp/ (tracked source). Kernel bumped to v8.

🤖 Generated with Claude Code

red1oon and others added 6 commits June 3, 2026 17:34
… BigDecimal enforced

Browser write-path engine work, under the delegate-to-install spine decision.

- I-K op-group atomicity: kernel commitGroup (N ops, ONE group hash, all-or-none,
  sealed once from tip — which also flattens the I-D O(n^2) per-op reseal). UI
  commitProcess now commits the doc action via commitGroup. The consequence set
  (ship/invoice/postings) is a NON-INVENT, clearly-marked DELEGATED extension
  point (install-side I-C/I-G), never fabricated in the browser.
- I-J rate-as-op-input: assertRateAsInput guard wired into commitGroup — a
  conversion-bearing op MUST carry rate/rateDate/rateSource or the whole group
  rejects (multi-currency disabled until rate-as-input).
- BigDecimal enforced: bigdecimal.js loaded in glassbowl.html before the kernel;
  the I-J conversion math uses exact BigDecimal, never raw JS float.

Witnesses (all PASS, re-run independently): poc_opgroup, poc_crud_group,
poc_rate_input, poc_chain, poc_kernel. Real-browser localhost probe PASS.
Postgres-15 primitive benchmark (bench_oplog_pg) — honest storage-only scope,
no over-claim. Kernel v8. site/ is the gitignored publish mirror of build/erp/.

Tracker + decisions: prompts/ENGINE_FULL_ERP_ISSUES.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e tracker

Captures the final session state in ENGINE_FULL_ERP_ISSUES.md (was written after
the first commit): bigdecimal.js loaded in glassbowl.html + I-J conversion via
exact BigDecimal (browser-verified); deployed to feat/erp-write-path-ik-ij / PR #8.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…s exact == golden

report_overlay.js foldReceipt/foldTrialBalance/foldPnL now accumulate in BigDecimal
(exact 2dp string leaf, balanced via exact isZero) instead of raw Number+round2.
Probed first: the real divergence is signed sub-cent + magnitude >2^53c (MEASURED,
not "round2 is broken"). Witness poc_money_fold.js §MONEY-FOLD PASS (11/11): OLD raw
fold diverges from java.math.BigDecimal, LIVE folds == proven golden. test_report_*
updated to the exact-string contract (ALL PASS). erp_postings.js audited integer-cent,
left as-is. FRONTEND_LANE_MASTER §OUTSTANDING records the parked UI backlog.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…d ∝ open period

Additive kernel v8→v9 (build/erp/kernel_ops.js): kernel_checkpoints table +
closePeriod(db,{balances}) (signs head|at_op_id|balances_digest) + latestCheckpoint
+ opt-in verifyChain(db,{fromCheckpoint}). Default verifyChain UNCHANGED.

Closes the I-D residual: full verifyChain walked the whole log from GENESIS every
call (∝ total history). Bounded verify now starts at the latest signed checkpoint
(∝ open period). Grounded in ERP.md §18.9 + HolyGrail.md §1 (balance brought forward).

Witness scripts/poc_checkpoint.js → §CHECKPOINT PASS (9/9). MEASURED I-D win:
full verify 24→93ms over 4 periods (grows); bounded 25→23ms (FLAT, 4× @period4).
C2 open-period tamper still caught; C3 signed head == sealed close tip + cold tamper
proven by full verify (bounded trusts the signed anchor — stated trade); C4 forged
anchor rejected; C5 deterministic; C6 default path unchanged. All 5 guardrail
witnesses GREEN (additive, no regression).

NON-INVENT: kernel only anchors+signs caller-supplied balances, never computes them.
Mirror drift flagged (site v6/deploy/dev v4 vs build/erp v9) — pre-existing, GO-gated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
scripts/probe_localhost_v9.js — loads the served glassbowl ERP (site/ @ :8848,
coherent build/erp v9 publish) in real Chromium and confirms: 0 pageerrors,
kernel v9+W-CHECKPOINT served/loaded, §I-D (closePeriod/latestCheckpoint) +
§I-K (commitGroup) primitives exported, the iDempiere spine UI renders (481 SVG
nodes, 6 workflows), an in-browser period-close checkpoint round-trips (bounded
verify scans only from the checkpoint), and the mobile UI reveals its touch-only
#diagBtn on a ≤760px viewport. §PROBE PASS. Wiring/deploy check (§-log first per
CLAUDE.md), not a value witness — correctness is poc_checkpoint.js.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…PEC §4) + idempiere localhost probe

§4 "After the receipt" names a forgotten thread: today the receipt is view-only
(report_overlay.js, close ✕ only — no print/share/save/email/persist). Separates the
TWO concerns the gap conflated:
 4.1 OUTPUT/DELIVERY (human) — Print/Share/Save-PDF via window.print + navigator.share
     (edge/OS, server-free; SocialPlatformLens:64) + channel deliver (GuaranteedChannels).
     Tasks R4 §RPT-OUT, R5 §RPT-SEND. Receipt is a projection → re-fold from the op (log-first).
 4.2 CONSEQUENCE/POSTING (ledger) — Complete's ship/invoice/Dr-AR/Cr-Rev is DELEGATED
     install-side (§I-K / §13.6); commitProcess flips status only → "Completed" ≠ books moved.
 4.3 open lifecycle: CL/Void/Reverse/archive + multi-doc chaining named, not built.

probe_idempiere_v9.js — localhost wiring smoke for the REAL renderer (bim-ootb/erp/
idempiere.html) on the v9 kernel: §IPROBE PASS — boots clean, login→role-scoped chrome
renders (GardenWorld, 2789 menu nodes), commitOp write path works on v9 (no regression),
bounded checkpoint round-trips, mobile clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
red1oon added a commit that referenced this pull request Jun 10, 2026
…lows oracle-diff closed

- foldStatement now oracle-equivalent for ALL 3 PA_Reports: 102 Cash Flows
  maxDiff=0c (140 seg cells, non-vacuous) in both witnesses (engine + bundle-alone)
- NEW pure verb foldPrint: recursive 'P' master-detail + PrintDataGroup row engine
  (sort/group/sum/count/avg, one BigDecimal pass) — replaces DataEngine+PrintDataGroup;
  renderPrint DOM replaces LayoutEngine/Jasper
- W-PRINTFORMAT GREEN: format 120 Invoice Header -> 'P' -> 121 Invoice LineTax,
  8/8 seed invoices, 48 cells maxDiff=0c vs live base tables + stored grandtotal;
  falsifiers drop-P / +1c-mis-sum / drop-link all fire (PrintData TREE, not pixels)
- NEW scripts/extract_printformat.sh: ad_printformat(93)+items(2780)+materialized
  print views into the bundle (PG evaluates the view SQL — never reimplemented)
- Browser: data-gated "iDempiere format" print button + Trial Balance menu leaf
  (502 -> foldTrialBalance); Statement of Accounts (350) named-deferred
- poc_pa_report.js re-pointed at the bundle (ad_full.db concurrently clobbered)
- Docs: ReportingFold EXECUTED + as-built 4b/4c; matrix PA_Report/AD_PrintFormat
  rows oracle-equivalent (headless ceiling); paper GAP #8 narrowed to its tail

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
red1oon added a commit that referenced this pull request Jun 12, 2026
…POS+WH walk roadmap→LIVE, reporting BS+IS+CF+print, re-measured LOC 28,184/132 (51× shell, 21× conservative) + full-width seed 26.1MB/1.7×, DR glance card sourced, caveats #6/#8 reconciled, pillars line (user prose)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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