Bakery POS - Phase 9 Validation Report
======================================

Baseline used
-------------
- Exact user-uploaded Phase 8.1 ZIP: bakery(7).zip
- Exact user-uploaded database export: engrgolk_bakery(7).sql
- Database export generation time: 2026-09-30 04:30 PM
- MariaDB version in export: 10.11.19

Application validation
----------------------
- PHP files checked with php -l: 89
- PHP syntax errors: 0
- JavaScript/service-worker files checked with node --check: 10
- JavaScript syntax errors: 0
- Static internal PHP links checked: 263
- Missing static PHP targets: 0
- CSS brace balance:
  - assets/css/app.css: 0
  - assets/css/phase81.css: 0
  - assets/css/phase9.css: 0

Baseline preservation
---------------------
- Files in supplied Phase 8.1 baseline: 124
- Baseline files missing from Phase 9 integrated tree: 0
- config/database.php: preserved byte-for-byte
- login.php: preserved byte-for-byte
- two-factor.php: preserved byte-for-byte
- app/Services/EmailOtp.php: preserved byte-for-byte
- app/Core/Auth.php: preserved byte-for-byte
- register.php: preserved byte-for-byte
- verify-email.php: preserved byte-for-byte

Readable-code validation
------------------------
- All Phase 9 new/modified PHP, JavaScript, CSS and SQL files were checked.
- Lines longer than 220 characters: 0
- Maximum touched source line length: 144 characters

Database/schema consistency
---------------------------
- Distinct bpos_ tables referenced by Phase 9 PHP: 33
- Referenced Phase 9 tables missing from synchronized 001_master_schema.sql: 0
- 001_master_schema.sql and 002_seed_core.sql include Phase 9 POS structures/settings for future clean installs.
- Existing live installations must import only 011_phase9_pos.sql once.

QR authorization smoke test
----------------------------
- QrCodeService generated a discount-authorization QR payload.
- Generated SVG was rendered to PNG.
- OpenCV QRCodeDetector decoded the exact BPOSDISC payload successfully.

Security/transaction safeguards reviewed
----------------------------------------
- POS selling price is reloaded on the server; client price is not trusted.
- FEFO finished-stock deduction uses database row locks.
- Expired finished batches are excluded from usable POS stock/allocation.
- Reserved transfer stock is excluded from sale allocation.
- Cashiers without sale.discount require a separate revocable QR credential.
- QR does not contain or use the owner's login password.
- Credit sales enforce active customer and credit limit on the server.
- Sale voids reverse stock through ledger entries instead of deleting transactions.
- Sellable returns restore stock to the original lot/batch and write RETURN ledger entries.
- POS terminal create/deactivate requires manager-level stock.adjust in addition to shift.manage.
- A cashier cannot open multiple simultaneous shifts.
- Outlet deactivation is blocked when an open shift or active POS hold exists.

Runtime limitation
------------------
- No MariaDB/MySQL CLI/server is installed in this execution environment.
- Therefore 011_phase9_pos.sql was reviewed/synchronized but was not executed against the user's live MariaDB database here.
- Live runtime verification should follow PHASE9_REPLACE_INSTRUCTIONS.txt after taking backups.
