Files
image-workbench-desktop/docs/archive/history/OPTIMIZATION-BASELINE.md
T

77 lines
5.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
> **⚠️ 历史·过程留档(已归档,2026-10-16)**:本文为**当时**记录,**不代表现状**;现状以 `docs/standards/architecture-current-state.md` 为准,规则见 `docs/standards/`。
> ⚠️ **历史/时效说明(2026-10-15 复核)**:本文档是**历史快照**(保护分支 `optimize/baseline`、基线 commit `9402bd2`、当时线上 `v3.0.0-o131`),**不要当作现状**。当前事实以 [`docs/standards/architecture-current-state.md`](../../standards/architecture-current-state.md) 为准。
> 已知过期点:① 「all errors receive the same one-retry/2-second behavior」与「`GEN_TIMEOUT_MS` is passed to api() but not enforced」已过期 —— 现行已有软超时(不 abort,避免重复计费)+ **硬超时**(`GEN_HARD_TIMEOUT_MS`)+ 槽位兜底,且**非幂等请求不自动重试**(见规范 §13.11);② 图片引用形态、门禁基线(本文档 325/5 一类数字)均已变化。**正文按历史记录原样保留。**
## Project boundary
- This work applies only to the `image-workbench-web` project.
- The separate local app project `image-workbench-app` is out of scope.
- Do not modify, stop, start, test, commit, or deploy the app project as part of this work.
- Port `8787` currently belongs to `image-workbench-app`; do not use it for Web previews.
- The current Web preview is `http://localhost:8788`, served from the Web project directory and verified against the current local `app.js` and `style.css` hashes.
## Repository state
- Protected branch: `optimize/baseline`
- Base commit: `9402bd28cf14f7695ff56f3af949e9ab1229a362`
- GitHub `main`: same commit
- Cloudflare production deployment: same commit
- Local feature changes are intentionally preserved and not deployed.
## Production
- Project: `image-workbench-web`
- Production branch: `main`
- Domains: `https://iwb.maqiart.eu.org`, `https://image-workbench-web.pages.dev`
- Latest known deployment: `9458b0d3`
- Deployment type: static Pages deployment, no Functions
- Online version marker: `v3.0.0-o131`
## Local pending changes
- `app.js`: local feature and reliability updates
- `style.css`: matching UI updates
- `package.json` and `package-lock.json`: test harness files currently untracked
- `node_modules/`: ignored; never commit
Notable local updates include unified node geometry, command palette, copy/paste, auto-layout locking, connection validation hints, serialized saves, and prompt-library state mirroring.
## Verification baseline
- macOS: `26.5.2`, Apple Silicon `arm64`.
- Homebrew Node is installed at `/opt/homebrew/bin`:
- Node `v22.22.1`
- npm `11.12.1`
- npx `11.12.1`
- The QwenPaw shell PATH omits `/opt/homebrew/bin`; tests must run with `export PATH="/opt/homebrew/bin:$PATH"` until the shell environment is corrected.
- `git diff --check`: passed.
- Existing jsdom test baseline before fixture corrections: `325 passed / 5 failed`.
- After correcting test fixtures (unique mock image URLs, multipart request recording, generated-image URL assertion): `326 passed / 4 failed`.
- Corrected fixture issues:
- Gallery preview now receives distinct mock URLs, so next-image navigation is testable.
- Multipart image-generation requests are recorded instead of being invisible to the test.
- Generated output URL is accepted by the ordering assertion.
- Remaining checks to classify:
1. Space + drag canvas pan — user-confirmed normal in the real browser; treat the jsdom failure as an environment/test limitation.
2. Combined-task generation completion state — parallel generation is intentional; results are expected to appear as each request completes, so the test must not assume sequential/all-at-once completion.
3. Combined-task reference forwarding assertion — the reference image is expected to be forwarded; current multipart mock cannot inspect the actual Blob contents and needs a test-specific observable assertion.
4. Output-node preview left/right navigation buttons.
- Product behavior confirmed by user: combined tasks run in parallel and display completed images immediately; this is correct behavior.
- No Cloudflare deployment or GitHub push has been performed during this preparation.
- Implemented shared global request slots and synchronous duplicate-run protection in the Web `app.js`.
- Current cap remains `GEN_CONCURRENCY = 4`; service-provider unlimited concurrency does not imply browser-side unlimited fan-out.
- `node --check app.js` and `node --check tests/iwb-v32-web-test.js`: passed.
- Existing jsdom test after implementation: `326 passed / 4 known behavior/test-assumption differences`; no new failures.
- Local Web preview: `http://localhost:8788`.
- No GitHub push or Cloudflare deployment performed.
- Main audit conclusion: per-node parallel generation and first-completed-first-displayed behavior are correct; highest-risk gaps are duplicate overlapping runs and the lack of a shared global concurrency cap across multiple generator nodes.
- Audit also found that `GEN_TIMEOUT_MS` is passed to `api()` but not enforced by the current Web fetch path, and all errors currently receive the same one-retry/2-second behavior.
Investigate the remaining four checks. Separate jsdom event/timing assumptions from actual canvas, combined-task, and output-preview behavior before changing business logic.