Skip to content

Read a compact purchase count on Stock - #284

Merged
bliatun-code merged 2 commits into
mainfrom
codex/stock-purchase-counts
Nov 25, 2026
Merged

bliatun-code merged 2 commits into
mainfrom
codex/stock-purchase-counts

Conversation

@bliatun-code

Copy link
Copy Markdown
Owner

Stock purchase badge

Stock reads the purchase total with a direct SQLite count. A paired Client sends the revision of its last capture to the Host. The Host returns the total and, when needed, up to 50 recent purchases from the same read transaction. The Client saves those rows under the reviewed Host, library and target generation. Only the number crosses the desktop bridge on a successful compact read. Older Hosts use the existing purchase queue. Offline badges retain the saved-row count.

Verification

The browser regression opens Stock, checks the badge, and refreshes it after the order count changes. The paired TCP test creates an order through the inventory engine, observes the updated count, disconnects the Host and finds the order in the Client database. An additional database test covers an empty capture, an unchanged revision and the 50-row limit.

Measurements

Median of six alternating before/after production UI runs in Chromium. Opening is the click from Loans to Stock with an empty purchase cache. Refresh uses the visible retry button after an unrelated printer read failure, with an unchanged purchase revision. Time ends when the purchase read has returned and the correct badge is visible. Bytes sum JSON requests and successful replies on the desktop bridge through idle. The purchase commands use real SQLite and an authenticated loopback Host. Other domains use fixed test fixtures. Times depend on machine load.

Library Purchases Action Time before → after (ms) Bytes before → after
Local 0 open 34.9 → 43.4 2,572 → 2,421
Local 0 refresh 18.6 → 14.4 2,426 → 2,275
Paired 0 open 74.2 → 91.9 2,088 → 1,937
Paired 0 refresh 55.8 → 49.5 1,548 → 1,397
Local 10,000 open 65.1 → 36.8 14,237 → 2,425
Local 10,000 refresh 38.1 → 17.8 14,091 → 2,279
Paired 10,000 open 103.9 → 83.6 13,753 → 1,941
Paired 10,000 refresh 116.8 → 74.8 13,213 → 1,401

Host-to-Client HTTP traffic is separate from the desktop bridge. At 10,000 orders, a cold compact read includes 50 rows on that link. An unchanged refresh carries only the total and revision.

@bliatun-code bliatun-code self-assigned this Nov 25, 2026
@bliatun-code
bliatun-code merged commit 1943929 into main Nov 25, 2026
10 checks passed
@bliatun-code
bliatun-code deleted the codex/stock-purchase-counts branch November 25, 2026 19:40
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