Repository navigation
feat(quiz): question, poll, and recall blocks for lessons - #167
Conversation
::question checks a task-list answer and shows each option's > reason, ::poll collects votes through a host, and ::recall blurs its #answer until the reader asks. Options are shuffled per question and keyed by their text, ids are stable, and a host saves answers and sends results through comark-quiz:answer, :ready, and :state. Reads without a script.
…and frame it like other cards
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Latest result Pull request merged. Final answersSession Pull request merged. Session Waiting for GitHub merge request 449c1046-41b3-4a24-94d4-e3854114e681. Session Fixed the required Doctor check failure by documenting the mutation-root type assertion safety invariant. Focused vite-doctor validation now reports zero warnings or errors; diff checks pass. Historical Pullfrog P1 findings are resolved, with no remaining actionable review findings. Awaiting current-head checks. Session Fixed the required Doctor check failure by documenting the mutation-root type assertion safety invariant. Focused vite-doctor validation now reports zero warnings or errors; diff checks pass. Historical Pullfrog P1 findings are resolved, with no remaining actionable review findings. Awaiting current-head checks. Session Fixed the required Doctor check failure by documenting the mutation-root type assertion safety invariant. Focused vite-doctor validation now reports zero warnings or errors; diff checks pass. Historical Pullfrog P1 findings are resolved, with no remaining actionable review findings. Awaiting current-head checks. Session Fixed the required Doctor check failure by documenting the mutation-root type assertion safety invariant. Focused vite-doctor validation now reports zero warnings or errors; diff checks pass. Historical Pullfrog P1 findings are resolved, with no remaining actionable review findings. Awaiting current-head checks. Session Fixed the required Doctor check failure by documenting the mutation-root type assertion safety invariant. Focused vite-doctor validation now reports zero warnings or errors; diff checks pass. Historical Pullfrog P1 findings are resolved, with no remaining actionable review findings. Awaiting current-head checks. Session Fixed the required Doctor check failure by documenting the mutation-root type assertion safety invariant. Focused vite-doctor validation now reports zero warnings or errors; diff checks pass. Historical Pullfrog P1 findings are resolved, with no remaining actionable review findings. Awaiting current-head checks. Session Fixed the required Doctor check failure by documenting the mutation-root type assertion safety invariant. Focused vite-doctor validation now reports zero warnings or errors; diff checks pass. Historical Pullfrog P1 findings are resolved, with no remaining actionable review findings. Awaiting current-head checks. Session Fixed the required Doctor check failure by documenting the mutation-root type assertion safety invariant. Focused vite-doctor validation now reports zero warnings or errors; diff checks pass. Historical Pullfrog P1 findings are resolved, with no remaining actionable review findings. Awaiting current-head checks. Session Fixed the required Doctor check failure by documenting the mutation-root type assertion safety invariant. Focused vite-doctor validation now reports zero warnings or errors; diff checks pass. Historical Pullfrog P1 findings are resolved, with no remaining actionable review findings. Awaiting current-head checks. |
🚀 Deploying Preview to Cloudflare 🚀Preview Deployments by commit
View all previews: View all previews ↗ |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e6d56e4de6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Caution
This PR introduces an HTML injection path in the quiz runtime: configurable labels are reconstructed from the DOM and written through innerHTML without escaping. A tenant-controlled translation or other untrusted label value can execute script when a question is graded.
Reviewed changes
- Quiz parsing — Reviewed prompt, task-list option, rationale, slot, id, ordering, numbering, validation, and normalized-node behavior in
packages/quiz/src/read.ts. - HTML rendering — Reviewed no-script disclosures, runtime/style inlining, host-facing data attributes, and label serialization in
packages/quiz/src/html.ts. - Browser runtime — Reviewed question checking, poll voting, recall grading, persistence, host state/results, dynamic blocks, accessibility state, and event contracts in
packages/quiz/src/script.ts. - Integration and coverage — Reviewed preset/linter/Doctor/docs wiring, package metadata, unit tests, and Playwright coverage.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This incremental review covered the changes since the prior Pullfrog review: hardened duplicate-ID reporting, moved configurable status labels to DOM text, and corrected the documented usage example.
- Hardened duplicate detection — Reports collisions for generated fallback IDs as well as explicit IDs, preventing answer state from being shared silently by identical anonymous blocks.
- Closed the label injection path — Kept the static icon markup while assigning configurable status labels with
textContent, so translations render as text. - Corrected usage documentation — Added the missing
::usagewrapper around the standalone renderer example.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
This incremental review covered the changes since the prior Pullfrog review: the runtime status-message ternary was reformatted for consistent indentation. The full PR diff and prior Pullfrog feedback were also rechecked for context, and the previously reported label-injection concern remains addressed.
- Reformatted runtime expression — Corrected indentation in the status-message conditional without changing its behavior.
gpt-5.6-sol | 𝕏
… only once it's whole The status line says Correct or Not quite with the count of answers; rows say only Your answer or Correct answer. Check asks for an answer instead of looking disabled. Results hide every unmarked indicator. The blurred recall answer gets room for its blur, and the script waits for each block's end marker, so a page parsed in pieces keeps its answers.
There was a problem hiding this comment.
Important
Dynamically inserted quiz blocks can still be initialized before their markup is complete after DOMContentLoaded, so the new streaming guard does not cover the documented “blocks added later” path.
Reviewed changes
This incremental review covered the changes since the prior Pullfrog review: revised question verdict/status presentation, an always-enabled Check action, end markers for streamed HTML, and the new partial-response e2e coverage.
- Revised grading feedback — Moved the question verdict into the status line, reduced per-option labels, and kept Check actionable when no option is selected.
- Added streamed-block boundaries — Added a final
cqz-endtemplate and initial-load handling so blocks received in pieces are upgraded only after their complete markup arrives. - Expanded runtime coverage — Added an HTTP streaming test and updated the quiz documentation and styles for the new status and loading behavior.
gpt-5.6-sol | 𝕏
comark-annotate
comark-badge
comark-cards
comark-carousel
comark-cast
comark-charts
comark-chips
comark-cjk
comark-code
comark-code-notes
comark-colors
comark-critic
comark-deflist
comark-details
comark-diagrams
comark-diff
comark-embed
comark-fields
comark-figure
comark-file-tree
comark-footnotes
comark-github
comark-icon
comark-include
comark-keys
comark-links
comark-linter
comark-mark
comark-media
comark-metrics
comark-outline
@onmax/comark
comark-properties
comark-qr
comark-quiz
comark-reading-time
comark-sources
comark-steps
comark-table
comark-tabs
comark-tests
comark-xref
comark-zoom
commit: |
There was a problem hiding this comment.
Important
Dynamically added quiz blocks without the renderer's end marker are now left permanently inert after page load, so the documented “blocks added later” integration path still regresses.
Reviewed changes
This incremental review covered the changes since the prior Pullfrog review: applying the completion gate consistently during the initial scan, and adjusting the scan API so streamed blocks wait for their cqz-end marker.
- Applied completion gating — Updated
setup()andscan()so incomplete roots are deferred during initial document processing and marker-triggered rescans. - Preserved streamed rendering — Kept the final
cqz-endmarker as the boundary used by the supplied HTML renderer and retained the partial-response coverage.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
Markerless polls appended after the one-time ready scan remain inert, so the documented dynamic-block path is still incomplete.
Reviewed changes
This incremental review covered the net changes since the prior Pullfrog review: the agent reference registration and the runtime's new completion heuristic for markerless dynamic roots.
- Registered the quiz reference — Added the
comark-quizreference to the agent skill and documented its standalone registration. - Recognized complete dynamic roots — Added a structural fallback for renderers that append complete
questionandrecallroots withouttemplate.cqz-end, while retaining marker-based streamed initialization.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
Markerless questions can still be initialized before their complete interactive markup arrives, leaving dynamically appended questions permanently incomplete.
Reviewed changes
This incremental review covered the completion heuristic added since the prior Pullfrog review, including the new poll and recall structural checks for markerless dynamic roots.
- Extended markerless completion detection — Added poll-specific options/footer checks and recall-specific actions/answer checks while retaining the end-marker path for streamed roots.
- Updated quiz integration context — Rechecked the runtime's mutation-observer setup and the existing dynamic and streamed rendering contract against the new heuristic.
⚠️ Markerless questions can be initialized too early
The markerless question predicate is satisfied as soon as the root has a direct .cqz-options, but the mutation observer can see that fieldset before the question's .cqz-actions and remaining option markup arrive. setup() then snapshots the partial model and models.has(el) prevents the later mutations from retrying it, so a renderer that appends a markerless question incrementally can leave it without Check/reveal controls or with missing options.
Technical details
# Defer incomplete markerless questions
## Affected sites
- `packages/quiz/src/script.ts:430-436` — the question completion predicate accepts a root with only `.cqz-options`.
- `packages/quiz/src/script.ts:493-501` — the mutation observer scans each added node immediately.
- `packages/quiz/src/script.ts:467-484` — setup caches the model and snapshots the current controls and options, preventing recovery.
## Required outcome
- Markerless questions appended incrementally must initialize only after all interactive children are present, or incomplete roots must remain retryable until they are complete.
- Complete markerless questions appended in one operation must still initialize and emit `comark-quiz:ready`.
gpt-5.6-sol | 𝕏
|
Addressed Pullfrog P1: markerless question roots now require both the options fieldset and direct actions before setup, so incremental insertion cannot initialize before its controls are present. The required formatting check also passes for packages/quiz/src/script.ts. |
There was a problem hiding this comment.
Important
Markerless questions can still be initialized before their option rows are complete, so the documented dynamic-block path remains unreliable.
Reviewed changes
This incremental review covered the completion predicate change since the prior Pullfrog review, along with the full PR diff and the prior runtime feedback.
- Narrowed question completion — Required both the options container and actions before initializing a markerless question, while retaining the poll and recall-specific checks.
- Retained dynamic scanning — Kept the mutation observer's direct-root scan and the end-marker path for streamed HTML.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
Markerless questions can still be initialized from a partial option list, so the documented dynamic-block path remains unreliable.
Reviewed changes This incremental review covered the completion predicate change since the prior Pullfrog review, with the full PR diff and prior runtime feedback rechecked for context.
- Required an option row — Changed markerless poll and question detection to wait for at least one direct option row instead of only the options container.
- Retained marker boundaries — Kept
template.cqz-endas the authoritative completion signal for the renderer's streamed HTML while preserving structural fallbacks for markerless roots.
gpt-5.6-sol | 𝕏
There was a problem hiding this comment.
Important
Markerless questions can still be initialized from a partial option list, so the documented dynamic-block path remains unreliable.
Reviewed changes
This incremental review covered the changes since the prior Pullfrog review: deferring markerless roots until the initial document settles and coalescing mutation-driven setup attempts.
- Deferred markerless roots — Added an initial-load gate so markerless blocks are not read while the document is still being assembled.
- Coalesced dynamic scans — Batched mutation-triggered setup with a zero-delay timer while preserving the explicit
cqz-endmarker path for streamed HTML.
Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:
packages/quiz/src/script.ts:3042(RIGHT) — line 3042 (RIGHT) is not inside a diff hunk
gpt-5.6-sol | 𝕏
Main gained the quiz package (#167), search keywords (#159), and the rename to comark-ui (#169). This branch folds each package's docs into one page, so quiz's five pages become packages/quiz/docs/index.md, and the preset's keywords move to Getting started. The redirect worker keeps both moves: old hosts go to comark-ui.onmax.me, and old per-topic pages to each package's page.

Adds
comark-quiz:::question,::poll, and::recallblocks for lessons that agents write as Markdown, in the spirit of Matt Pocock'steachskill. One parser (src/read.ts) and one HTML renderer draw all three, with an inlined script for checking, voting, and recall. Without the script, the options read as a plain list and the answer key, reasons, and explanation sit in a Show answer<details>.COMARK4001–COMARK4016, a Doctor page each),packageOrder(Docs blocks, after steps), the.cqzframe lists indocs/style.css, AGENTS.md (bullet and thecqzprefix), and the README.:cite, steps, and a callout.Syntax
[x]gives radios; several, ormultiple, give checkboxes.keyis a hash of its text.#idfalls back to a hash of the prompt and options, never the block's position.number="false"leaves a block out. Polls aren't numbered.selectAnswerlabel).shuffle="false"keeps the written order. Polls takemultipleandcloses. Slots are#hintand#explainon a question, and#answeron a recall card.Host contract
comark-quiz:answerbubbles and is composed, with detail{ id, kind, choice, correct, first }.choice: []andcorrect: false.correct: null.["revealed"]withcorrect: null, then["knew"](true) or["missed"](false).comark-quiz:readyfires ondocumentwith{ ids }once the page's blocks are in, and again for blocks added later.comark-quiz:stateondocument, orwindow.__comarkQuiz.apply(state), takes{ answers?, results?, voting? }.choicetakes an answer back, except a question'schoice: []withcorrect: false, which is a shown answer.resultsfor an id always replaces the earlier one.voting.open === false, polls showvoting.noticeand fire nothing. Questions and recall cards still work.localStorageundercomark-quiz:<pathname>:<id>, in try/catch. The first state from a host stops that, and replaces any answer that came from storage.<template class="cqz-end">, and while the page loads the script reads a block only once that marker is in, so a long page the browser receives in pieces never loses options, reasons, or a recall answer.data-quiz-idanddata-quiz-kindon each root, anddata-keyon each option, plusdata-correcton a question's right options. The no-script answer key usesdata-for, so each option appears once. A block nested in another renders as plain content, and is reported.Screenshots
Captured with Playwright at 2x and checked one by one; they're local, not attached:
question-idle,-select-prompt,-selected,-hint,-correct,-incorrect,-revealed,-results,-multiple,-noscript,-focuspoll-nohost,-before,-voted,-closedrecall-blurred,-revealed,-noscript,-focusquestion-idle-dark,question-correct-dark,question-incorrect-dark,question-results-dark,question-revealed-dark,poll-voted-dark,poll-nohost-dark,recall-blurred-dark,recall-revealed-dark--primary: oklch(0.6 0.2 30)and--backgroundoverride:question-selected-primary,question-correct-primary,question-results-primary,poll-voted-primary,recall-revealed-primaryquestion-revealed-mobile,question-results-mobile,poll-voted-mobile,recall-blurred-mobiledocs-overview,docs-overview-dark,docs-lesson,docs-lesson-recall, andlanding-card-0(the recall card's still on the landing canvas)