Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
Fix the strict self-review findings on PR #1740
Branch rillet-ramp-accounting-provider. Source: the /self-review strict pass
over 4df5f8c9bd...HEAD, five areas. Every item below was verified against the
code before being listed. Checkboxes are the progress record.
Decisions taken (flagged for veto)
- D-1
itemin the master-data sweep.MASTER_DATA_SWEEP_TARGETSpushes 500 unmapped items/hour, which reinstates the catalog mirroring that commit0f54877c0eremoved the subscription to stop. DECISION: drop theitemtarget from the sweep. The JITensureDependencySynced("item")path from orders and inventory adjustments still pushes the items a synced document names, which is the whole set that belongs in a provider. The one-shot Push customers, vendors & items action stays for a deliberate full import. - D-2 The document-level contact field.
requiredContactFieldon six documents breaks editing an existing document for an unrelated reason, is absent from all six CREATE actions, and asks the wrong question — Ramp needs the SUPPLIER to have an emailable contact, not the document to name one. DECISION: delete the field-level requirement and the sixmake*Validatorfactories; keepcheckPartyContactRequirementat the six release/post boundaries as the single bar. Fixes both findings by deleting the mechanism rather than patching it. - D-3 Memo direction. Restore an explicit stored
directionrather than deriving it from the party, so all four legal party×direction combinations stay authorable and an existing row is never rewritten on save. - D-4 Memo void on Xero/QBO. Out of scope for this pass: it is a new remote
lifecycle, not a defect fix. Declare it instead — a
MEMO_NATIVE_VOID_PROVIDERSset naming Rillet only, so the hole is visible in code and in the rule.
Batch 1 — silent wrong numbers and data corruption
- 1.1 Fixed Asset lines push as sales revenue.
SalesDocumentComponentgainsinvoiceLineType; the three invoice mappers excludeFixed Assetcomponents from the sales-revenue product/account, and an invoice whose only revenue is a disposal reports an actionable reason instead of "Sales Revenue account missing". Pin with aloadSalesInvoicestest that assertssalesRevenueAccountIdfrom a"Sales Account"line, plus a mixed part+asset mapper test per provider. - 1.2
MemoFormstops overwriting the storeddirection(D-3). - 1.3
purchase-invoice+/$invoiceId.post.tsxand the sales sibling: scope the supplier/customer read bycompanyId, checkerror, and fail CLOSED. - 1.4
post-reimbursement-void.ts: refuse a consumed reimbursement, mirroringpost-memo-transaction.ts. - 1.5
computeReconcileDecision: add thecreditMemo/supplierCreditarms and theirMAPPED_TYPESentries; golden cases for both.
Batch 2 — jobs and edge functions
- 2.1
resolveMemoJournalPartyresolves throughjournalLine.documentType = 'Memo'so a VOID journal resolves its party. - 2.2
isHourlyPasscomes from the run's scheduled time, not wall clock inside a per-company step. - 2.3
topology.tsthrows onrows.errorinstead of returning an empty topology. - 2.4
pageChangedMasterDataIdspages likepageIds(ascending from the floor). Shipped WITHOUT a unit test:accounting-outbound-sweep.tscannot be imported under vitest (module-scope@carbon/envvalidation), and hand-rolling a Supabase builder fake is whattesting-no-mock-theater.mdforbids. Covered by typecheck plus the seven document families already exercisingpageIds. Bound is now MAX_PAGES × PAGE_SIZE. - 2.5 Drop the
itemmaster-data sweep target (D-1). - 2.6
post-payment-transaction.ts: seedtargetControlByIdfor a reimbursement only from a posted journal, so the missing-control guard still bites. - 2.7
datasets/wipe.ts:assertWipeablerefuses non-Draft reimbursements andDOCUMENT_JOURNAL_SOURCESgainsReimbursement. - 2.8 Ramp reimbursement payout intent: record it on an already-mapped
reimbursement instead of returning before
payoutis built; retire the test that pins the broken behaviour.
Batch 3 — spend / sync / ramp
- 3.1 Delete
pushPurchaseOrder+pushInvoiceDraftBill, their types, theservice.tsre-exports anddraft-bill-push.test.ts. - 3.2 Delete
sync/defer.ts+defer.test.ts. - 3.3
parties.ts: the sole-contact fallback replaces the WHOLE contact. - 3.4
parties.ts: order the locations read and prefer an address that satisfies the state rule. - 3.5
ramp/entities/bill.ts: move the already-mapped check intoshouldSync. - 3.6
sync/party-contact.ts: surface the pre-read error; type the client asSupabaseClient<Database>. - 3.7 Log the swallowed failures in
sync-confirmation.tsandconnection.ts. - 3.8 Correct the disproven Ramp bill↔PO matching claims in
gates.ts,bill.tsand.claude/rules/ramp-integration.md.
Batch 4 — ERP app
- 4.1 Remove the document-level contact requirement (D-2), covering both the create-route gap and the existing-document breakage.
- 4.2
ReimbursementEditForm: wireExchangeRateand re-derive the money formatters from the selected currency. - 4.3
charges.$id.void.tsx: rethrow aResponsebefore the generic catch. - 4.4
InstallModeDialog: useRadioGroupButtonfrom@carbon/react. - 4.5 Remove the
DIAGNOSTICheader logging from the unauthenticated Ramp webhook.
Batch 5 — accounting providers
- 5.1 QBO memo applications send
sourceAmount, and refuse a cross-currency application as Xero does. - 5.2 QBO records each applied settlement inside the loop.
- 5.3 Rillet
resolveMemoSyncGaterefuses a Voided memo with no mapping. - 5.4 Reimbursement employee vendor/contact re-reads its mapping per record.
- 5.5
counterpart.tsreturns a candidate only when unclaimed; the Rillet vendor caller links before it updates. - 5.6 Declare
MEMO_NATIVE_VOID_PROVIDERS(D-4).
Batch 6 — migration and docs
- 6.1 Restore
20260927002910_require-party-contact.sqlto the content that was pushed, and add a new forward migration that renames the columns, guarded for both start states. The runner keys on version alone (packages/dev/src/services/migrations.ts:237), so any database that applied the old file never receives the edited one. - 6.2
apps/erp/app/modules/invoicing/AGENTS.md(via/create-agents-md). - 6.3 Stale lines:
packages/ee/AGENTS.md,settings/AGENTS.md,purchasing/AGENTS.md,accounting/AGENTS.md,jobs/AGENTS.md,.claude/rules/{ramp-integration,accounting-sync-handlers}.md,.claude/rules/environment-configuration.md. - [~] 6.4 DROPPED — the review item was wrong. All five specs this branch adds are
explicitly
Status: draft, and at leastmemo-external-gl-representationhas known unshipped holes (credit memos did not reconcile at all until 1.5, and Xero/QBO still have no memo void path — declared, not implemented). Moving them toimplemented/would assert something false. Left in place deliberately.
Gates per batch
pnpm exec biome check --write <files>, then the scoped typechecks and tests for
the packages touched, then pnpm --filter @carbon/checks test. Commit per batch.
Outcome
All 36 items resolved: 34 fixed, 1 dropped with reasoning (6.4), 1 shipped without a
unit test and said so (2.4). Gates at completion: @carbon/ee 1808, @carbon/jobs
768, erp 1509, @carbon/checks 175 — 4260 tests, five typechecks, Biome, and the
demo-dataset check all green.
Three review findings were REJECTED on inspection rather than implemented:
- The hand-written
CREATE POLICYblocks in20260922195151/20260923231244are insideno-authz-ddl-in-migrations' documented pre-cutoff window (SINCE = "20260927000000") and are already superseded by the generated authz migration. Redundant SQL, not a violation. - "Move the five shipped specs to
implemented/" — all five are explicitlyStatus: draft, andmemo-external-gl-representationhas holes that were still open when the review ran. Moving them would assert something false. MEMO_NATIVE_VOID_PROVIDERStrippingno-integration-id-branchingwas the check matching a provider id quoted in a DOC COMMENT. The code is the approved capability-set shape; the comment was reworded rather than the baseline widened.
The backup-compatibility check could not run on the migration commit (the local database is one migration behind by construction — it cannot see the change being committed). The migration was instead validated by hand against the live schema in a rolled-back transaction from both possible start states.