Skip to content

docs(log_set): pass rir only when the trainee gave a number - #22

Draft
wromansky wants to merge 1 commit into
wger-project:masterfrom
wromansky:feat/rir-optional-no-inference
Draft

docs(log_set): pass rir only when the trainee gave a number#22
wromansky wants to merge 1 commit into
wger-project:masterfrom
wromansky:feat/rir-optional-no-inference

Conversation

@wromansky

Copy link
Copy Markdown
Contributor

The problem

A trainee reports effort in words at least as often as in numbers — "felt good", "a few left in the tank", "that was hard". rir is a float, so a caller that treats it as always-required has to convert, and the conversion is a guess that becomes indistinguishable from a report the moment it is stored.

Nothing downstream can tell 2.0 because the trainee said two from 2.0 because it sounded like two. Progression logic reads both as fact.

Observed in production over two sessions on a self-hosted instance: six values inferred from phrases like "felt good" and "a lot more in the tank", each stored as a precise float, none of them stated. One of them was even sourced from a previous day's message the model had in context. The values were plausible — that is exactly why nobody noticed.

The change

Docstring only. log_set now says:

  • pass rir only when the trainee gave a number;
  • a stated range ("3 or 4") is numbers — record the lower bound, the one they are sure of;
  • effort described in words is not — leave rir unset and ask afterwards.

rir has always been float | None = None, so nothing in the schema, the signature or the behaviour changes. This makes the existing optionality usable by saying when to use it.

Why null is better than a plausible number

null says "not reported", which is true. 2.0 says "two reps left in the tank", which is a claim the trainee never made. A missing value is visible and can be backfilled; an invented one is invisible and is read as fact by every later decision. Callers that need an effort signal and find null still have reps-versus-target, which is stated data.

Tests

None added — no behaviour changed. Full suite unchanged at 247 passed, ruff check clean.

Note

#20 also edits this docstring's rir paragraph, adding the lower-bound rule for reported ranges. The two compose — range means numbers, words mean omit — but whichever lands second will need a small rebase to merge the two paragraphs into one.

A trainee reports effort in words at least as often as in numbers -
"felt good", "a few left", "that was hard". rir is a float, so a
caller that treats it as always-required has to convert, and the
conversion is a guess that becomes indistinguishable from a report the
moment it is stored. Nothing downstream can tell 2.0-because-he-said-two
from 2.0-because-it-seemed-like-two, and progression logic reads both as
fact.

Say to leave rir unset in that case. wger already accepts a null rir -
the field has always been optional here - and null carries the true
statement, "not reported", rather than a number nobody said. A stated
range is still numbers: record the lower bound, the one the trainee is
sure of.

Docstring and changelog only. No signature, schema or behaviour change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant