toga-ai 1.0.303 → 1.0.304

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,64 @@
1
+ ---
2
+ type: session
3
+ slug: true-80100-mso-create-fix
4
+ title: Fix errors creating a manual managed service order (togadesk)
5
+ author: mhammontree
6
+ repos: [togadesk]
7
+ framework: "1.0"
8
+ client: shared
9
+ status: active
10
+ created: 2026-07-09
11
+ updated: 2026-07-09
12
+ ---
13
+
14
+ # Session: true-80100-mso-create-fix
15
+ **Date:** 2026-07-09
16
+ **Project/Repo:** togadesk (1.0)
17
+ **Task:** Fix TRUE-80100 — errors creating a manual managed service order (MSO) in togadesk; reported against the Northwell Health client but the defects are general to the shared MSO create flow.
18
+
19
+ ---
20
+
21
+ ## What WORKED
22
+ <!-- Include specific file paths and evidence -->
23
+ - **Server crash fix** — `desk/includes/controllers/actions/tickets/add.php:353-354`: changed `App_Page::getVar('installation')` and `getVar('access-instructions')` to `App_Page::getVarIfSet(...)`. Root cause: `App_Page::getVar()` (library/app/page.php:354) THROWS `Exception("Variable 'X' does not exist in the request headers.")` when the var is absent; the manual MSO form omits `installation`, so the onsite-service (TYPE_ONSITESERVICE) branch crashed. `getVarIfSet()` (page.php:382) returns null instead. Evidence: matched the original Sentry trace (getVar → add.php:353 → require chain); after fix, **Test 1** (user WITH an address) created the MSO successfully with no exception.
24
+ - **Submit-validation deadlock fix** — `desk/template/modals/tickets/addNew.php` submit handler (~line 3284): validator now reads `newAddressCount = parseInt($('#newAddressCount').val())||0` and only blocks when `selectedValue==0 && newAddressCount==0`. Root cause: an existing End User with no saved address got an empty `#userlocation` dropdown + an auto-opened inline add-address form, but the validator required a non-zero dropdown pick and ignored the inline address — unresolvable deadlock. Evidence: **Test 2** (user with NO address → filled inline add-address form) created the MSO successfully.
25
+ - **Chrome autofill hardening** — added `autocomplete` attributes: `autocomplete="off"` on `#formModal` (`desk/template/footer.php:9`); `autocomplete="new-password"` on `#new-user-password`; `autocomplete="off"` on the new-user fields, new-address fields (address1/2, city, state, zip), Summary (`#subject`), and the select2 dropdowns (`#enduser`, `#userlocation`, `#location`) in `addNew.php`. Root cause: the password field made Chrome autofill Summary/address fields (blue highlight) without firing change/input events or syncing select2, so validation saw empty values. Defensive — cannot regress the create flow. Not independently re-tested (users filled fields manually in both tests).
26
+ - **Address data model confirmed** — the End User Address dropdown is sourced per-person from `people_addresses INNER JOIN addresses ON addresses.id = people_addresses.addressid WHERE people_addresses.peopleid = <uid>` (`desk/template/pages/getinfo.php:152-171`, db_togadesk / TOGaDeskSupport). Confirmed live: a user WITH a `people_addresses` row populates the dropdown and selects fine. Empty dropdown = that person has no `people_addresses` row (legitimate data state), not a bug.
27
+ - **Knowledge captured & pushed** — `/capture` published to `_main`: new feature doc `1.0/apps/togadesk/features/managed-service-order-create.md` and an elevated update to `1.0/standards/backend-php.md` (getVar-throws rule). validate OK (28 repos), index 233 docs.
28
+ - **Code pushed** — all three fixes committed and pushed to branch `TRUE-80100` in the togadesk repo; local togadesk is checked out on `TRUE-80100`.
29
+
30
+ ## What did NOT work — DO NOT RETRY THESE
31
+ <!-- Exact failure reasons — do not vague-ify -->
32
+ - **Do NOT restore the commented-out `locations` UNION in getinfo.php** (getinfo.php:95-148) as a "fix" for the empty End User Address dropdown. The empty dropdown is NOT a regression: git blame shows the per-person-only query dates to the 2021-12-06 schema migration `repair_order_addresses/primaryaddress` → `addresses/isprimary` (commit bf1abaa06, Jeff). Client/site addresses intentionally live in the `locations` table and are reached via the modal's "Select either End User or Client Location" toggle (`#checkbox` → `#servicelocation`/`#location`), enabled once a Contract is chosen. Empty per-person dropdown is expected; inline add-address is the designed fallback.
33
+ - **Do NOT fix only add.php:353 and leave :354.** Line 354 (`access-instructions`) is the identical unguarded `getVar` on the next line and would throw immediately after 353 is fixed — both must use `getVarIfSet`.
34
+
35
+ ## Not tried yet (candidates for next session)
36
+ - Independently verify the autofill fix in an incognito Chrome window (both create tests were done with manual field entry, so fix #2 was never actually exercised against live autofill).
37
+ - Optional pre-merge hygiene: `php -l` on the 3 changed files and a `php-reviewer` pass (never run this session).
38
+ - Sweep the rest of the MSO create block in add.php for OTHER unconditional `getVar()` reads that could throw the same way (departmentid, priority, deliveryc, warrentyStartDate, deviceAge, etc.) — deferred per developer ("just the reported crash"). Only revisit if a NEXT-field crash surfaces.
39
+ - PR review/merge of branch `TRUE-80100` (not started).
40
+
41
+ ## Current file state
42
+ | File | Status | Notes |
43
+ |------|--------|-------|
44
+ | desk/includes/controllers/actions/tickets/add.php | Modified, committed on TRUE-80100 | Lines 353-354 `getVar`→`getVarIfSet` |
45
+ | desk/template/footer.php | Modified, committed on TRUE-80100 | `autocomplete="off"` on `#formModal` (line 9) |
46
+ | desk/template/modals/tickets/addNew.php | Modified, committed on TRUE-80100 | Validator deadlock fix (~3284) + `autocomplete` attrs on new-user/new-address/Summary/select2 fields |
47
+ | desk/template/pages/getinfo.php | Read-only (no change) | Investigated only — confirmed per-person address query is correct/by-design |
48
+ | knowledge/1.0/apps/togadesk/features/managed-service-order-create.md | Created, pushed to _main | New feature doc (MSO create flow + 3 fix gotchas) |
49
+ | knowledge/1.0/standards/backend-php.md | Modified, pushed to _main | Added getVar-throws rule (elevated, approved) |
50
+
51
+ ## Decisions made
52
+ - **Guard the read in add.php rather than fix the form to always post `installation`** (developer choice). Rationale: immediate, minimal, matches the surrounding guarded pattern; `location` becomes null when absent, which is acceptable for onsite-service. Rejected: form-side fix (larger surface) and "both".
53
+ - **Empty End User Address dropdown is by-design, not a code bug.** Rationale: confirmed via git blame (2021 per-person migration) + live test (a user with an address works); client locations are a separate intentional path via the toggle. Rejected: restoring the `locations` UNION.
54
+ - **Promote the getVar-throws rule to the elevated 1.0 backend-php standard** (developer approved). Rationale: `getVar` throwing vs `getVarIfSet` returning null is App_-framework-wide, not togadesk-specific; it's a recurring 1.0 crash class.
55
+ - **No client doc for Northwell.** Rationale: Northwell was only the reporting client; the defects and knowledge are shared/internal to the togadesk MSO flow.
56
+
57
+ ## Blockers
58
+ none — all three fixes verified for the two create paths and pushed; knowledge published.
59
+
60
+ ## Exact next step
61
+ > This task is essentially complete. If anything remains: open branch `TRUE-80100` for PR review/merge, and optionally verify the autofill fix (#2) in an incognito Chrome window since both create tests used manual field entry (autofill was never exercised).
62
+
63
+ ---
64
+ _Saved by /session-save on 2026-07-09_
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "toga-ai",
3
- "version": "1.0.303",
3
+ "version": "1.0.304",
4
4
  "description": "TOGA Technology Team Claude Knowledge System — shared AI coding harness with skills, knowledge base CLI, and project installer for Claude Code.",
5
5
  "keywords": [
6
6
  "claude",