Repository navigation
test(quiz): pin mid-save failures and the start form's assumptions; fix two doc claims (#79) - #86
Conversation
…ix two doc claims (#79) - A failure after the first verified autosave (a 500, a network error or session expiry on the second POST, or a second readback that disagrees or expires) is LearnerSaveUnknownError after exactly two POSTs. - The start form's assumptions of the summary each refuse before sending, and are documented as a known limitation: no captured summary is in the tests yet. - The RPC address names the d2lfile path; the parity sentence says a change made twice is saved once.
|
ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing |
[Low impact] This PR appears safe to merge. SummaryThis PR adds regression tests and clarifies the quiz protocol notes. It does not change runtime code.
No actionable issues found. Tests were not run during this review. Acknowledged limitation: Reviews (1) · Last reviewed commit: "test(quiz): pin mid-save failures and th..." · Reviewed by Greptile |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — all three files of this tests-plus-docs PR against issue #79; no production code changed.
- Finding 2 — mid-sequence autosave failures pinned (
tests/test_quiz_learner.py): newtest_a_failure_after_the_first_verified_save_is_unknown_and_not_retriedsaves and verifies the first answer, then fails the second five ways (500,NetworkError,SessionExpiredErroron the POST, a 200 whose readback lacks the answer, a session expiry on that readback). Each case asserts the exact typeLearnerSaveUnknownError, exactly two POSTs, the right page-read count (2 or 3), and both responses closed — pinning the per-iterationexcept Exceptioninsave_learner_answersagainst narrowing or retry regressions. - Finding 1 — start-form assumptions pinned and documented: five new cases in
test_start_refusals_send_nothing(missingd2l_controlMapPrev,d2l_statesecond element non-empty, aQuizTabIdcontrol, a visible input outside a question, noDeserializecall), each traced to a distinctbrowser_formcheck; plus a new test for the earlier parser refusals (second<form>, repeated hidden field →PreviewPageError, nothing sent).docs/quiz-protocol.mdstates the assumptions and the known limitation;docs/agent-quizzes.mdnow tells agents to finish such quizzes in Brightspace. - Findings 3 and 4 — doc corrections: the Submit bullet now names the
quiz_attempt_iframe_auto.d2lfilepath (matchesattempt_frame_path(..., rpc=True)), and the learner opener reads "request shapes" with the save-once divergence disclosed. - Grounding checked: the "recorded summary passed this" claim matches #78's replay record as verified in the plan comment on #79, and the doc correctly discloses that the start form's fields were never compared one by one. No credentials or token-shaped values added (placeholders only). Verified
tests/test_quiz_learner.pypasses 357/357 andruffis clean on the checked-out head.
The captured-summary fixture stays open on #79 by design — the ask for the recorded summary body is the right next step.
glm-5.3 | 𝕏
…ation docs (#79) - A stray checkbox, not a text input, pins the outside-question check: a text input is also refused when it has no answer (Grok 4.7). - A second form or repeated hidden field is an unreadable page, shown as "Brightspace did not return a supported current page of this attempt", not the form refusal (Grok 4.7). - The parity sentence says the start request was compared only by URL and headers (Grok 4.7), and that one attempt answer saves its final value once, while two commands save twice (CodeRabbit). - The mid-save test asserts exact page reads and has a third pending answer, so two POSTs also show the save stopped (MiniMax M3.1 Flash plan review). - Every control must be named once, not only the bookkeeping ones (MiniMax M3.1 Flash plan review).
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes — the delta since the prior pullfrog review (df20a96 → e3bdbda): the outside-question refusal case is now genuinely isolated, the mid-save pin is stronger, and the two docs' claims were corrected.
- Isolated the outside-question refusal case (
tests/test_quiz_learner.py): the stray text input was swapped for a checkbox outside a question. Verified by mutation that removing the outside-question check in_successfulfails exactly this one case (26/27 still pass) — the old text-input case would also have been refused by the text-control branch (name not in answers), so it never isolated that check. - Strengthened the mid-save failure pin:
test_a_failure_after_the_first_verified_save_is_unknown_and_not_retriednow keeps a third answer pending, so the two-POST count proves the save stopped instead of continuing to it, and each case pins an explicit read count (2 or 3) rather thanlen(pages). - Corrected the start-comparison and save-count claims (
docs/quiz-protocol.md): the opener now says the start request was compared only by URL and headers and quantifies the divergence (the browser autosaves every change; oneattempt answersaves only its final value), the Start bullet documents the POST URL (&cfql=0&inProgress=false,trueto resume — matchesstart_learner), and the Form-fields paragraph now reads "every control named once" with the two failure paths split correctly (second form / repeated hidden field → unsupported page; the rest → the form refusal). - Named both refusal messages for agents (
docs/agent-quizzes.md): the paragraph now also quotes the unreadable-page message, which matches the commands layer's_NOT_CURRENTtext shown forPreviewPageError.
All 357 tests in tests/test_quiz_learner.py pass on e3bdbda; every doc claim was traced to its source (start_learner, _start_fields, hidden_form/browser_form, quiz_learner_commands). No credentials or token-shaped values in the new lines — placeholders only.
| View workflow run | Using glm-5.3 | 𝕏
glm-5.3 | 𝕏

Part of #79 (post-merge review of #78). Findings 2, 3 and 4 are fixed. Finding 1 takes the issue's "refusal documented as a known limitation" branch; its captured-summary fixture is still open (see below).
Changes
tests/test_quiz_learner.py). New testtest_a_failure_after_the_first_verified_save_is_unknown_and_not_retried. The first answer is saved and verified, then the second fails five ways: a 500, aNetworkError, a session expiry on the POST, a readback that does not show the answer, and a session expiry on the readback. A third answer is pending throughout. Each case must end inLearnerSaveUnknownErroritself, with exactly two POSTs (so the save neither retried nor went on to the third answer), exactly 2 or 3 page reads, and every response closed. Narrowing the per-iterationexcept Exceptioninsave_learner_answersfails four of the five cases. A retried POST fails the call-count check.test_start_refusals_send_nothinggains one case for each thingbrowser_formchecks on the summary: missingd2l_controlMapPrev, ad2l_statewhose second element is not empty, aQuizTabIdcontrol, a checkbox outside a question (it fails if the outside-question check is removed, checked by mutation), and noDeserializecall. Each refuses withREFUSE_LEARNER_FORMbefore anything is sent.test_a_summary_with_a_second_form_or_repeated_field_is_not_read_and_sends_nothing. A second<form>or a repeated hidden field is caught earlier, by the summary parser (PreviewPageError, which the CLI shows as "Brightspace did not return a supported current page of this attempt"). Nothing is sent in either case.docs/quiz-protocol.md(Form fields) now lists these expectations. It says the recorded summary passed them (in fix(quiz): send learner attempt requests as the browser does #78's replay, the start request's URL and headers matched the browser's), that its fields were not compared one by one, and that the tests use a synthetic summary. A summary shaped any other way is a known limitation:attempt startstops before sending anything.docs/agent-quizzes.md: the refusals paragraph now includes both messages, so an agent knows to finish that quiz in Brightspace.quiz_attempt_iframe_auto.d2lfilepath.attempt answersaves only its final value (two commands save twice).Still open on #79
The first clause of the acceptance criterion is still open:
attempt startexercised against a captured summary page. The recorded summary is only on the owner's machine. Ask: attach the recorded summary body to #79, sanitized with tokens replaced by synthetic values as #78 did for its fixtures, and a follow-up can add it as a fixture test that checks the start POST's URL and ordered fields.Validation
Full gate on
df20a96(Python 3.14 venv, pinned dev requirements), all passed:ruff check .,mypy(40 files),lint-imports(2 contracts kept),deptry .,xenon -a B -m C -b F -e "*/ms_auth.py" lighthouse_cli,python scripts/check_secrets.py,pytest -q(2989 passed).On
e3bdbda, which changes onlytests/test_quiz_learner.pyand the two docs:ruff check .,mypy,python scripts/check_secrets.pyandpytest -q tests/test_quiz_learner.py(357 passed) all pass. The full suite was not rerun.No unrelated reformatting. Nothing was sent to Lighthouse.
Review
1 round, 3 seats (CodeRabbit + 2 models), reviewed head
df20a96. No P0 or P1, so review stops at round 1. All P2 and minor findings are fixed ine3bdbda, and no seat re-reviewed it.e3bdbda.Hosted CI on
e3bdbda: lint/types/architecture/deps, tests (py3.10, py3.13), droid-review and Socket all pass. Hosted bots: Pullfrog found no issues, the droid security review is empty, Greptile 5/5.