Repository navigation
fix(linux): resolve single-instance locking on AppImage, gate updater, and improve window control - #12
Merged
Conversation
khaira777
added a commit
that referenced
this pull request
Jul 5, 2026
…ts/discounts/tax/loyalty) Integration tests (7 files, 123 assertions): - Happy path: order→discount→bill→payment→completed - Tax correctness: India GST calculation and recalculation - Payment integrity: split payments, wallet double-spend, zero-amount rejection - Order lifecycle: status transitions, cancel with PIN - Bill reconciliation: discount sync, add-items sync - Loyalty points: cashback, idempotency, wallet balance - Discount edge cases: combined discounts, max limits, addon prices Bug fixes: - #3: Add-items filters cancelled items from total recalculation - #4: Add-items syncs bill after updating order total - #5: Cancel/restore round-off formula corrected - #6: Discount endpoint wrapped in withTxn (race condition) - #7: Infinity passes validation (NaN/isFinite check) - #8: Missing amount defaults to remaining balance - #9: Amount capped at remaining balance - #11: Removing discount restores original tax - #12: Add-items preserves order-level discount - #13: Cancel/restore preserves order-level discount - #14: Item-level discount checks max settings - #15: Item-level discount syncs to bill - #17: Cancel/restore wrapped in withTxn - #20: Cashback calculated on discounted subtotal - #23: Quantity/price validation on order creation Shared test helper (tests/helpers/test-setup.ts): - Extracts 40 lines of boilerplate per test file - Provides: initTestDb, createApp, startServer, seed helpers, assert utilities Co-Authored-By: Claude <[email protected]>
khaira777
pushed a commit
that referenced
this pull request
Jul 6, 2026
fix(linux): resolve single-instance locking on AppImage, gate updater, and improve window control
richanonymous22
referenced
this pull request
in richanonymous22/FloCafe
Aug 13, 2026
Milestone 2, Part 1+2. Finishes the work Phase 2A flagged as its natural next step: POST /orders/:id/items now goes through SaleService, and the per-item loop that used to be duplicated between order creation and item addition is one implementation with two callers. ## Shared line engine createSale and addSaleItems used to carry two near-identical copies of the per-item loop: product lookup, stock guard, price/quantity validation, addon subtotal, tax calculation, insert, addon insert, stock decrement. Both now call the internal persistSaleLine() for that work. What still differs between them is aggregation, and that difference is preserved deliberately: createSale sums per-line results as it goes (nothing else exists on a brand new sale); addSaleItems re-derives totals from every ACTIVE line in the database afterwards, because it may be adding to a sale that already has items, some of which may be cancelled — the inherited "BUG #3 FIX". One direct benefit of consolidation: items added via addSaleItems now receive a ULID uid, same as items from createSale. The old add-items route never populated it — an artifact of Phase 2A only having migrated one of the two paths. ## addSaleItems Behaviour-preserving extraction of the second half of docs/PHASE_2A_SALE_FLOW.md. All four inherited "BUG #N FIX" comments in the original handler are preserved and each has an explicit test: cancelled-line exclusion from recalculated totals (#3), order-level discount rescaling when a percentage discount meets a changed subtotal (#12), re-fetching the order under the transaction lock to catch a concurrent completion/cancellation (#175), and re-syncing an existing unpaid bill so it doesn't go stale (#4). Two guard clauses stay in the route rather than moving into the service, and the reasoning is written down at both ends (the route handler and the addSaleItems docstring): the bills.split_group_id lock is a simple, self-contained check with nothing to share, and the waiter-ownership check is an HTTP-layer authorization decision tied to the caller's role — it belongs beside requireRole, not inside a service with no Express dependency. Both run in the same relative order as before, so no response code changes for any input. actorUserId is threaded through for audit attribution only; it plays no part in either check. One new audit event type, sale.items_added, recorded inside the same transaction as the items it describes — added to the AuditEventType union introduced in Phase 1. ## Verification Extended tests/plemmo-sale-service.test.ts with 45 new checks (84 -> 129): shared-engine wiring (uid on newly added lines, stock decrement for post-creation additions), every rejection path with its exact status, rollback (a failure on line 2 of an add leaves no line, no audit event, and an unchanged subtotal), the four BUG-fix behaviours above with dedicated assertions, idempotent replay, the specialInstructions presence-vs-absence distinction (needed a typed { value } wrapper since `undefined` alone can't tell "leave untouched" apart from "clear the notes"), and a tableless counter sale proving the retail shape works for a multi-call flow, not just creation. Targeted regression: integration-happy, integration-tax, integration-reconciliation, integration-discount, issue-122 (exercises POST /orders/:id/items addon-quantity validation directly, exact 400s), issue-125, issue-24, order-item-addons, orders-authz, authz-phase3, tax-pack-management — all pass unchanged. Full npm test suite green (exit 0, 42 suites reporting 0 failed, zero assertion errors). Build clean, lint 0 errors. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_011HjBK8R8ArAjzGRLS7gjUj
27 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses several critical platform-specific issues to stabilize the Linux build (AppImage and Debian package variants) of Flo Cafe, which was previously only optimized for macOS and Windows.
Key Enhancements & Fixes
AppImage Single-Instance Locking (Resolved)
app.requestSingleInstanceLock()checks process executable paths inside the mount points (e.g.,/tmp/.mount_FloXXXXXX/), causing it to consider previous locks stale and launch duplicate windows.~/.config/flo-desktop/singleton.lockusing/proc/<pid>process checks.userDatadirectory to~/.config/flo-desktopearly in the main process lifecycle to prevent path resolution discrepancies between AppImage mount iterations.Improved Process Resource Control
server.tsandkds-server.tsto a maximum of 10 attempts (terminating at 3010/3011).process.exit()on initialization failure and lock detection to prevent CPU/memory-hogging zombie background processes from accumulating.Window Close & Tray Integration
win32hosts.Linux Documentation
docs/linux.mdmapping package options (AppImage vs deb), FUSE dependencies (Ubuntulibfuse2/libfuse2t64), CUPS printer setup, and current limitations.Known Issues / Future Work (Captured in TODOs)
.metainfo.xmlfiles to resolve "unknown license / potentially unsafe" warnings in graphical software centers (Gnome Software / Discover).lpoptionsorlsusbto enrich make/model detection on Linux.