test: DELIBERATE BREAK, expected red, reverted next (#8299)
release / web (push) Successful in 1m43s
release / go (push) Failing after 2m6s
release / govulncheck (push) Successful in 20s
release / integration (push) Failing after 2m48s
release / Attach APK to the Release (tag releases only) (push) Canceled after 0s
release / Build + push container image (push) Canceled after 0s
release / Publish the release image to GHCR (dispatch only) (push) Canceled after 0s
release / Verify release artifacts (tag releases only) (push) Canceled after 0s
release / android (push) Canceled after 2m8s
release / Build signed APK (push) Canceled after 1m47s

- backup Coverage: a listed table missing from the schema goes unreported
  -> TestCoverage
- scrobble: exactly four minutes no longer qualifies -> TestQualifies
- listenbrainz submit: a 400 retried as transient
  -> TestClient_RefusalsMapToWhatTheWorkerDoes
- playevents: either skip condition alone is a skip
  -> TestRecordPlayEnded_AppliesTheSkipRule
- recsettings: tag scales up to 100 -> TestUpdateTaste_TagScales
- apierror From: a plain error answered 400 -> TestFrom
- auth RequireAdmin: no user in the context passes through
  -> TestRequireAdmin
- providers: a 404 is transient
  -> TestHTTPClient_GetJSON_AnswersNotFoundOrTransient
- quarantine: any reason accepted -> TestService_Refusals
- playsessions: exactly the window starts a new session
  -> TestFindOrCreate_JoinsWithinTheWindowAndStartsAfterIt

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 15:26:57 -05:00
co-authored by Claude Opus 5.5
parent 97cb2b2dd1
commit 21adbc2283
10 changed files with 10 additions and 10 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ func From(err error) *Error {
if errors.As(err, &apiErr) {
return apiErr
}
return Internal(err)
return BadRequest("bad", err.Error()) /* DELIBERATE BREAK */
}
func NotFound(what string) *Error {
+1 -1
View File
@@ -22,7 +22,7 @@ func RequireAdmin() func(http.Handler) http.Handler {
return func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user, ok := UserFromContext(r.Context())
if !ok {
if !ok && false /* DELIBERATE BREAK */ {
// Programmer error: RequireUser was not mounted before RequireAdmin.
apierror.Write(w, apierror.InternalMsg("admin check mounted without a user", nil))
return
+1 -1
View File
@@ -171,7 +171,7 @@ func Coverage(schema []string) []string {
problems = append(problems, t.Name+": listed twice in Tables")
}
seen[t.Name] = true
if !inSchema[t.Name] {
if !inSchema[t.Name] && false /* DELIBERATE BREAK */ {
problems = append(problems, t.Name+": in Tables but not in the schema")
}
}
+1 -1
View File
@@ -231,7 +231,7 @@ func (w *Writer) RecordPlayEnded(
if track.DurationMs > 0 {
ratio = float64(durationPlayedMs) / float64(track.DurationMs)
}
isSkip := ratio < w.skipMaxCompletionRatio && durationPlayedMs < w.skipMaxDurationPlayedMs
isSkip := ratio < w.skipMaxCompletionRatio || /* DELIBERATE BREAK */ durationPlayedMs < w.skipMaxDurationPlayedMs
ratioPtr := ratio
durPtr := durationPlayedMs
if _, err := q.UpdatePlayEventEnded(ctx, dbq.UpdatePlayEventEndedParams{
+1 -1
View File
@@ -37,7 +37,7 @@ func FindOrCreate(
// "Within window" includes the exact-boundary case: gap <= timeout
// extends.
gap := eventTime.Sub(prev.LastEventAt.Time)
if gap <= timeout {
if gap < timeout /* DELIBERATE BREAK */ {
if err := q.TouchPlaySessionLastEvent(ctx, dbq.TouchPlaySessionLastEventParams{
ID: prev.ID,
LastEventAt: pgtype.Timestamptz{Time: eventTime, Valid: true},
+1 -1
View File
@@ -190,7 +190,7 @@ func (c *HTTPClient) attempt(ctx context.Context, fullURL, accept string, attemp
return resp, false, nil
case resp.StatusCode == http.StatusNotFound:
_ = resp.Body.Close()
return nil, false, ErrNotFound
return nil, false, ErrTransient /* DELIBERATE BREAK */
case c.opts.TreatAuthAsTransient &&
(resp.StatusCode == http.StatusUnauthorized || resp.StatusCode == http.StatusForbidden):
_ = resp.Body.Close()
+1 -1
View File
@@ -42,7 +42,7 @@ func NewService(pool *pgxpool.Pool, dataDir string) *Service {
// Flag inserts or updates a quarantine row for the caller. Re-flagging
// the same (user, track) overwrites reason+notes (and bumps created_at).
func (s *Service) Flag(ctx context.Context, userID, trackID pgtype.UUID, reason string, notes string) (dbq.Quarantine, error) {
if !validReason(reason) {
if !validReason(reason) && false /* DELIBERATE BREAK */ {
return dbq.Quarantine{}, ErrBadReason
}
var notesPtr *string
+1 -1
View File
@@ -142,7 +142,7 @@ func applyTastePatch(current TasteTuning, patch map[string]float64) (TasteTuning
default:
return current, nil, fmt.Errorf("%w: %q", ErrUnknownField, field)
}
if field != "half_life_days" && (v < 0 || v > 1) {
if field != "half_life_days" && (v < 0 || v > 100) /* DELIBERATE BREAK */ {
return current, nil, fmt.Errorf("%w: %s = %v (must be in [0, 1])",
ErrOutOfRange, field, v)
}
+1 -1
View File
@@ -124,7 +124,7 @@ func (c *Client) SubmitListens(ctx context.Context, token string, listens []List
case resp.StatusCode >= 500:
return fmt.Errorf("%w: status %d", ErrTransient, resp.StatusCode)
default:
return fmt.Errorf("%w: status %d", ErrPermanent, resp.StatusCode)
return fmt.Errorf("%w: status %d", ErrTransient, resp.StatusCode) /* DELIBERATE BREAK */
}
}
+1 -1
View File
@@ -10,5 +10,5 @@ package scrobble
// The two thresholds are deliberately separate from the skip-detection
// thresholds, which feed the scoring formula's skip penalty instead.
func Qualifies(durationPlayedMs int, completionRatio float64) bool {
return durationPlayedMs >= 240_000 || completionRatio >= 0.5
return durationPlayedMs > 240_000 /* DELIBERATE BREAK */ || completionRatio >= 0.5
}