clickup-execute-sys-2105-2026-05-20

activetype/docdomain/execution

ClickUp Execute Report — SYS-2105 — Save Settlement as Draft with no Attachments

TL;DR

Settlement draft save failed because the frontend merged advance reference line items into every save (including draft) and the backend enforced Advance+Settlement attachment pairing on all draft updates. Fixed both: draft payload sends settlement lines only; attachment cross-check runs only on submit (or non-draft attachment updates). Verify on Bug/SYS-2105/Detail-Items-Advance-Settlement in FE and BE repos.

ClickUp Context

  • Task: https://app.clickup.com/t/86ba17wvx
  • Status: in progress development
  • Assignees: Riza Sakhi, asya, Qaylah Dzatin, Mg Terok
  • Due date: none
  • Parent/Subtasks: none
  • Problem statement from task: Saving settlement as draft without attachments incorrectly shows advance detail items and blocks with mandatory attachment alert. Expected: draft save allowed without settlement attachments or settlement detail items; advance reference lines must not appear in the editable detail list on failed/successful draft save.

Obsidian Context (Projects)

  • [[Projects/anabatic-claim/anabatic-claim]] — Claim product scope (expense, advance, settlement).
  • [[Projects/anabatic-claim/context/index]] — Settlement is a first-class payment request type linked to advance.
  • Branch FE field on task: Bug/SYS-2105/Detail-Items-Advance-Settlement (remote already had partial FE fix by Riza).

Obsidian Context (Resources)

  • No additional Resources notes required; behavior is defined in Claim FE/BE code paths.

Proposed Execution Plan

  1. Reproduce on settlement draft: no settlement detail items, no settlement attachments → Save as Draft.
  2. FE: stop mutating detailItems with excludedItems; include advance reference items in API payload only on submit.
  3. BE: gate FilesRequired cross-validation to submit transition (and non-draft attachment-only updates).
  4. Manual QA on dev consumer + API; confirm submit still requires settlement attachment when appropriate.

Executed Changes

Frontend (frontend-claim-dev, branch Bug/SYS-2105/Detail-Items-Advance-Settlement):

  • Built on existing commit that moved merge to detailItemsForPayload (no in-place detailItems mutation).
  • Additional fix: detailItemsForPayload merges excludedItems only when status === 'submitted'; draft uses this.detailItems only.
  • Removed stray console.log in error handler.

Backend (backend-claim-dev, branch Bug/SYS-2105/Detail-Items-Advance-Settlement):

  • updatePaymentRequest: Advance/Settlement attachment cross-validation runs only when targetStatus === submitted and previous status was not submitted.
  • updatePaymentRequestAttachments: same rule skipped when settlement status === draft.

Acceptance Criteria Mapping

CriterionVerification
User can save settlement as draft without attachmentsSave as Draft on empty settlement attachments → no FilesRequired error; status stays draft
Advance detail items do not appear on draft saveAfter failed or successful draft save, detail table shows only settlement lines (is_settlement_item === false)
Submit still enforces attachments when requiredSubmit without settlement attachment (and no advance attachments) → still blocked with settlement attachment message

Risks and Unknowns

RiskImpactMitigation
Draft save with empty items array may delete advance reference rows server-sideSettlement totals/advance offset wrong after draftFE still sends existing settlement lines; advance refs remain in DB until submit merge — watch QA if user had only advance refs visible
BE branch not on remote yetDeploy needs pushPush Bug/SYS-2105/Detail-Items-Advance-Settlement on backend-claim-dev

Validation Plan

  • Manual: open settlement in draft, no new detail items, no new attachments → Save as Draft → success.
  • Manual: same claim → Submit without attachment → expect validation error (unchanged).
  • Optional: integration test around updatePaymentRequest draft settlement (none found in repo).

Validation Results

  • Code review and logic trace completed; automated tests not run (no targeted spec for this path; build/eslint not run per workspace rules).
  • ClickUp comment posted with implementation summary.

Next Actions

  1. Mg / Riza: Manual QA on dev (consumer.anabatic.com + Nest API) per acceptance table.
  2. Mg: Push both branches and open PRs (FE may already be on remote; BE branch is local).
  3. QA: Regression on settlement submit with attachments and mixed advance/settlement lines.

Sources

  • https://app.clickup.com/t/86ba17wvx
  • [[Projects/anabatic-claim/anabatic-claim]]
  • frontend-claim-dev/src/app/modules/payment-request/payment-request.component.ts
  • backend-claim-dev/src/modules/payment-request/services/payment-request-trans.service.ts

Related

  • Triaged from Inbox capture clickup-execute-SYS-2105-2026-05-20.md (removed 2026-05-21 after move to project context).