feat: add MediaSupplyFavorite types and update task plan for generated-code drift diagnosis
Backend CI / Backend (push) Successful in 17m27s

This commit is contained in:
2026-07-15 00:04:13 +08:00
parent 3cb15ab5a3
commit 3037cfe059
4 changed files with 55 additions and 1 deletions
+9
View File
@@ -1,6 +1,7 @@
# Findings & Decisions
## Requirements
- 2026-07-15: Fix CI `Main Verify generated code is committed` failure; reported diff begins around generated `MediaSupplyOrder`.
- 2026-07-14 follow-up: with exactly one usable account for a platform, the first human-verification challenge must prevent every later local task for that platform from reaching the adapter.
- 2026-07-14: When any account hits a human-verification challenge, retry the current collection with another usable account for the same AI model/platform.
- The client/platform error must always produce a desktop system notification, regardless of whether account failover succeeds.
@@ -11,6 +12,13 @@
- For desktop AI monitoring, put scheduling authority on the client, keep scraping silent/background-only, allow stale cross-day tasks to be dropped, and avoid fanning one question to all models at once.
## Research Findings
- 2026-07-15 generated-code CI: local `sqlc` is v1.30.0 and `server/Makefile` invokes the unpinned system binary (`cd internal/tenant/repository && sqlc generate`).
- The current workspace has no root `.github/workflows/backend-ci.yml`; the active `Main Verify` workflow must be located elsewhere (likely Gitea workflow config) before choosing a generator version.
- Active backend workflow is `.gitea/workflows/backend-ci.yml`; the earlier missing `.github` path was historical documentation drift.
- `generated/models.go` currently has no local diff before regeneration; `MediaSupplyOrder` fields are aligned by the committed generator output.
- Gitea Backend CI pins `sqlc v1.30.0`, matching the local binary exactly, then runs `make sqlc-generate` and `git diff --exit-code -- server/internal/tenant/repository/generated`.
- Version-mismatch hypothesis is falsified. The next deterministic probe is the exact CI generation command.
- The reported `MediaSupplyOrder` is generated in `server/internal/tenant/repository/generated/models.go` around line 699.
- Screenshot evidence: on client `e83077a0...`, `monitoring_collect:7995` for Doubao failed with `doubao_challenge_required`, while later Doubao task `monitoring_collect:7989` also appeared as failed with the same message.
- Screenshot refinement: the first challenged desktop task `#7224` shows attempt 1, while later `monitoring_collect:7989` shows attempt 0 and the same copied challenge message. This indicates the later task was bulk-terminalized without adapter execution, but recorded as `failed`, making cancellation look like another failed attempt.
- The product-correct state model should be: the triggering task is `failed`; later same-model tasks are `cancelled` in `desktop_tasks` and `skipped` (with a human-verification skip reason) in `monitoring_collect_tasks`, and cancellation events remove them from the local scheduler.
@@ -185,6 +193,7 @@
## Issues Encountered
| Issue | Resolution |
|-------|------------|
| Initial CI workflow lookup assumed root `.github`, but that directory does not exist in this checkout | Search all workflow/config paths before reproducing the generator command |
| A zsh glob for `apps/desktop-client/vitest.config.*` had no matches during read-only inspection | Switched to `rg --files`/explicit paths; no repository state changed |
| First planning-file patch used a stale placeholder row and failed verification | Re-read the exact table context and applied a narrower patch |
| Repository is fully untracked in git status output | Avoid relying on git history; verify via filesystem and test commands instead |
+6
View File
@@ -1,5 +1,11 @@
# Progress Log
## 2026-07-15T00:00:00+08:00 - Generated-code CI drift diagnosis started
- User reported `Main Verify generated code is committed` exit code 1 with a diff near generated `MediaSupplyOrder`.
- Added Phases 69-70 to reproduce the exact CI generation step, regenerate the affected artifacts, and verify a stable second generation.
- Existing uncommitted challenge/circuit-breaker work is preserved and will not be reverted.
## 2026-07-14T18:45:00+08:00 - Local same-platform challenge circuit breaker started
- User screenshot disproved the previous end-to-end assumption: after `monitoring_collect:7995` hit `doubao_challenge_required`, later Doubao task `7989` still attempted collection on the same single account.
@@ -696,6 +696,32 @@ type MediaPlatform struct {
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type MediaSupplyFavoriteGroup struct {
TenantID int64 `json:"tenant_id"`
UserID int64 `json:"user_id"`
GroupKey string `json:"group_key"`
Name string `json:"name"`
SortOrder int32 `json:"sort_order"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type MediaSupplyFavoriteOwner struct {
TenantID int64 `json:"tenant_id"`
UserID int64 `json:"user_id"`
Revision int64 `json:"revision"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
type MediaSupplyFavoriteResource struct {
TenantID int64 `json:"tenant_id"`
UserID int64 `json:"user_id"`
GroupKey string `json:"group_key"`
ResourceID int64 `json:"resource_id"`
CreatedAt pgtype.Timestamptz `json:"created_at"`
}
type MediaSupplyOrder struct {
ID int64 `json:"id"`
TenantID int64 `json:"tenant_id"`
+14 -1
View File
@@ -4,7 +4,7 @@
Continue the desktop AI monitoring implementation by first adding a client-side local scheduler with durable queueing and adaptive execution policy, then adding a reusable hidden Playwright CDP execution layer that attaches to Electron Chromium and reuses existing account partitions.
## Current Phase
Phase 68
Phase 69
## Phases
### Phase 1: Progress Verification
@@ -455,6 +455,18 @@ Phase 68
- [x] Record final behavior and any live-environment caveat
- **Status:** complete
### Phase 69: Generated-Code Drift Diagnosis
- [ ] Identify the exact CI generation command and pinned sqlc version
- [ ] Reproduce the generated-code diff locally
- [ ] Determine whether source SQL/schema or generated output is stale
- **Status:** in_progress
### Phase 70: Generated-Code Repair And Verification
- [ ] Regenerate only the affected committed artifacts
- [ ] Re-run the same generation check until the worktree is stable
- [ ] Run relevant Go tests and record the generated files
- **Status:** pending
## Key Questions
1. How should the desktop client defer and locally optimize monitor-task execution without violating one-task-per-platform serialism?
2. What is the smallest durable local cache that allows same-day resume while safely dropping stale next-day monitor tasks?
@@ -517,6 +529,7 @@ Phase 68
## Errors Encountered
| Error | Attempt | Resolution |
|-------|---------|------------|
| Root `.github/workflows/backend-ci.yml` not found | 1 | Locate the active Gitea/CI workflow with `rg --files` instead of relying on historical planning notes |
| Runtime invalidation payload included unsupported `platform` field | 1 | Remove the redundant field; account ID and message already identify the health event |
| Server regression still expected old literal skip reason and 10 SQL args | 1 | Update assertions to the new parameterized skip reason/cancellation payload and 11 args |
| Authorization bulk-cancellation patch context did not match the existing SQL argument block | 1 | Split the server change into smaller exact-context patches |