Skip to content

test(guards): memory-usage sqlite cases quote the sqlite3 path and drop its CR (CC-696, refs #783) - #787

Merged
screenleon merged 1 commit into
mainfrom
fix/memory-usage-native-783
Nov 5, 2026
Merged

screenleon merged 1 commit into
mainfrom
fix/memory-usage-native-783

Conversation

@screenleon

@screenleon screenleon commented Nov 5, 2026 •

Copy link
Copy Markdown
Owner

Refs #783 (CC-696). Fixes the three memory-usage/sqlite-* cases. The two concurrency cases in the report did not reproduce here, so #783 stays open for them (the #738 acceptance of 50 parallel writers is still unverified on native Windows).

根因

資料庫其實寫對了(手動重現:card_usage 有 a.md|1|100,metadata 有 total_events)。是測試讀它的方式錯了:

  1. $($real_sqlite "$db" ...) 沒有加引號。real_sqlite 是 /c/Users/Lien Chen/AppData/.../sqlite3,路徑含空白就被拆開,指令找不到、輸出為空,報告成 count=missing。
  2. 原生 sqlite3 輸出 \r\n,bash 的命令替換只去掉結尾的 \n,指令成功也會多一個 \r,與預期字串不相等。

修法

三個案例的 $real_sqlite 加引號,輸出接 tr -d '\r'。產品程式 memory_usage_commit 沒有改。BACKLOG 加 CC-696,並把 CC-695 記上 pr:#786。

驗證(原生 Windows,使用者目錄 Lien Chen 含空白)

  • test-guards.sh --filter memory-usage:main 上 12 通過 3 失敗(三個 sqlite 案例),改後 15 通過 0 失敗。
  • 突變就是 main 本身:還原這個檔案,三個案例失敗。
  • 兩個並行案例(issue 說 8 個 writer 逾時 20 秒)在 main 上這台機器就通過:concurrent-no-lost-updates 約 12 秒、contention-matrix 約 34 到 46 秒,連跑三次都過。我沒有改它們,也不能說它們已修;它們的 20 秒期限在負載高時可能不夠。
  • 沒有跑 pr-gate(本機規則:未經要求不跑)。

Review (commands/ship.md Step 2.5)

PASS: no warranted refactor/reuse change: the three sites are one-line quote and pipe changes in test code; a shared query helper would be a new abstraction for three lines.

  • Permanent test admissions: no pr-gate round was run, so there is no gate finding; no test function was added or removed. The three existing cases only changed how they read the database (quoting, CR), not what they assert.

🤖 Generated with Claude Code

Review (commands/ship.md Steps 2.5 and 3)

  • Refactor/reuse audit: PASS: no warranted refactor/reuse change. No sqlite or CR helper exists in tests/lib; the three sites are one-line quote and pipe changes, a shared helper would be a new abstraction for three lines.
  • Review executor/model: codex (gate-resolved), tier standard (auto), mode sequential, reviewers: critic, qa-tester, architecture-reviewer, security-reviewer (risk-reviewer was not selected; the report claims nothing on that dimension)
  • Rounds: 1
  • Final verdict: GO (critic approve, qa-tester pass, architecture approve, security pass; Must-Fix: none, no finding id, all four test-gap rows no_gap)
  • Result file: gate-20261105-143957.md (gate-20261105-053918-d811d2), pmctl gate wait verified it
  • Cautions kept as is: the review workspace had no git metadata (scope relied on the manifest and SHA256 snapshots); the pre-flight evidence covers the 15-case memory-usage group, not the whole test-guards suite; the 50-writer native-Windows acceptance limit stays open (CC-696 "not reproduced" note).

…d drop its CR (CC-696, refs #783)

Three memory-usage cases read the database with an unquoted $real_sqlite, so a binary under a profile directory
that holds a space ("/c/Users/Lien Chen/...") was split into words, the query printed nothing and the report
said "missing" although the database was right. A native sqlite3 also prints CRLF and the command substitution
keeps the CR. The cases now quote the path and drop the CR; the product code is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ESW7P9wHJRbhxx3v7XyQuq
@screenleon
screenleon merged commit 6f03435 into main Nov 5, 2026
89 checks passed
@screenleon
screenleon deleted the fix/memory-usage-native-783 branch November 5, 2026 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant