Skip to content

test: reproduce routine scheduling and prescription loss - #2558

Draft
pellinendanAgents wants to merge 1 commit into
wger-project:masterfrom
pellinendanAgents:test/generated-prescription-constraints
Draft

pellinendanAgents wants to merge 1 commit into
wger-project:masterfrom
pellinendanAgents:test/generated-prescription-constraints

Conversation

@pellinendanAgents

Copy link
Copy Markdown

Proposed Changes

Four failing tests reproduce constraint violations in generated routine schedules and prescription representations. This is a findings-only draft: no fixes, expected-failure markers, dependency changes, or production changes are included.

Constraint Reproduction Expected Observed on f7af925d0690bac12dc229d30a6cd0281a34224f Test
Weekly scheduling resumes when a cycle ends on Sunday Start Friday 2026-10-30, three configured days, fit_in_week=True, end 2026-11-08 Day 1 resumes Monday 2026-11-02 Monday is a placeholder; the entire November 2–8 week has no workout test_weekly_cycle_wrapping_on_monday_does_not_skip_a_week
A stored RiR range survives generation into JSON Configure RiRConfig(value=0) and MaxRiRConfig(value=2) at iteration 1 rir=0, max_rir=2 rir=0, max_rir=null test_generated_json_preserves_rir_range_starting_at_zero
Explicit zero RiR survives text formatting Eight repetitions, rir=0 8 Reps @ 0 RiR 8 Reps test_text_preserves_explicit_zero_rir
A set range starting at one survives text formatting sets=1, max_sets=3, eight repetitions 1-3 Sets, 8 Reps 8 Reps test_text_preserves_set_range_starting_at_one

The scheduling case uses supported dates and no log-gated advancement. The RiR case creates fresh slot/config rows; the text cases use SimpleTestCase and require no database. The numeric JSON prescription already loses the RiR upper bound before text formatting.

Related Issue(s)

No linked issue. These tests are the reproductions for the findings above.

Reproduction and scope

uv sync --group dev
uv run python manage.py test wger.manager.tests.test_generated_prescription_constraints --settings=settings.ci --noinput

Result: 4 tests, 4 assertion failures, 0 execution errors on macOS arm64, Python 3.13.11, Django 6.0.9. All 387 existing wger.manager.tests tests pass when this new module is excluded. The new file passes ruff check and ruff format --check. The existing missing-node_modules static-files warning does not prevent either run.

These are wger-specific boundary cases extending the scheduling and prescription-preservation themes of a 146-case workout-generator corpus. The original scorer is specific to another application's API and cannot be run unchanged against wger. A separate applicability pass executed 21 adapted scheduling/repeatability checks successfully and marked 125 cases inapplicable. The four failures above are additional boundary cases, not failures of those 21 checks. Equipment/injury selection, baseball-specific load limits, history-based exercise selection, and the original JSON/text-file/Flask routes are not claimed as wger features or defects. That external harness and its passing checks are not part of this PR.

Please check that the PR fulfills these requirements

  • Tests for the changes have been added (four intentional failing reproductions)
  • Code has been formatted to avoid unnecessary diffs (ruff format and ruff check on the new file)
  • If the feature is big enough or if there are manual steps needed (deployment changes etc.), write a small writeup in CHANGELOG.md — not applicable to this tests-only report

This branch has not been deployed

No deployments
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