# Company-report source and publish-failure copy

## Metadata

- Date: 2026-08-03
- Status: Implemented; source provenance module subsequently removed from the end-user result/history surface, and the
  publish-failure copy was simplified after live operator feedback
- Scope: Desktop company-channel job detail/history copy, source-module removal and company-result error explanation
- Confidence: Fact for source/error contracts and focused verification; no live report state was changed
- Source: `arr_web/static/app.js`, `arr_web/static/index.html`, `arr_web/static/i18n.js`, publisher tests and company job evidence
- Last verified: 2026-08-03
- Stale trigger: changes to company job source metadata, publication idempotency or localized status copy

## Problem

The page displayed `来源 Excel（提交时）` with `历史任务未记录来源`, which described an internal capture detail but did
not tell an operator whether the source was missing, old or actually used. It also displayed only
`正式表格发布失败`, which did not explain whether this was a normal duplicate-version reuse.

## Implemented behavior

- The final end-user surface no longer renders the job-detail source card or history source column. The report page is
  explicitly database-snapshot oriented; the upload/review current-source panel is retained where the operator actually
  manages the Excel input.
- Server-side jobs still retain the safe source summary for audit and troubleshooting. Removing the UI module does not
  backfill or delete old source metadata.
- `COMPANY_REPORT_PUBLISH_FAILED` now appears as `正式 Excel 保存失败`. The job summary and company row use the direct
  action copy `数据已处理，但正式 Excel 保存失败。请重启报表服务后再生成。`; internal duplicate-reuse rules are
  no longer shown in the operator-facing error.
- The wording is available in Chinese, English and Thai, and the added detail is escaped before it is inserted into the
  result table.

## Verification

- Focused unittest: Web/company regression passes 29 tests.
- `node --check arr_web/static/app.js` and `node --check arr_web/static/i18n.js` pass.
- Runtime static scan confirms no source-card/history-column reference remains; the upload/review source references
  remain intentionally.
- `git diff --check` passes.
- The project virtualenv has no `pytest` module; the repository's unittest runner was used instead.
- A live read after the operator-reported retry found job `253ce23d…` still failed for all five companies at `publish`
  with row counts `54/18/7/1/15`. The listener remains PID `11176`, started `2026-08-02 12:20`, while the current
  publisher source was modified on `2026-08-03 11:19`; the reported restart therefore did not replace the effective
  port-8766 process.
- No Web restart, source activation, report rerun, output backfill, database write or business-data mutation occurred.

## Semantics retained

The publisher remains idempotent for a complete semantically identical archive/result pair. Incomplete, corrupt or
semantically conflicting publication state still fails closed; the UI reports the safe action without translating every
publish failure into a duplicate explanation.
