fix: compound ttl durations silently parsing as tiny values#390
Open
wadetregaskis wants to merge 1 commit into
Open
fix: compound ttl durations silently parsing as tiny values#390wadetregaskis wants to merge 1 commit into
wadetregaskis wants to merge 1 commit into
Conversation
The suffix duration parser took the leading digit run as the value and the last character as the unit, ignoring everything in between, so a natural compound spec like 'shpool attach --ttl 1h30m' parsed as one MINUTE: the reaper killed the session 60 seconds in and the user lost their work. '2d12h' similarly meant 2 hours, '12.5h' meant 12 hours. Require the unit character to directly follow the digits and end the string, so unsupported compound formats are rejected with an error instead of silently misinterpreted.
ethanpailes
reviewed
Jun 13, 2026
ethanpailes
left a comment
Contributor
There was a problem hiding this comment.
Compound durations should be expressed with colons. We should fix the parser to only accept a single unit
ethanpailes
requested changes
Jun 13, 2026
Contributor
|
I'm happy to see you contributing, but please start with issues. |
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.
AI Policy Ack
✅ AI Policy
Found by Claude Fable 5.
This PR was:
✅ completely vibe coded
Description
The suffix duration parser took the leading digit run as the value and the last character as the unit, ignoring everything in between, so a natural compound spec like 'shpool attach --ttl 1h30m' parsed as one MINUTE: the reaper killed the session 60 seconds in and the user lost their work. '2d12h' similarly meant 2 hours, '12.5h' meant 12 hours.
Require the unit character to directly follow the digits and end the string, so unsupported compound formats are rejected with an error instead of silently misinterpreted.
Note: this doesn't currently allow for whitespace between the digits and the unit, e.g. "1 h". I could make it tolerate that, if you prefer.
It also will fail for e.g. "1.0h" even though right now it happens to interpret that correctly (by accident).
The better fix might be to support [some] compound durations and floating-point values, like "1.5h" and "1h30m", but that's clearly under "nice to have feature" territory, so I didn't want to just jump to that without knowing if that would actually be desired.