Add presence set-preferred and clear-preferred - #92
Conversation
|
Adversarial review completed against base 979791f through the updated head 90466fe. Findings fixed:
Validation completed:
I also checked the current Microsoft Graph v1.0 documentation for The fork-origin GitHub Actions run currently shows No further code, dependency, or documentation findings remain. Merge-ready once hosted CI is approved and passes. |
Microsoft Graph keeps a user-preferred presence above the presence sessions and ranks it first for as long as at least one session exists. The Teams client's "Appear offline" lives there, as `Offline`/`OffWork`, and nothing in the CLI could reach it: `presence set` answered success and the account stayed offline, because the override sat on top of the session it had just opened.
`set-preferred` calls `setUserPreferredPresence` and `clear-preferred` calls `clearUserPreferredPresence`, both under `/me/presence` like the other writes. Graph accepts six availabilities here, each with exactly one activity, so the command takes `--availability` alone, derives the activity, and reports both back rather than letting a caller send a pair Graph rejects. `--expiration` is checked as a positive ISO 8601 duration and left unbounded: Graph documents defaults of one day for `Busy` and `DoNotDisturb` and seven days otherwise, not a range, and the PT5M to PT4H limits in `parse_expiration` belong to sessions. The clear body is `{}` as documented, which a braced struct serializes to where a unit struct would send `null`; the wiremock test would catch the difference.
Verified against a live tenant: an account carrying `Offline`/`OffWork` with an open Available session read `Available`/`Available` after `clear-preferred`; `set-preferred --availability Away` read `Away`/`Away` through both the single-user and batch read paths; and a second clear with nothing left to clear returned 200 rather than 404, so there is no miss to translate.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014DD81KRhjKrJi3Gywivwv1
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WG7vFLjFZHqAUMRS1zkWRE
90466fe to
d2d0bd7
Compare
|
Reviewed and verified locally:
Extended the branch with a |
|
@aberoham two questions from the live run you did on 2026-09-03, since our sandbox session predates
Thanks, it is in |
presence set-preferredandpresence clear-preferredmanage the user-preferred presence, which Microsoft Graph ranks above every presence session while one exists.Offline/OffWork. With it set,presence setreturns success and the account stays offline, and no command could clear it.set-preferred --availability A [--expiration D]callssetUserPreferredPresence. Graph acceptsAvailable,Busy,DoNotDisturb,BeRightBack,AwayandOffline, each with one fixed activity, so the activity is derived from the availability and reported back.--expirationis checked as a positive ISO 8601 duration and not bounded. Graph documents defaults of one day forBusyandDoNotDisturband seven days otherwise, rather than a range, so thePT5MtoPT4Hcheck onsetdoes not apply here.clear-preferredcallsclearUserPreferredPresencewith the documented{}body. A second clear with nothing to clear returns 200, so there is no 404 to translate.CLAUDE.mdandAGENTS.mdare updated.Sample output:
{"status": "preferred_presence_set", "availability": "Away", "activity": "Away", "expiration_duration": "PT1H"}{"status": "preferred_presence_cleared"}Verified against a live tenant on 2026-09-03: an account carrying
Offline/OffWorkwith an open Available session readAvailable/Availableafterclear-preferred;set-preferred --availability AwayreadAway/Awaythrough bothpresence getandpresence get-batch; a secondclear-preferredreturned 200.