Skip to content

test(quiz): pin mid-save failures and the start form's assumptions; fix two doc claims (#79) - #86

Merged
rabesss merged 2 commits into
mainfrom
fix/79-post-78-review
Nov 8, 2026
Merged

rabesss merged 2 commits into
mainfrom
fix/79-post-78-review

Conversation

@rabesss

@rabesss rabesss commented Nov 8, 2026 •

Copy link
Copy Markdown
Owner

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

  • Finding 2: autosaves that fail after the first one (tests/test_quiz_learner.py). New test test_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, a NetworkError, 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 in LearnerSaveUnknownError itself, 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-iteration except Exception in save_learner_answers fails four of the five cases. A retried POST fails the call-count check.
  • Finding 1: what the start form expects from the summary.
    • test_start_refusals_send_nothing gains one case for each thing browser_form checks on the summary: missing d2l_controlMapPrev, a d2l_state whose second element is not empty, a QuizTabId control, a checkbox outside a question (it fails if the outside-question check is removed, checked by mutation), and no Deserialize call. Each refuses with REFUSE_LEARNER_FORM before anything is sent.
    • New test 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 start stops before sending anything.
    • docs/agent-quizzes.md: the refusals paragraph now includes both messages, so an agent knows to finish that quiz in Brightspace.
    • The strict start path is kept. fix(quiz): send learner attempt requests as the browser does #78's replay shows that it accepted a real Lighthouse summary, and nothing suggests a mismatch, so loosening it would only lower fidelity.
  • Finding 3: the RPC address now names the quiz_attempt_iframe_auto.d2lfile path.
  • Finding 4: the opening sentence of the learner section now says the start request was compared only by URL and headers, and that the browser autosaves every change while one attempt answer saves only its final value (two commands save twice).
  • The issue's nits were marked "no action expected" and are left alone.

Still open on #79

The first clause of the acceptance criterion is still open: attempt start exercised 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 only tests/test_quiz_learner.py and the two docs: ruff check ., mypy, python scripts/check_secrets.py and pytest -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 in e3bdbda, and no seat re-reviewed it.

  • gpt-6.1-sol — xhigh: SHIP WITH FOLLOW-UPS (no findings)
  • Grok 4.7 — xhigh: SHIP WITH FOLLOW-UPS. Three P2s, all fixed: the stray text-input case did not isolate the outside-question check; a second form or repeated field is an unreadable page, not the form refusal; the parity sentence overstated how the start request was compared. A first Grok run stopped without a verdict, because it tried a web tool that a headless run cannot approve. It was rerun with the PR body in its prompt.
  • CodeRabbit: one minor, fixed (the "saves once" wording holds only within one command).
  • Plan: MiniMax M3.1 Flash — max, two passes. Both majors from pass 1 were fixed before implementation. Pass 2 found no blocker or major, and three of its minors are in 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.

…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-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@factory-droid

factory-droid Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Droid finished @rabesss's task —— View job


Pass 2 complete: the candidate list is empty, so there are no comments to approve or reject. Read the full PR diff and existing comments; no tests were run during validation.

0 inline comments posted

@greptile-apps

greptile-apps Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This PR appears safe to merge.

Summary

This PR adds regression tests and clarifies the quiz protocol notes. It does not change runtime code.

  • Quiz-start guides explain when an unsupported summary form sends nothing.
  • A later answer save is tested against failures after the first save succeeds.
  • The submit guide now shows the RPC address ending in .d2lfile.

No actionable issues found. Tests were not run during this review.

Acknowledged limitation: rabesss explicitly leaves the captured-summary fixture open because the recording is only on the owner’s machine. The docs disclose that current tests use a synthetic summary.

Reviews (1) · Last reviewed commit: "test(quiz): pin mid-save failures and th..." · Reviewed by Greptile

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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): new test_a_failure_after_the_first_verified_save_is_unknown_and_not_retried saves and verifies the first answer, then fails the second five ways (500, NetworkError, SessionExpiredError on the POST, a 200 whose readback lacks the answer, a session expiry on that readback). Each case asserts the exact type LearnerSaveUnknownError, exactly two POSTs, the right page-read count (2 or 3), and both responses closed — pinning the per-iteration except Exception in save_learner_answers against narrowing or retry regressions.
  • Finding 1 — start-form assumptions pinned and documented: five new cases in test_start_refusals_send_nothing (missing d2l_controlMapPrev, d2l_state second element non-empty, a QuizTabId control, a visible input outside a question, no Deserialize call), each traced to a distinct browser_form check; plus a new test for the earlier parser refusals (second <form>, repeated hidden field → PreviewPageError, nothing sent). docs/quiz-protocol.md states the assumptions and the known limitation; docs/agent-quizzes.md now tells agents to finish such quizzes in Brightspace.
  • Findings 3 and 4 — doc corrections: the Submit bullet now names the quiz_attempt_iframe_auto.d2lfile path (matches attempt_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.py passes 357/357 and ruff is 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.

Pullfrog  | View workflow run | Using 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).
@factory-droid

factory-droid Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Droid finished @rabesss's task —— View job


Pass 2 complete: the candidate list is empty, so there are no comments to approve or reject. Read the entire PR diff and existing comments; no tests were run during validation.

0 inline comments posted

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 _successful fails 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_retried now 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 than len(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; one attempt answer saves only its final value), the Start bullet documents the POST URL (&cfql=0&inProgress=false, true to resume — matches start_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_CURRENT text shown for PreviewPageError.

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.

Pullfrog | View workflow run | Using glm-5.3 | 𝕏

Pullfrog  | View workflow run | Using glm-5.3 | 𝕏

@rabesss
rabesss merged commit f9e380e into main Nov 8, 2026
8 checks passed
@rabesss
rabesss deleted the fix/79-post-78-review branch November 8, 2026 06:10
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