Skip to content

Navigation Menu

Sign in
Sign up

Implement owner-invoice saveDraft + addLines from Cabbaroo Save capture - #20

Draft
BuildCal wants to merge 3 commits into
main from
cursor/invoice-draft-save-0c36
Draft

Implement owner-invoice saveDraft + addLines from Cabbaroo Save capture #20
BuildCal wants to merge 3 commits into
main from
cursor/invoice-draft-save-0c36

Conversation

@BuildCal

@BuildCal BuildCal commented Sep 3, 2026
edited
Loading

Copy link
Copy Markdown
Owner

Summary

  • Captured Save (not Send) on Cabbaroo owner invoice draft 18059815 / job 41648716 using dedicated profile /home/box/bt-gateway-profile.
  • Write path: PUT /apix/v3/Invoices/save-invoice with application/merge-patch+json.
  • invoices.saveDraft and invoices.addLines implemented from that capture (addLines = same Save with lineItems / ownerInvoiceLineItems). Related picker GET: /api/LineItems/EntityLineItemsToInvoice.
  • Forced draft flags: status 1, notifyOwner false, createInvoiceChkbox false. Draft remains Not sent.
  • Gateway tests: 67 passed. Commit 9ecbbce.

Test plan

  • vitest gateway suite
  • local dry_run saveDraft / addLines no longer not_captured
  • Restart MCP gateway process so bt_invoices_* picks up this branch
  • Optional one real sandbox Save (never Send)

Do not merge until Brad reviews. Remains DRAFT.

cursoragent and others added 2 commits September 3, 2026 06:17
Dedicated-profile capture of the draft UI redirected to Auth0. No Save
click and no EntityAttachmentsToInvoice request. Keep write verbs locked
until a signed-in gateway session fires them. Do not invent PUT bodies.
Co-authored-by: Brad Caldon <BuildCal@users.noreply.github.com>
Cabbaroo draft 18059815 Save fired PUT /apix/v3/Invoices/save-invoice
(application/merge-patch+json). addLines uses the same Save with
lineItems/ownerInvoiceLineItems; related picker GET is
EntityLineItemsToInvoice. Force draft flags; never Send.
@BuildCal BuildCal changed the title (削除) Leave owner-invoice Save and addLines not_captured (auth_required) (削除ここまで) (追記) Implement owner-invoice saveDraft + addLines from Cabbaroo Save capture (追記ここまで) Sep 4, 2026

@BuildCal BuildCal left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CTO review — COMMENT (approve-ready after undraft)

HEAD 9ecbbce · CI Gateway / Web / BT Service all green · mergeable · still DRAFT

Verdict

Approve-ready for Brad to merge after undraft. Capture + implementation look right. CTO does not merge.

What landed

  • Real Cabbaroo Save capture: PUT /apix/v3/Invoices/save-invoice with application/merge-patch+json
  • invoices.saveDraft / invoices.addLines marked captured; write path + conflict GET/guardConflict
  • Forced draft locks on every write: notifyOwner false, createInvoiceChkbox false, status 1 (Draft)
  • invoices.send remains send-locked; tests cover dry_run no longer not_captured and PUT flags/line merge
  • Related picker noted as GET /api/LineItems/EntityLineItemsToInvoice (not the write)

Nits (non-blocking)

  1. CHANGELOG still says saveDraft/addLines stay not_captured (auth_required note from the earlier commit). Flip that to Added/Changed for the 4 Sep capture before or right after merge.
  2. buildertrend-api-map.md table says addLines captured, but a later paragraph still says invoices.addLines / EntityAttachmentsToInvoice still not_captured (and typo Cubbaroo). Align the prose with the table.
  3. invoiceSaveDraftPayload does not seed from current invoice (merge-patch sparse is fine). Callers must put needed fields in header/body; empty header only forces id/job/draft flags — intentional, just worth knowing for the first live sandbox Save.

Ship notes

  • Keep BT_GATEWAY_ENABLE_SEND=false. Never Send / pay / notify.
  • Prefer a sandbox draft for any live Save; avoid hammering Cabbaroo 18059815 / job 41648716 while Ops is in that UI.
  • Restart MCP gateway after merge so bt_invoices_* picks up the branch.

Brad merges when ready. Stay off live BT session (Construction Ops owns it).

CHANGELOG and api-map prose still described the 3 Sep Auth0 miss as
current. Capture landed 4 Sep via PUT save-invoice merge-patch; addLines
is the same Save write. EntityAttachmentsToInvoice is a JS picker hint.
Co-authored-by: Brad Caldon <BuildCal@users.noreply.github.com>

@BuildCal BuildCal left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CTO review — COMMENT (approve-ready after undraft)

HEAD 3c48dc3 · CI Gateway / Web / BT Service all green · mergeable · still DRAFT

Verdict

Prior docs block cleared. Approve-ready for Brad to merge after undraft. CTO does not merge.

What changed since 9ecbbce

  • Docs commit 3c48dc3 aligns CHANGELOG + buildertrend-api-map.md + slice-c with the 4 Sep Cabbaroo Save capture (no more stale not_captured / Cubbaroo contradiction).
  • Implementation unchanged and still sound: PUT /apix/v3/Invoices/save-invoice merge-patch; invoices.saveDraft / invoices.addLines captured; forced notifyOwner false, createInvoiceChkbox false, status 1; guardConflict on both writes; invoices.send remains send-locked.

Nits (non-blocking)

  1. invoiceSaveDraftPayload stays sparse merge-patch (does not seed full current invoice). Callers must pass needed header/body fields; empty header only forces id/job/draft locks — fine for first sandbox Save, just know it.
  2. Capture append section in api-map has a duplicate Cabbaroo heading (Grid-only then Grid+Save). Harmless clutter.
  3. Restart MCP gateway after merge so bt_invoices_* picks up the branch.

Ship notes

  • Keep BT_GATEWAY_ENABLE_SEND=false. Never Send / pay / notify.
  • Prefer a sandbox draft for any live Save; avoid hammering Cabbaroo 18059815 / job 41648716 while Ops is in that UI.
  • Stay off live BT session (Construction Ops owns it).

Brad merges when ready. CTO never merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /