Skip to content

docs(log_set): RiR ranges, bodyweight, and how to revise a set - #20

Open
wromansky wants to merge 1 commit into
wger-project:masterfrom
wromansky:docs/log-set-rir-and-revision
Open

docs(log_set): RiR ranges, bodyweight, and how to revise a set#20
wromansky wants to merge 1 commit into
wger-project:masterfrom
wromansky:docs/log-set-rir-and-revision

Conversation

@wromansky

Copy link
Copy Markdown
Contributor

The problem

Three things about calling log_set that its signature does not say, each of which produced a wrong row in a real training log this week.

A reported RiR is often a range. A trainee says "maybe 3 or 4"; the field takes one float. With no stated convention the caller invents one — an average, or a midpoint the trainee never claimed. Worse, the invention is unstable: a caller that writes 3.5, reconsiders, and decides 3 was the honest number then has a row it wants to change.

weight is required, so bodyweight work has to pass something. Zero is wger's convention for unloaded work, but nothing says so, and a caller can reasonably read a hard zero as a missing value it should avoid writing.

log_set always inserts. A caller revising a set it just wrote — a corrected rep count, a better RiR — reaches for the tool it already used. That writes a second row for one physical set, and downstream nothing distinguishes the pair from two genuine sets at the same load: not the routine log view, not volume statistics, not the exercise history a progression decision reads.

The change

Docstring only. log_set gains three paragraphs:

  • record the lower bound of a reported RiR range — it is the claim the trainee is sure of, and the conservative input to a load decision — and never average or invent a value between the ends;
  • weight=0 is the bodyweight case, not a missing value;
  • this tool inserts; revise with update_workout_log and the id returned in this call's result, because a second log_set writes a duplicate.

No signature, behaviour or schema change. log_set already returns the created row's id, so the revision path the docstring names works today.

Why the docstring

FastMCP turns the docstring into the description the model sees when it decides how to call the tool, so this is the layer where call-shape conventions are actually read — attached to the tool, at the moment of use. A validator cannot help here: two identical sets at the same load are legitimate training, so nothing server-side can distinguish a duplicate from a double.

Tests

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

Note

#18 and #19 also edit this docstring, in the reps_unit and exercise_id paragraphs respectively. This one extends the rir paragraph and appends after it, so the hunks are adjacent rather than overlapping — whichever lands last may need a trivial rebase.

Three call-shape facts a caller cannot get from the signature.

A trainee reports RiR as a range as often as a number - "maybe 3 or 4" -
and the field takes one float. Without a stated convention the value is
invented: an average, or a midpoint that was never claimed. Say to record
the lower bound. It is what they are sure of, and it is the conservative
input to a load decision.

weight is required, so bodyweight work has to pass something. Zero is
wger's convention for unloaded work; say so, rather than leaving each
caller to conclude it separately.

log_set always inserts, and the revision path is update_workout_log with
the id in this call's result. A caller that revises by calling log_set
again writes a second row for one physical set, and downstream nothing
distinguishes that pair from two genuine sets at the same load - not the
routine log view, not volume statistics, not the exercise history a
progression decision reads.
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