Problem class: go-placeholder-class-serve-path-exclusion
I diagnosed the problem and verified the fix logic in a runnable Go module. The solution is written to /workspace/solution.md; the full markdown is below.
Problem class: go-placeholder-class-serve-path-exclusion
Fix reference: OB-GAP-061, commit 68a7f32
Placeholder / self-test probe classes (off-by-one-self-test, canary, dogfood, ds-007, tickN-e2e families) were being returned as verified answers by /api/v1/problems/discover and listed by /api/v1/queue. The Python exporter (scripts/export-answers.py) already excluded these via EXCLUDED_CLASS_PATTERNS, but the Go read/serve path never ported that predicate. The fix ports it into a single reusable Go predicate and applies it at both the lookup and list boundaries, before pagination.
Store.Discovery looked a problem up by title and returned it without consulting the exclusion list. The API handler renders ErrNotFound as the standard 404 not_found, so a placeholder class with a matching title was served as a real verified answer.Queue.List paginated the raw store slice. Placeholders appeared in results, and filtering bolted on after limit/offset would produce dishonest Total and positions. Filtering must happen in Go before pagination.A naive strings.Contains(class, "test") would also exclude real test-* classes, so the port must preserve the exact patterns and not over-match.
internal/graph/placeholder.gopackage graph
import "regexp"
// placeholderClassPatterns mirrors EXCLUDED_CLASS_PATTERNS in
// scripts/export-answers.py: probe/self-test classes that must never be
// served as real answers. Patterns are matched case-insensitively as an
// unanchored search (regexp .MatchString), exactly like Python re.search.
var placeholderClassPatterns = []*regexp.Regexp{
regexp.MustCompile(`(?i)off-by-one-self-test`),
regexp.MustCompile(`(?i)canary`),
regexp.MustCompile(`(?i)dogfood`),
regexp.MustCompile(`(?i)ds-007`),
regexp.MustCompile(`(?i)tick\d+-e2e`),
}
// IsPlaceholderClass reports whether class is a placeholder / self-test probe
// class. Real evaluation classes such as "test-*" are deliberately not matched.
func IsPlaceholderClass(class string) bool {
for _, re := range placeholderClassPatterns {
if re.MatchString(class) {
return true
}
}
return false
}
Store.Discovery returns ErrNotFoundfunc (s *Store) Discovery(title string) (Problem, error) {
p, ok := s.byTitle[title]
if !ok {
return Problem{}, ErrNotFound
}
// Placeholder/self-test probes are not answers. Returning ErrNotFound
// keeps the HTTP layer unchanged: it already maps ErrNotFound -> 404.
if graph.IsPlaceholderClass(p.Class) {
return Problem{}, ErrNotFound
}
return p, nil
}
Queue.List filters before paginationfunc (q *Queue) List(offset, limit int) (Page, error) {
// Filter placeholders in Go BEFORE limit/offset so Total and positions
// describe only the entries a caller can actually see.
filtered := make([]Entry, 0, len(q.entries))
for _, e := range q.entries {
if graph.IsPlaceholderClass(e.Class) {
continue
}
filtered = append(filtered, e)
}
total := len(filtered)
if offset < 0 {
offset = 0
}
if offset > total {
offset = total
}
end := total
if limit >= 0 && offset+limit < end {
end = offset + limit
}
return Page{Entries: filtered[offset:end], Total: total, Offset: offset, Limit: limit}, nil
}
Reproduced in a standalone Go module and exercised with go test ./... — all pass:
$ go test ./...
ok example.com/verify/internal/graph 0.002s
ok example.com/verify/internal/queue 0.002s
ok example.com/verify/internal/store 0.002s
| Check | Expectation | Result |
|---|---|---|
IsPlaceholderClass("off-by-one-self-test") |
true |
pass |
IsPlaceholderClass("canary"/"dogfood"/"ds-007"/"tick42-e2e") |
true |
pass |
IsPlaceholderClass("test-mocking-http-requests") |
false |
pass |
IsPlaceholderClass("so-nil-pointer-deref") |
false |
pass |
Store.Discovery("off-by-one-self-test") |
ErrNotFound → HTTP 404 |
pass |
Queue.List Total/positions with placeholders present |
placeholders absent from Total/items |
pass |
End-to-end acceptance commands once applied:
curl -s -o /dev/null -w '%{http_code}\n' \
'http://localhost:8080/api/v1/problems/discover?class=off-by-one-self-test'
# => 404
curl -s 'http://localhost:8080/api/v1/queue?limit=1000' | grep -Eic \
'off-by-one-self-test|canary|dogfood|ds-007|tick[0-9]+-e2e'
# => 0
curl -s -o /dev/null -w '%{http_code}\n' \
'http://localhost:8080/api/v1/problems/discover?class=so-nil-pointer-deref'
# => 200
curl -s -o /dev/null -w '%{http_code}\n' \
'http://localhost:8080/api/v1/problems/discover?class=test-mocking-http-requests'
# => 200
internal/graph/placeholder.go — new, IsPlaceholderClass predicateinternal/graph/placeholder_test.go — new, predicate truth tableinternal/graph/store.go — Discovery returns ErrNotFound for placeholdersinternal/graph/queue.go — List filters placeholders before paginationre.search; off-by-one-self-test-v2 is correctly excluded.tick\d+-e2e requires digits, so a real tick-e2e class is not excluded.Total and shift positions.ErrNotFound already yields the standard 404 not_found.# Evidence - Problem class: go-placeholder-class-serve-path-exclusion - Model: openrouter/deepseek/deepseek-v4.1-flash - Solved: 2026-09-12T12:35:23.176Z - Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Placeholder/self-test probe classes (off-by-one-self-test, canary, dogfood, ds-007, tickN-e2e families) were served as verified answers by /api/v1/problems/discover and listed by /api/v1/queue. Fix (OB-GAP-061, commit 68a7f32): port scripts/export-answers.py EXCLUDED_CLASS_PATTERNS to a Go predicate graph.IsPlaceholderClass (internal/graph/placeholder.go, case-insensitive regexp search, must NOT match real test-* classes); Store.Discovery returns ErrNotFound for placeholder titles so the handler emits the existing 404 not_found; Queue.List filters placeholder entries in Go BEFORE limit/offset pagination so Total/positions stay honest. Verify: discover(off-by-one-self-test)=404, queue grep=0, regression so-nil-pointer-deref=200 and test-mocking-http-requests=200.", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4.1-flash", "problem_class": "go-placeholder-class-serve-path-exclusion", "provider": "openrouter", "solved_at": "2026-09-12T12:35:23.176Z", "version": ""}