diff --git a/internal/apierror/apierror.go b/internal/apierror/apierror.go index 9a01b7e1..f9fde568 100644 --- a/internal/apierror/apierror.go +++ b/internal/apierror/apierror.go @@ -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 { diff --git a/internal/auth/admin.go b/internal/auth/admin.go index 16dfdcda..a2ea165b 100644 --- a/internal/auth/admin.go +++ b/internal/auth/admin.go @@ -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 diff --git a/internal/backup/tables.go b/internal/backup/tables.go index 608cd706..30e12d38 100644 --- a/internal/backup/tables.go +++ b/internal/backup/tables.go @@ -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") } } diff --git a/internal/playevents/writer.go b/internal/playevents/writer.go index 3882362e..709f4110 100644 --- a/internal/playevents/writer.go +++ b/internal/playevents/writer.go @@ -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{ diff --git a/internal/playsessions/service.go b/internal/playsessions/service.go index d09e5467..1415b916 100644 --- a/internal/playsessions/service.go +++ b/internal/playsessions/service.go @@ -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}, diff --git a/internal/providers/httpclient.go b/internal/providers/httpclient.go index 32c17538..df24f6a9 100644 --- a/internal/providers/httpclient.go +++ b/internal/providers/httpclient.go @@ -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() diff --git a/internal/quarantine/service.go b/internal/quarantine/service.go index 2c7af35e..0c1bfd85 100644 --- a/internal/quarantine/service.go +++ b/internal/quarantine/service.go @@ -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 diff --git a/internal/recsettings/patch.go b/internal/recsettings/patch.go index 9bd90eeb..9eddc384 100644 --- a/internal/recsettings/patch.go +++ b/internal/recsettings/patch.go @@ -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) } diff --git a/internal/scrobble/listenbrainz/client.go b/internal/scrobble/listenbrainz/client.go index 28cfce5a..dc4ead3a 100644 --- a/internal/scrobble/listenbrainz/client.go +++ b/internal/scrobble/listenbrainz/client.go @@ -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 */ } } diff --git a/internal/scrobble/threshold.go b/internal/scrobble/threshold.go index 1b564057..7db1d7d8 100644 --- a/internal/scrobble/threshold.go +++ b/internal/scrobble/threshold.go @@ -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 }