2026-08-17-remove-customer-submit-fields.md 4.68 KB

Remove Customer Submit Fields Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Remove the complete requested set of customer audit, query, scene, WeChat, merchant, staff, order-filter, and delivery metadata from every create-order API request without mutating page state or removing unrelated customer fields.

Architecture: Extend the existing customer-property denylist used by the pure buildSubmitPayload serialization helper. Verify behavior at that boundary so every submission route receives the same cleanup.

Tech Stack: JavaScript ES modules, Node.js built-in test runner, npm work-order test scripts.

Global Constraints

  • Remove the explicitly requested customer metadata fields while preserving the existing cleanup for buyTime, createdDate, and actualDeliveryDate.
  • Do not modify the page's orderObj or customer archive echo data.
  • Preserve unrelated customer fields.
  • Apply the cleanup to normal payment, prerecorded, correction, and supplement submissions through their shared payload builder.

Task 1: Clean customer-only submission fields

Files:

  • Modify: tabWorkOrder/pages/createOrder/services/submitPayload.helpers.js
  • Test: tabWorkOrder/pages/createOrder/tests/lowPriceSubmitFlow.integration.test.mjs

Interfaces:

  • Consumes: buildSubmitPayload(orderObj, context) and SUBMIT_CUSTOMER_PROPERTIES_TO_DELETE from submitPayload.helpers.js.
  • Produces: A cloned request object that omits every customer property in SUBMIT_CUSTOMER_PROPERTIES_TO_DELETE while preserving other customer properties.

  • Step 1: Write the failing API-boundary regression test

Add a low-price submit-flow test that captures the real createWithPay argument with the complete removal contract:

const removedCustomerFields = [
  'buyTime', 'createdDate', 'createdBy', 'updatedBy', 'updatedDate',
  'deletedFlag', 'baseSceneCode', 'sceneType', 'businessType', 'qwGroupId',
  'qwGroupName', 'wxId', 'wxName', 'deliveryDate', 'inviteDate', 'keyword',
  'buyTimeStr', 'totalCustomer', 'merchantIds', 'yqMerchantIds',
  'sellerUserIds', 'goodsOrder', 'sceneTypes', 'customerPhoneList',
  'staffUuid', 'merchantId', 'orderDate', 'orderCodes', 'actualDeliveryDate'
]
const customer = Object.fromEntries(
  removedCustomerFields.map(field => [field, `remove-${field}`])
)
globalThis.__WORK_ORDER_MOCK_API__.createWithPay = payload => {
  submittedPayload = payload
  return { code: 0, data: { orderCode: 'LP-CUSTOMER-CLEANUP' } }
}
page.data.orderObj.customer = { ...customer, customerName: 'retained customer' }
await new SubmitContext(page).executeAfterApproval({ save: false })
removedCustomerFields.forEach(field => {
  assert.equal(Object.hasOwn(submittedPayload.customer, field), false, field)
})
assert.equal(submittedPayload.customer.customerName, 'retained customer')
  • Step 2: Run the focused test and verify RED

Run:

node --test --test-name-pattern "strips customer metadata from the actual order API request" tabWorkOrder/pages/createOrder/tests/lowPriceSubmitFlow.integration.test.mjs

Expected: the API-boundary test fails first for createdBy, which is still present in the captured request argument.

  • Step 3: Implement the minimal cleanup

Change the customer denylist to:

export const SUBMIT_CUSTOMER_PROPERTIES_TO_DELETE = [
  'buyTime',
  'createdDate',
  'createdBy',
  'updatedBy',
  'updatedDate',
  'deletedFlag',
  'baseSceneCode',
  'sceneType',
  'businessType',
  'qwGroupId',
  'qwGroupName',
  'wxId',
  'wxName',
  'deliveryDate',
  'inviteDate',
  'keyword',
  'buyTimeStr',
  'totalCustomer',
  'merchantIds',
  'yqMerchantIds',
  'sellerUserIds',
  'goodsOrder',
  'sceneTypes',
  'customerPhoneList',
  'staffUuid',
  'merchantId',
  'orderDate',
  'orderCodes',
  'actualDeliveryDate'
]
  • Step 4: Run the focused test and verify GREEN

Run the command from Step 2. Expected: the focused test passes.

  • Step 5: Run regression verification

Run:

npm run test:createOrder
npm run test:workOrder
git diff --check

Expected: all non-live tests pass, live tests remain explicitly skipped, closure status is ok, and the diff check reports no errors.

  • Step 6: Commit only this task's files
git add -- tabWorkOrder/pages/createOrder/services/submitPayload.helpers.js tabWorkOrder/pages/createOrder/tests/lowPriceSubmitFlow.integration.test.mjs docs/superpowers/plans/2026-08-17-remove-customer-submit-fields.md
git commit -m "fix: strip customer metadata from order requests"