Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/missionmatch / internal/modules/recruiting/nopanic_test.go |
| Date | Not specified in source |
| Repository | Janady13/missionmatch |
| Revision | 720d47fae476b0d38477ae4401697d372b1ea2bc |
| Branch | feature/opportunity-to-outcome |
| Path or archive member | internal/modules/recruiting/nopanic_test.go |
| Original SHA-256 | cb6074391709d0ff452d9d7a94ecad8078013d1f841600eda3528987f8f66215 |
| Git blob SHA | 9cc0a1188851a330ac61c14c59683e48ea2c8064 |
| Reading-copy SHA-256 | cb6074391709d0ff452d9d7a94ecad8078013d1f841600eda3528987f8f66215 |
Every recorded occurrence
These 2 records contain identical original source bytes. Their paths and revisions remain part of the archive.
| Original record | Branch or archive | Revision / identifier | Original location |
|---|---|---|---|
| Janady13/missionmatch / internal/modules/recruiting/nopanic_test.go | feature/opportunity-to-outcome | 720d47fae476b0d38477ae4401697d372b1ea2bc | Open original |
| Janady13/missionmatch / internal/modules/recruiting/nopanic_test.go | feature/aioe-upgrade | 2178e7298d0e5d9af83afa12402fd587f0ba6ed8 | Open original |
Recovered source transcript
Download complete source text ↓44 lines · 1.5 KB
package recruiting
import (
"os"
"path/filepath"
"strings"
"testing"
)
// TestNoMustParseInRequestPaths guards the fix for the panicking id round trips. Every create in this
// module used to return its new id as text and parse it back with uuid.MustParse, which CLAUDE.md forbids
// in a request path: the parse has no legitimate failure mode, so the only thing it could ever do is
// panic on a caller who did nothing wrong. Two of them ran AFTER the transaction committed, where a panic
// destroys the response for work the database has already accepted and cannot be safely retried. The ids
// are scanned as uuid.UUID now, so there is nothing left to parse.
//
// The guard is a source scan because the defect is the presence of a call, not a value any test could
// observe: the panic is unreachable through the API without corrupting Postgres itself.
func TestNoMustParseInRequestPaths(t *testing.T) {
files, err := filepath.Glob("*.go")
if err != nil {
t.Fatal(err)
}
for _, f := range files {
if strings.HasSuffix(f, "_test.go") {
continue
}
src, err := os.ReadFile(f)
if err != nil {
t.Fatal(err)
}
for i, line := range strings.Split(string(src), "\n") {
// Comments may name the call while explaining why it is gone.
if strings.HasPrefix(strings.TrimSpace(line), "//") {
continue
}
if strings.Contains(line, "uuid.MustParse") {
t.Errorf("%s:%d: uuid.MustParse panics in a request path; scan the id as a uuid.UUID or return an error instead: %s",
f, i+1, strings.TrimSpace(line))
}
}
}
}