Commit Graph
35 Commits
Author SHA1 Message Date
QiuSW 148ba96521 feat(goauto): add managed purchase rules (#127) 2026-08-29 21:20:55 +08:00
QiuSW 7c18159d70 fix(#156): reconcile purchaser permissions at startup 2026-08-29 16:30:23 +08:00
QiuSW cc326ebc6c feat(#155): reuse failed collection tasks by attempt 2026-08-29 16:05:37 +08:00
QiuSW afa29f1d86 fix(#149): add purchase match work item migration 2026-08-29 14:06:00 +08:00
QiuSW 11c407d582 feat(#148): match purchase specs asynchronously 2026-08-29 11:51:32 +08:00
QiuSW f84ea5df3b feat(#142): group GoAuto admin navigation 2026-08-29 09:44:06 +08:00
QiuSW 6f611a04ef feat(goauto): collect cropped color images (#133) 2026-08-28 23:31:23 +08:00
QiuSW 72f54f76ac feat(goauto): add configurable module menus (#137) 2026-08-28 21:21:40 +08:00
QiuSW 679f4691a4 feat(goauto): add stock purchase task type (#135) 2026-08-28 20:53:51 +08:00
QiuSW 33d4bb17ad feat(#130): collect replacement products from Agent 2026-08-28 18:20:24 +08:00
QiuSW 92385c4a8d feat(#131): activate product replacements safely 2026-08-28 17:56:17 +08:00
QiuSW 696e0bca52 feat(#129): add PDD product replacement model 2026-08-28 17:33:15 +08:00
QiuSW 7b5574506a fix(#125): reject duplicate migration versions 2026-08-28 10:41:04 +08:00
QiuSW 5c6655f706 feat(#119 #120 #121): implement SYB inner-code workflow 2026-08-28 10:24:15 +08:00
QiuSW 28c3cb5138 feat: collect current PDD page from Agent (#101) 2026-08-27 10:53:48 +08:00
QiuSW b885a4ef66 feat(agent): implement #90 task history 2026-08-26 09:26:38 +08:00
QiuSW ae9a9fef6f fix: add purchaser role permissions (#85) 2026-08-25 14:25:22 +08:00
QiuSW a2cc9a144f feat(#75): 增加 SYB 每小时自动同步 2026-08-24 16:02:16 +08:00
QiuSW 166adc6fa8 feat(#70): import cmautobuy product catalog 2026-08-23 23:59:12 +08:00
QiuSW 9490bddf8f feat(#67): add Shopee order snapshots to purchase tasks 2026-08-22 10:41:05 +08:00
QiuSW 6181d97f39 feat(#62): add AI specification matching settings 2026-08-21 17:04:49 +08:00
QiuSW 65ae41fd6f feat(#34): implement purchase task state machine 2026-08-20 17:22:52 +08:00
QiuSW 978f42806a feat(#33): define purchase task data and API contract 2026-08-20 16:49:43 +08:00
QiuSW badb78fa68 feat(#50): run SYB imports asynchronously 2026-08-20 15:24:50 +08:00
QiuSWandClaude Opus 5 cda37b4a60 feat(#49): add syb_shop model, migration and name normalization
Stage B step 1. The shop list decides which of a SYB account's shops get
imported.

Matching is by name, so the normalized form is the real key: whitespace
trimmed, full-width ASCII folded, letters lowercased. " ABC店 ", "ABC店"
and "abc店" are one shop. DisplayName is only ever shown to people, and
the unique index sits on the normalized column so a caller that skips
normalization cannot create rows that look identical on screen.

Interior whitespace is deliberately not collapsed: two shops differing
only there are still two shops, and merging them silently would be worse
than the duplicate this prevents.

Soft delete uses the DeletedFlag sentinel rather than a nullable
deleted_at in the unique index, which is silently inert because unique
indexes treat every NULL as distinct. Mutation-tested: dropping the
sentinel from the index makes the recreate-after-delete case fail.

The version-local migration file is included this time — the model alone
would never reach an existing database.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 11:18:32 +08:00
QiuSWandClaude Opus 5 e6f533b71e fix(#48): add the missing version-local migration for syb_session
Adding SYBSession to migrations.Migrate was not enough. Schema reaches an
existing database only through a version-local file; with the previous
version already recorded in sys_migration, Migrate never re-ran and the
table simply never appeared. The unit tests build a fresh database every
time, so they stayed green while the real database was missing a table —
which surfaced as "Error 1146: Table 'goauto.syb_session' doesn't exist"
on the first import attempt.

server/.gitignore was hiding these files. go-admin ignores version-local
because it is where generated local migrations land, but every GoAuto
migration belongs in version control; the existing ones had been forced
in with `git add -f`. Un-ignoring *.go there also recovers four migrations
that were never committed at all — 1786700000000 through 1786700300000,
covering the base schema, device registration, heartbeat and collection
execution. A fresh clone could not have built a working database.

Guard the class of mistake rather than just this instance:

  - migrations.VerifyTables checks every model's table after migrating and
    names what is missing along with the fix.
  - The migrate command runs it, so the failure lands at migrate time
    instead of at the first request that needs the table.
  - initDB no longer discards migrateModel's error. Upstream had
    `_ = migrateModel()` followed by an unconditional "初始化成功", so a
    failed migration reported success and the launcher believed it.

Also records the two-step rule in Common-Changes: a new model needs both
the model registration and a new version file.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 10:10:11 +08:00
QiuSWandClaude Opus 5 bbc5fdba05 fix(#48): replace per-migration noise with a summary, force UTF-8 console
The startup output was dominated by two upstream behaviours. Migrate
printed a bare count for every already-applied migration — a lone "1"
with no version, no explanation — through the standard logger, hence
stderr, which the launcher's `2>&1 |` renders as a red PowerShell error
block that looks like a failed migration. And the version-existence check
echoed one SELECT count(*) per version. Both replaced: a Warn-level
session for the check, and one summary line on stdout.

Console encoding needed more than [Console]::OutputEncoding: PowerShell
5.1 decodes child-process output by the console code page, so chcp 65001
goes with it.

The regression test capture was wrong twice and mutation testing caught
both. It captured only stdout while the bug wrote to stderr, and it
compared lines to "1" when the logger prefixes a timestamp, so the
assertion could never fail. It now captures the standard logger too and
matches with a pattern that allows the prefix — verified by reinstating
the bug and watching the test fail.

Not verified: the PowerShell edits, which need a Windows run.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 09:53:56 +08:00
QiuSWandClaude Opus 5 8001c03abd fix(#48): make configuration resolution visible at startup and in errors
Diagnosing "credential not configured" required reading the source: the
local config layer was a silent no-op when it found no file, and the
import error named only environment variables even though config.yaml is
now the normal place to configure this — sending operators to look in a
file that was never the problem.

Startup now logs which config.yaml was loaded, or that none was found and
where it looked, followed by whether SYB credentials resolved and from
which layer. Presence only, never values: server logs get pasted into
tickets.

The import error now names the file that was actually consulted and
distinguishes "no config.yaml found" from "found it, but it has no syb
credentials" — two problems with different fixes that previously produced
identical text.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-20 09:37:58 +08:00
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 d7f7420431 feat(#41): add syb_product CLI migration file
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 14:31:55 +08:00
QiuSWandClaude Opus 5 f9cb1945ab feat(#40): add shopee_product archive model, spec mapping and migration
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 10:03:21 +08:00
QiuSW a7a453633e feat(#31): implement PDD product archive module 2026-08-17 16:04:18 +08:00
QiuSW cde2a84211 feat: configure startup ports from local config (#30) 2026-08-16 19:18:46 +08:00
QiuSW 9d4a0b9845 feat: add versioned rule capabilities (#22) 2026-08-15 15:01:19 +08:00
QiuSW 6949e53968 feat: establish GoAuto MVP baseline (#19) 2026-08-15 14:24:45 +08:00