WeChat cross-batch refund reconciliation:
- Add OriginalAmount field to CleanedBill for accurate cumulative refund math
- DeduplicateRawFile detects WeChat status-update rows (已退款/已全额退款) and
emits WechatRefundUpdates for Go-side reconciliation (Scenario 1)
- WechatPy cleaner surfaces -退款 income rows with no same-batch expense match
as unresolved_refunds for Go ReconcileRefund (Scenario 2)
- Add ReconcileWechatRefund to repository interface and MongoDB implementation
- upload.go step 15 iterates WechatRefundUpdates and reconciles against bills_cleaned
Bug fixes:
- ReviewStats: add nil repo check to prevent panic when DB is not connected
- JWT: remove hardcoded fallback secret; return 500/401 if JWTSecret not configured
- Remove unused parsePageParam dead code and its strconv import
- BillDetailDrawer: show 不计收支 amount in muted gray instead of red
- test_jd_cleaner.py: replace hardcoded D:\Projects\BillAI path with dynamic __file__ resolution
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When a refund row in an uploaded Alipay bill has no matching expense
row in the same batch (because the original purchase was uploaded in a
prior batch), the refund is now reconciled against the stored record in
bills_cleaned rather than being silently discarded.
Changes:
- analyzer/cleaners/base.py: add unresolved_refunds list to BaseCleaner
- analyzer/cleaners/alipay.py: _aggregate_refunds stores full refund
metadata (dict); _process_expenses tracks matched keys and populates
self.unresolved_refunds for unmatched refunds
- analyzer/server.py: thread unresolved_refunds through do_clean,
CleanResponse, and both /clean endpoints
- server/adapter/adapter.go: add UnresolvedRefund type and field to CleanResult
- server/adapter/http/cleaner.go: deserialize unresolved_refunds from
Python response and populate CleanResult
- server/repository/repository.go: add ReconcileRefund to BillRepository interface
- server/repository/mongo/repository.go: implement ReconcileRefund —
full refund soft-deletes the bill, partial refund reduces amount and
appends remark with original amount and refund order number
- server/handler/upload.go: capture clean result and call ReconcileRefund
for each unresolved refund after saving cleaned bills
- server/model/response.go: add ReconciledRefundCount to UploadData
Also: add CLAUDE.md (@AGENTS.md), update AGENTS.md, fix DailyTrendChart
missing-date gap by filling zero-expense dates in daily map.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Update changelog.go to use binary directory as base path
- Uses os.Executable() instead of relative path '..'
- Automatically adapts to local and Docker environments
- Modify server Dockerfile build context
- Change context from ./server to project root (.)
- Update COPY commands for new context
- Add CHANGELOG.md to container image
- Update AGENTS.md guidelines
- Explicitly specify relative path format for file references
This ensures the changelog API works correctly in both local development
and Docker deployment environments.
- Add /api/changelog public endpoint that dynamically parses CHANGELOG.md
- Implement Markdown parser in server/service/changelog.go with unit tests
- Update ChangelogDrawer component to fetch from API instead of hardcoded data
- Export apiFetch function to support public API endpoints
- Add loading/error/success states to changelog UI
- Update AGENTS.md and CHANGELOG.md to reflect new version and features
- Add GET /api/changelog endpoint to fetch changelog from CHANGELOG.md
- Create service/changelog.go to parse CHANGELOG.md markdown file
- Add handler/changelog.go to handle changelog requests
- Update ChangelogDrawer component to fetch from API instead of hardcoded data
- Export apiFetch from lib/api.ts for public use
- Add changelog parser tests with 14 version entries verified