Commit de78c49
committed
fix(quickbooks): correct API conformance, prevent write data loss, shrink shared-logic surface
Validation of the integration against Intuit's published attribute tables
(static.developer.intuit.com/JSONObjects/*, the payload behind the docs SPA)
surfaced defects that write wrong data to customers' books, plus shared-module
changes broader than this integration needs.
Data integrity:
- update_customer_payment now reads the payment and merges allocations. QuickBooks
applies payment lines ALL-or-NONE, so sending a subset silently unapplied every
omitted invoice. Destructive replacement stays reachable via a user-only
unapplyOmittedInvoices flag. Also validates the merged total, not just the
caller's allocations.
- create_item required ExpenseAccountRef (required for Service and NonInventory)
as optional while mandating IncomeAccountRef (not required for NonInventory).
- create_employee required DisplayName, which QuickBooks derives and treats as
read-only under Payroll, while leaving the real at-least-one GivenName/FamilyName
rule unchecked. Both tools threw a raw TypeError on their schema-minimal call.
- create_purchase sent PaymentRefNum, absent from the Purchase entity; QuickBooks
discards unknown fields silently, so check numbers vanished. Now DocNumber.
- A Fault nested in QueryResponse was reported as an empty result set. Detected in
parseQuickBooksJson so every response path is covered.
- assertQuickBooksSparseUpdate never checked sparse despite its name.
- Bill header-level LinkedTxn omitted the required TxnLineId and duplicated the
line-level links; DescriptionOnly lines omitted DescriptionLineDetail.
- Line amounts were positive-only, making discounts, returns and credits
unrepresentable, and bare Number() silently coerced true and [5] onto the wire.
- Phantom report parameters removed; aging method and period split so each report
only offers the control it accepts.
Safety and boundaries:
- confirmVoid and confirmPosting moved to user-only, so an agent can no longer
supply its own approval for voids and journal postings.
- Split the runtime-free helpers out of tools/quickbooks/utils.ts. The block was
the only one in the repo dragging error-extractors, client.ts,
microsoft_excel/utils and stream-limits into the client bundle.
- Attachment routes: 20 MB cap per Intuit's limit, outbound timeouts, extension
preserved through filename truncation, Unicode filenames, wider MIME acceptance.
- The two download routes merged into one; extracted storeToolOutputFile.
Shared logic reduced to what this integration needs:
- redaction.ts back to a bypass-set entry for SyncToken; every origin/staging
assertion retained.
- refreshOAuthToken read the body before the ok check, so a token response over
64 KiB became a spurious failure for every provider. Provider error text is
restored to logs, redacted and truncated, and kept out of the caller message.
- maxResponseBytes clamped to the global ceiling.
- generate-docs is deterministic again; its output no longer depends on what is
already on disk.
The generic redaction engine, the serializer singleton-canonical fix and the
visibility-based docs filter are deferred to their own PRs.
Sparse-update semantics for ten write tools remain unverified against a live
sandbox; apps/sim/scripts/quickbooks-sparse-probe.ts settles it.1 parent 0c3de74 commit de78c49
70 files changed
Lines changed: 3342 additions & 6792 deletions
File tree
- apps
- docs/content/docs/en/integrations
- sim
- app/api/tools/quickbooks
- add-attachment
- download-attachment
- download-document
- download-transaction-pdf
- blocks/blocks
- lib
- api/contracts/tools
- core/security
- oauth
- uploads
- scripts
- serializer
- tools
- generated
- quickbooks
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
63 | | - | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
| |||
309 | 312 | | |
310 | 313 | | |
311 | 314 | | |
312 | | - | |
313 | | - | |
314 | | - | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
315 | 318 | | |
316 | 319 | | |
317 | 320 | | |
| |||
499 | 502 | | |
500 | 503 | | |
501 | 504 | | |
502 | | - | |
| 505 | + | |
503 | 506 | | |
504 | 507 | | |
505 | 508 | | |
506 | 509 | | |
507 | | - | |
| 510 | + | |
508 | 511 | | |
509 | 512 | | |
510 | 513 | | |
| |||
764 | 767 | | |
765 | 768 | | |
766 | 769 | | |
767 | | - | |
| 770 | + | |
768 | 771 | | |
769 | 772 | | |
770 | 773 | | |
| |||
879 | 882 | | |
880 | 883 | | |
881 | 884 | | |
882 | | - | |
| 885 | + | |
883 | 886 | | |
884 | 887 | | |
885 | 888 | | |
| |||
1049 | 1052 | | |
1050 | 1053 | | |
1051 | 1054 | | |
1052 | | - | |
| 1055 | + | |
1053 | 1056 | | |
1054 | 1057 | | |
1055 | 1058 | | |
| |||
1173 | 1176 | | |
1174 | 1177 | | |
1175 | 1178 | | |
1176 | | - | |
| 1179 | + | |
| 1180 | + | |
1177 | 1181 | | |
1178 | 1182 | | |
1179 | 1183 | | |
| |||
1335 | 1339 | | |
1336 | 1340 | | |
1337 | 1341 | | |
1338 | | - | |
| 1342 | + | |
1339 | 1343 | | |
1340 | 1344 | | |
1341 | 1345 | | |
| |||
1451 | 1455 | | |
1452 | 1456 | | |
1453 | 1457 | | |
1454 | | - | |
| 1458 | + | |
1455 | 1459 | | |
1456 | 1460 | | |
1457 | 1461 | | |
| |||
2234 | 2238 | | |
2235 | 2239 | | |
2236 | 2240 | | |
2237 | | - | |
| 2241 | + | |
2238 | 2242 | | |
2239 | 2243 | | |
2240 | 2244 | | |
| |||
2308 | 2312 | | |
2309 | 2313 | | |
2310 | 2314 | | |
2311 | | - | |
| 2315 | + | |
2312 | 2316 | | |
2313 | 2317 | | |
2314 | 2318 | | |
| |||
2913 | 2917 | | |
2914 | 2918 | | |
2915 | 2919 | | |
| 2920 | + | |
| 2921 | + | |
Lines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
70 | | - | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
77 | 81 | | |
78 | | - | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
79 | 89 | | |
80 | 90 | | |
81 | 91 | | |
82 | 92 | | |
83 | 93 | | |
84 | | - | |
| 94 | + | |
85 | 95 | | |
86 | 96 | | |
87 | 97 | | |
| |||
92 | 102 | | |
93 | 103 | | |
94 | 104 | | |
95 | | - | |
| 105 | + | |
96 | 106 | | |
97 | 107 | | |
98 | 108 | | |
99 | 109 | | |
100 | | - | |
101 | 110 | | |
102 | 111 | | |
103 | 112 | | |
| |||
137 | 146 | | |
138 | 147 | | |
139 | 148 | | |
140 | | - | |
| 149 | + | |
141 | 150 | | |
142 | 151 | | |
143 | 152 | | |
| |||
0 commit comments