test(session): pin the id '/' ban and the FIFO O_NONBLOCK guard (#169)
CI / Lint / Test / Vet (pull_request) Successful in 56s
CI / Mirror to GitHub (pull_request) Skipped

PR #170 round-2 review: both guards stayed green when removed. Adds an
ErrInvalidID sentinel, a plain-prefix-then-'..' escape case asserted on
the sentinel, and a no-reader FIFO case with a timeout. Flip-verified:
allowing '/' in the id tail and dropping O_NONBLOCK each turn the suite red.

Refs #169

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-05 06:54:23 +02:00
co-authored by Claude Opus 5.5
parent b3d782b25e
commit 6325c2b414
2 changed files with 47 additions and 1 deletions
+4 -1
View File
@@ -49,9 +49,12 @@ type Attempt struct {
// write (hyperguild#169).
var idPattern = regexp.MustCompile(`^[A-Za-z0-9_][A-Za-z0-9._-]{0,127}$`)
// ErrInvalidID is returned when a session id is not a plain file name.
var ErrInvalidID = errors.New("session id is not a plain name")
func checkID(sessionID string) error {
if !idPattern.MatchString(sessionID) {
return fmt.Errorf("session id %q is not a plain name", sessionID)
return fmt.Errorf("%w: %q", ErrInvalidID, sessionID)
}
return nil
}