feat: add remaining time and group names to grant status#36
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
grant statusshows remaining session time (e.g.,remaining: 45m) instead of total duration for sessions elevated viagrantorgrant envGroup: CloudAdmins in Contosoinstead ofGroup: d554b344-uuid in 29cb7961-uuidremainingSecondsandgroupNameas additiveomitemptyfields to JSON output — existing consumers are unaffectedBackwards Compatibility
grantcontinue to showduration: Xh Ym(text) and omitremainingSeconds(JSON)FormatSessionOptioncallers (revoke, session selector) passnilfor new map parameters and get identical behaviorsession_timestamps.jsoncache file is additive; existing eligibility cache files untouchedTest 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 errorsmake build— binary builds cleanlygrant, thengrant statusshows remaining timegrant status -o json—remainingSecondsandgroupNamefields present for tracked/group sessionsgrantshowduration(text), omitremainingSeconds(JSON)