Commit Graph
38 Commits
Author SHA1 Message Date
QiuSWandClaude Opus 5 c86e98d0cb feat(#48): make one config work for both development and deployment
The repo already layered file defaults under environment overrides, on
both the backend (settings.yml < GOAUTO_*) and the frontend
(.env.production < process.env). What was missing was a translator for
production: config.yaml only ever existed for the PowerShell launchers,
so a packaged binary read none of it and had no database credentials
either — SYB was inheriting an existing gap, not creating one.

The server now reads config.yaml itself, between settings.yml and the
environment. Lookup is GOAUTO_CONFIG, then ./config.yaml, then beside the
executable, so a packaged binary works wherever it is started. An absent
file is not an error: containers supply everything through the
environment. Scalars are read by YAML type and coerced, so an unquoted
all-digit password cannot take startup down over a quoting detail.

This removed the need for a Read-SybConfig in PowerShell: the launcher
just hands over the path it already knows, rather than reimplementing a
YAML parser.

The server also serves the built frontend when dist is present, which is
what .env.production's empty VUE_APP_BASE_API already assumes. The
history fallback is restricted to non-API GETs, and is not installed at
all without dist, so development 404s stay 404s.

Precedence is mutation-tested: applying the local file after the
environment instead of before makes the layering test fail.

Not verified: the PowerShell change and any Windows deployment — both
need a run on the Windows side.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 09:28:45 +08:00
QiuSWandClaude Opus 5 7edb4e7b9f feat(#48): add SYB sync orchestration, import endpoint and page entry
Stage 2. Completes the path from the SYB API to the archive.

sybimport.Sync pages a date range day by day and folds each detail line
through the existing idempotent ApplyDetail. The paging loop is driven by
listTotal, never by the list response's own total, which live data
confirmed is the page's row count rather than the filtered total. A day
whose completeness cannot be proven — a short page, a total that drifted
while paging, a detail response missing an order — stops the run instead
of reporting a partial import as a whole one. Rows already written stay:
they are idempotent on (order_code, detail_id), so a re-run overwrites.

sybimport.Connect reuses the cached session and only discards it when SYB
explicitly says it is invalid. Caching the numeric user id alongside the
cookies is required, not incidental: session validation calls
/am/user/get?id=, and a wrong id comes back as a business error rather
than a logout, so cookies alone can never be revalidated.

The import endpoint is single-flight and detached from the request
context, so closing the tab cannot abandon a half-finished range. It
reads only; no SYB write endpoint is reachable from GoAuto.

The page swaps its "no import entry" warning for a date-range dialog that
warns when the span is wide — a single week held over 7000 orders — and
reports partial progress when a run fails midway.

Verified: go build, go vet, go test ./... all pass. The drift check was
mutation-tested. Not verified: the MySQL migration for syb_session, and
any browser walkthrough.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 16:56:00 +08:00
QiuSWandClaude Opus 5 a31c4776c4 feat(#48): port SYB ERP client, session store and config (Stage 1)
Port the SYB ERP HTTP client from the upstream cmautobuy project. The
package is stdlib-only (no DB, no gin), so client.go, columns.go, ocr.go
and their httptest suites carry over almost verbatim; only the package
name and doc references changed.

Add on top of the port:
  - models.SYBSession + gorm SessionStore, so a restart does not force a
    fresh captcha. Cookies are credential-equivalent and carry json:"-".
    Expired sessions read as absent because SYB has no rolling renewal.
  - config.Extend.SYB. Non-secret settings live in settings.yml;
    username and password come only from GOAUTO_SYB_* environment
    variables, so no credential lands in a tracked file.
  - docs/12-syb-erp-interface.md, the ported interface contract.

The guard tests were mutation-checked: reverting json:"-" and renaming a
settings.yml key each make their test fail.

No import endpoint yet — that needs real credentials and live network
verification, which is Stage 2 of #48.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 16:30:35 +08:00
QiuSWandClaude Opus 5 b4861f5073 docs(#48): scope OCR prohibition to Agent side, allow SYB login captcha OCR
The blanket "no OCR/VLM" rule was written for Android Agent collection.
Server-side SYB ERP login is a different domain and needs captcha OCR to
run unattended. Scope the prohibition to the Agent side and record the
SYB carve-out, including that captcha images leave the project.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 16:17:16 +08:00
QiuSWandClaude Opus 5 f53e6ba05b docs(#41): sync architecture, business rules and API contract for syb import
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 15:11:03 +08:00
QiuSWandClaude Opus 5 03f44a0dd2 docs(#40): sync architecture, business rules and API contract for shopee product
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 13:45:35 +08:00
QiuSWandClaude Opus 5 0d623d8e7b docs(#47): unify harness command references
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 09:23:02 +08:00
QiuSWandClaude Opus 5 f8d0011057 docs(#47): mirror harness command entry changes
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 09:20:32 +08:00
QiuSWandClaude Opus 5 b3430637d8 docs(#47): upgrade DevHarness baseline to bfdf648
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 09:19:38 +08:00
QiuSWandClaude Opus 5 80434ecb56 docs(#40,#41): record stage A prototype acceptance
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 08:53:52 +08:00
QiuSWandClaude Opus 5 acaa6c090b docs(#41): unify SYB terminology in issue and delivery index
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 17:51:36 +08:00
QiuSWandClaude Opus 5 953ce55e3f docs(#40,#41): rename 货运宝 to SYB in display terms
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 17:45:03 +08:00
QiuSWandClaude Opus 5 faecd90d2b docs(#46): revise spec matching rules for AI matching
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 15:47:38 +08:00
QiuSWandClaude Opus 5 b314109ce8 docs(#41): mirror stage A prototype status
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 14:18:42 +08:00
QiuSWandClaude Opus 5 8dbac5ddf6 docs(#40): record stage A prototype acceptance
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 11:43:59 +08:00
QiuSWandClaude Opus 5 38dbaed05b docs(#40): add stage A shopee product prototype
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 09:48:43 +08:00
QiuSWandClaude Opus 5 23464ecd50 docs(#32): record procurement prototype acceptance
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 09:30:01 +08:00
QiuSWandClaude Opus 5 a3ef9cbcb4 docs(#40,#41): mirror stage A prototype gate
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 09:29:11 +08:00
QiuSW 3718ce8dc6 docs: record issue 45 acceptance mirror 2026-08-18 08:49:26 +08:00
QiuSW ceecb5855e feat(#45): add batch collection task creation 2026-08-17 17:17:20 +08:00
QiuSW f6bada9f86 docs(#31): archive accepted product module 2026-08-17 17:02:41 +08:00
QiuSW da7c02cbeb docs(#26): archive accepted traversal fix 2026-08-17 16:57:57 +08:00
QiuSW a7a453633e feat(#31): implement PDD product archive module 2026-08-17 16:04:18 +08:00
QiuSW 10966c5c25 docs: generate Wiki mirrors (#43) 2026-08-17 11:30:44 +08:00
QiuSW a4ac398ca0 docs: prepare Wiki-first migration (#43) 2026-08-17 11:27:09 +08:00
QiuSW cde2a84211 feat: configure startup ports from local config (#30) 2026-08-16 19:18:46 +08:00
QiuSW 924c6e0504 fix: recover PDD similar-product sold-out page (#29) 2026-08-15 18:07:47 +08:00
QiuSW c4e0aa75c8 feat: retry PDD detail navigation once (#28) 2026-08-15 17:44:34 +08:00
QiuSW dbeb151f1d feat: recover transient PDD sold-out pages (#27) 2026-08-15 17:23:20 +08:00
QiuSW 72d614524b fix: complete PDD spec panel traversal (#26) 2026-08-15 17:03:52 +08:00
QiuSW 7b96810200 fix: filter PDD multi-select action from specs (#25) 2026-08-15 16:18:53 +08:00
QiuSW 271b6dde11 fix: harden PDD v2 real-device collection (#25) 2026-08-15 16:09:02 +08:00
QiuSW affa6b3f8c feat: add safe PDD rule template editor (#24) 2026-08-15 15:36:58 +08:00
QiuSW 99ca400a74 feat: collect PDD product details on Android (#23) 2026-08-15 15:18:03 +08:00
QiuSW 9d4a0b9845 feat: add versioned rule capabilities (#22) 2026-08-15 15:01:19 +08:00
QiuSW 4b38a876de docs: design PDD detail collection rule (#21) 2026-08-15 14:39:33 +08:00
QiuSW c06f7ac24b docs: record MVP task acceptance (#19) 2026-08-15 14:30:17 +08:00
QiuSW 6949e53968 feat: establish GoAuto MVP baseline (#19) 2026-08-15 14:24:45 +08:00