sync: auto-sync from GURU-BEAST-ROG at 2026-06-23 15:54:03

Author: Mike Swanson
Machine: GURU-BEAST-ROG
Timestamp: 2026-06-23 15:54:03
This commit is contained in:
2026-06-23 15:54:23 -07:00
committed by ClaudeTools Bot
parent eb73f9cd32
commit 350c251513

View File

@@ -86,14 +86,29 @@ Always set `price_retail` explicitly — the rate doesn't auto-populate and the
---
## 8. Corrections preserve the ORIGINAL tech's attribution; ticket ownership is sticky
## 8. API key follows the BILLING TECH — always
**Labor lines:** when fixing a wrong line, preserve the **original tech's** `user_id` so their commission isn't lost.
- **Prefer `update_line_item` in place** — it preserves `user_id`.
- **If you must remove + re-add:** the new line defaults to the **API-key owner's** `user_id`. Explicitly set `user_id` to the original tech on `add_line_item`, or PUT-fix it afterward.
- Determine the original tech from `.ticket.user_id` and the line's `.user_id` BEFORE correcting; verify after.
**Attribution is determined by which API key you use**, not the requesting user. Every call (add_line_item, remove_line_item, comments) is logged as the owner of that key.
**Ticket ownership:** adding notes or labor does **NOT** change `.ticket.user_id`. Multiple techs routinely work the same ticket. Only change ticket ownership when explicitly asked. Status PUTs send only `status`; line edits use `update_line_item`; neither touches `user_id`.
**Rule (confirmed by Howard 2026-06-23):** use the tech's own API key whenever billing is attributed to a specific person:
- Bill for Howard → `msp-tools/syncro-howard.sops.yaml``credentials.credential`
- Bill for Mike → `msp-tools/syncro.sops.yaml``credentials.credential`
```bash
# Howard's key
HOWARD_KEY=$(bash .claude/scripts/vault.sh get-field msp-tools/syncro-howard credentials.credential)
curl -s -X POST "...?api_key=${HOWARD_KEY}" ...
# Mike's key (default / fallback)
MIKE_KEY=$(bash .claude/scripts/vault.sh get-field msp-tools/syncro credentials.credential)
curl -s -X PUT "...?api_key=${MIKE_KEY}" ...
```
Note: `add_line_item` and `remove_line_item` use `?api_key=` query param auth. The `Authorization: <key>` header also works for most endpoints but does NOT control attribution — `?api_key=` is the attribution mechanism.
**Corrections:** if a line was added under the wrong key (wrong `user_id`), use `remove_line_item` then re-add with the correct tech's key. `update_line_item` does NOT change `user_id` even when you pass it explicitly.
**Ticket ownership:** adding notes or labor does **NOT** change `.ticket.user_id`. Multiple techs routinely work the same ticket. Only change ticket ownership when explicitly asked.
Tech user_id table → [[feedback_syncro_history]].