سامانه صدور فاکتور و حسابداری
Mirrored from https://github.com/davoodmehraban89/Factor-easy.git
Synced Dec 3, 14:30 UTC
docs(multicompany): record shipped invoice isolation and exact browser/release evidence
davoodmehraban89 committed
Oct 14, 2026 at 12:47 UTC
2b0b59fc176d005ef4fbd06bba6d59a723eef149
1 file changed
+8
PROJECT_STATE.md
+8
@@ -267,6 +267,14 @@ The latest user message is the sole source of new instructions. Read AGENTS.md t
267
- **Real-DOM regression authored:** an isolated two-company one-user fixture has separate sale and purchase draft rows plus an unassigned legacy invoice. Check selected Settings company A restricts sale archive, purchase register, central manager, seller header; NO `ALL` selection; Settings B switches all three lists immediately with no reload and excludes A/legacy; off-company direct edit stays denied; switching company during an edit clears the draft context; switching back and app reload preserve separation and both companies' source rows.
268
- **Verification at checkpoint:** each changed JavaScript file V8-parse and browser test compile are to be checked before PR; exact PR-head Quality, Chromium, Golden accounting, three PostgreSQL databases and Security are PENDING. Do not merge until green. Phase 0 owner affected-ISP login and real authenticated user multi-company acceptance remain OPEN. Rollback by revert scoped code PR.
269
270
+### 2026-10-14 Same-user multi-company invoice scoping — PR #135 RELEASED / EXACT-SHA GATES SUCCESS / OWNER LIVE ACCEPTANCE OPEN
271
+- **User regression fixed:** user with multiple companies must see only the active Settings-selected company's sale/purchase invoices, not all user-owned company records. `renderInvoices` previously honored a local `ALL` selector; `renderCompanies` kept reinstalling «نمایش همه شرکتها» and `purchaseVisibleRecords` was unscoped.
272
+- **Shipped:** PR [#135](https://github.com/davoodmehraban89/Factor-easy/pull/135), protected main **c160da3c23d6091646296cb454280eba4bf3cb42**. `js/companies.js` now makes invoice seller/archive selectors read-only Settings-owned active company, verifies ownership before Settings switch, clears in-progress sales/purchase form edits on switch, refreshes document manager and topbar. `js/invoices.js` and `js/purchases.js` show only visible revision chain leaves with `companyId===afCompanyId()` where that is an owned company, fail-closed for missing/unassigned company, enforce active company on edit and Save; `js/print.js` and purchase print reject off-company stale IDs. Central document manager already scoped by `afCompanyId`, now has immediate refresh on Settings switch. No underlying cross-company owner records are removed or reassigned.
273
+- **Actual isolated two-company Chromium test:** one user, distinct company A and B invoices and purchases plus an unassigned legacy invoice; verifies company A-only archive and purchase register, manager rows, no ALL, disabled seller switch, Settings A→B→A immediate refresh with no other-company records, direct stale off-company edit denied, in-progress edit cleared and persistence after reload, both original records retained.
274
+- **Exact final feature PR head `39128b68e0f7150aae1206065a30399d529d55d3`:** Quality **38540074634 SUCCESS**, job `115772358838` logs **118/118 real Chromium PASS**, Golden accounting PASS, three disposable PostgreSQL jobs SUCCESS; Security **38540074652 SUCCESS** (CodeQL/release safety; dependency review SKIPPED). Earlier PR head `a16cca20d029c3e551d20c767ac4e60ac20e3fc4` had **117/118 PASS** with one failure in legacy `scripts/taxpayer-print.spec.js` because its purchase print fixture lacked any active owned company; test corrected by adding isolated company+Settings and companyId without weakening active-company print guard, then all 118/118 passed.
275
+- **Exact merged-main SHA `c160da3c23d6091646296cb454280eba4bf3cb42`:** Quality **38540590784 SUCCESS**, Security **38540590808 SUCCESS**, Release Gate **38541009035 SUCCESS**, gated Pages **38541097860 SUCCESS**. Duplicate Release **38540797184 CANCELLED** and Pages **38541076035 SKIPPED**; do NOT count these as passes. Release workflow success ≠ owner-authenticated real ISP acceptance.
276
+- **Risk/scope:** UI scoping among the same user's companies is distinct from RLS-based cross-user organization isolation; it does not claim to prove negative two-identity RLS or concurrent company switch races. Historic legacy invoices lacking `companyId` remain held for explicit reconciliation rather than shown under the wrong company. No Supabase SQL migration, Auth/RLS/roles, production financial document edits, paid resources or external services changed. F0-01 owner login stability and actual two-company browser acceptance still OPEN. Rollback targeted PR #135 revert; data unmodified.
277
+
278
## Current change ledger
279
| 2026-10-07 | Owner requested accounting/product usability refinement from live screenshots: automatic non-user-entered floating-detail codes, contextual in-product guides (especially accounting/chart/dimensions), remove duplicate product internal tax ID and use product code as internal item ID, strengthen in-control product/person search, introduce hierarchical product group/subgroup coding with deterministic 6-digit product codes, and keep sale/purchase commercial-document workspace layout stable while only semantic fields change. | **IMPLEMENTED / LOCAL VERIFICATION PASSED / CI PENDING** | Baseline main = `7e58c75f7d754f378d94ca3f356c1ae580aa7ee3`. Automatic dimension type/value codes, contextual guides, product-code-as-internal-ID, normalized multi-token search, and additive six-digit product coding implemented. Existing historical codes preserved. Commercial sale/purchase workspaces now share a stable `صدور سند تجاری` header/actions layout; duplicate purchase sidebar injection removed; the public selector is the single document-type selector and the legacy internal invoice-kind control is hidden. Local syntax/static/commerce/UX/accounting phases 2–6/Golden checks passed; protected-branch CI remains pending. |
280