Skip to content

feat: add remaining time and group names to grant status#36

Merged
aaearon merged 1 commit intomainfrom
feat/status-remaining-time-group-names
Feb 21, 2026
Merged

feat: add remaining time and group names to grant status#36
aaearon merged 1 commit intomainfrom
feat/status-remaining-time-group-names

Conversation

@aaearon
Copy link
Owner

@aaearon aaearon commented Feb 21, 2026

Summary

  • Track elevation timestamps locally so grant status shows remaining session time (e.g., remaining: 45m) instead of total duration for sessions elevated via grant or grant env
  • Resolve group names from the groups eligibility API so group sessions display Group: CloudAdmins in Contoso instead of Group: d554b344-uuid in 29cb7961-uuid
  • Add remainingSeconds and groupName as additive omitempty fields to JSON output — existing consumers are unaffected

Backwards Compatibility

  • Sessions elevated outside grant continue to show duration: Xh Ym (text) and omit remainingSeconds (JSON)
  • Group sessions without name resolution fall back to UUID display
  • FormatSessionOption callers (revoke, session selector) pass nil for new map parameters and get identical behavior
  • New session_timestamps.json cache file is additive; existing eligibility cache files untouched

Test plan

  • make test — all unit tests pass (new tests for session tracker, group name map, remaining time computation, status output, timestamp recording)
  • make lint — no lint errors
  • make build — binary builds cleanly
  • Manual: elevate via grant, then grant status shows remaining time
  • Manual: grant status -o jsonremainingSeconds and groupName fields present for tracked/group sessions
  • Manual: sessions elevated outside grant show duration (text), omit remainingSeconds (JSON)

Track elevation timestamps locally in ~/.grant/cache/session_timestamps.json
so grant status can show remaining session time instead of total duration.
Resolve group names from the groups eligibility API so group sessions display
human-readable names instead of UUIDs.

Both features degrade gracefully: sessions elevated outside grant show total
duration, and unresolved groups fall back to UUID display. JSON output adds
remainingSeconds and groupName as additive omitempty fields.
@aaearon aaearon merged commit 0aa84d7 into main Feb 21, 2026
1 check passed
@aaearon aaearon deleted the feat/status-remaining-time-group-names branch February 21, 2026 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant