Skip to content

修复段落标题匹配题已用选项标灰禁用 - #109

Merged
sallowayma-git merged 6 commits into
sallowayma-git:opensourcefrom
swiftiejerry:fix-matching-option-consumed
Aug 13, 2026
Merged

修复段落标题匹配题已用选项标灰禁用#109
sallowayma-git merged 6 commits into
sallowayma-git:opensourcefrom
swiftiejerry:fix-matching-option-consumed

Conversation

@swiftiejerry

Copy link
Copy Markdown
Contributor

Summary

用户建议:段落标题匹配题(List of Headings)中,已用选项应从候选池消失/禁用,方便做题时直观看到哪些选项已被使用。

Implementation

  • 不允许选项复用的题组(allowOptionReuse=false),选项使用后在候选池标记为已使用:opacity 0.45 变灰、pointer-events none 不可选中、draggable false
  • 取消使用(拖回候选池/清空答案)后自动恢复为可用状态
  • 修复左右分栏布局下 group/pool 查找失效问题(原 closest 查找无法跨分栏):
    新增 resolveOptionGroupAndPool 辅助函数,通过 sourcePoolId 优先查找,兼容分栏/非分栏布局
  • buildDragPayload 携带 sourcePoolId,确保选项来源追踪正确
  • disableDragInteractions 全局锁定时仍尊重已用选项的禁用状态
  • 重置时兜底清理所有 option-consumed 状态
  • 答案回放(草稿恢复)时同步标记选项为已使用
  • bundle 已重新构建

Validation

  • 段落匹配题(如 p1-high-118 Questions 1-7):拖选项到答案区后,候选池选项变灰禁用
  • 拖回候选池/清空答案:选项恢复可用
  • 左右分栏布局下功能正常
  • 允许复用的题组(人名匹配)不受影响

- 段落标题匹配题(List of Headings)等不允许选项复用的题组,选项使用后在候选池标记为已使用(opacity 0.45 变灰,pointer-events none 不可选中,draggable false)
- 取消使用后自动恢复候选池中的选项为可用状态
- 修复左右分栏布局下 group/pool 查找失效的问题(原实现使用 dropzone.closest 无法跨分栏找到正确容器)
- 新增 resolveOptionGroupAndPool 辅助函数,通过 sourcePoolId 优先查找,兼容分栏/非分栏布局
- 修改 buildDragPayload 携带 sourcePoolId,确保选项来源追踪正确
- 修改 disableDragInteractions 全局锁定时仍尊重已使用选项的禁用状态
- 重置时兜底清理所有 option-consumed 状态,避免重置后选项残留禁用
- 答案回放(草稿恢复)时同步标记选项为已使用,保持与拖拽路径一致
- bundle 已重新构建

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fa55193492

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread js/runtime/unifiedReadingPage.js Outdated
Comment thread js/runtime/unifiedReadingPage.js Outdated
1. 替换已填答案时恢复旧选项:用户向已有答案的 dropzone
   拖入新选项后,旧选项不再被使用,恢复其在候选池的可用状态
   (原实现只消耗新选项,旧选项永久灰置直到重置)

2. stillUsed 检查包含 summary 填空 dropzone:恢复选项时
   检查 .drop-target-summary(summary 填空题的答案容器),
   防止选项从一个空格拖到另一个空格时被误恢复

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@swiftiejerry

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee2acc489e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread js/runtime/unifiedReadingPage.js Outdated
同一页面存在多个不允许复用的题组且使用相同选项字母时
(如 p2-high-233 组2/组3 都用 A-E),跨组扫描 allDropzones
会误伤其他组的独立选项——清空组3 的 A 时因组2 仍在用 A
而不恢复组3 的 A。

修复:stillUsed 检查按当前组的 data-question-ids 过滤 dropzone,
只检查本组的段落/匹配/summary 答案区。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@k-undurkhaan-2

Copy link
Copy Markdown
Collaborator

NOTICE to Contributor:

Your contribution has been seen by the reviewer, and we will run our review workflow later.

Please note that the automated review bot may report unexpected types of issues in its comments, such as some issues which is not merge-blocking. If the coding agent is allowed to automatically fix every issue reported without human review, it may unintentionally modify unrelated or unexpected parts of the codebase.

Therefore, we strongly recommend that you Do Not start or run any new automated code reviews until we explicitly authorize you to do so.

Thanks for your effort on contribution!

By Collaborator of this repository

@k-undurkhaan-2 k-undurkhaan-2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Requesting changes against current head ae02112f. This review contains only merge-blocking defects introduced by this PR and reproducible in existing exams or production workflows. It excludes resolved threads, theoretical-only paths, and pre-existing codebase issues.

Four state-consistency blockers must be addressed: restoring an option bypasses timer/read-only locks; no-reuse .draggable-word groups are not covered; cross-group swaps corrupt consumed state; and consumed state accumulates across consecutive replays of the same exam.

The runtime source and generated bundle are currently in sync. After fixing the runtime, rebuild the bundle and add regression coverage for these transitions.

@k-undurkhaan-2
k-undurkhaan-2 dismissed their stale review August 13, 2026 11:56

Superseded so the review can be resubmitted in compliance with the updated local agent policy requiring English-first GitHub workflow content.

@k-undurkhaan-2 k-undurkhaan-2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Requesting changes against current head ae02112f. This review contains only merge-blocking defects introduced by this PR and reproducible in existing exams or production workflows. It excludes resolved threads, theoretical-only paths, and pre-existing codebase issues.

Four state-consistency blockers must be addressed: restoring an option bypasses timer/read-only locks; no-reuse .draggable-word groups are not covered; cross-group swaps corrupt consumed state; and consumed state accumulates across consecutive replays of the same exam.

The runtime source and generated bundle are currently in sync. After fixing the runtime, rebuild the bundle and add regression coverage for these transitions.

Comment thread js/runtime/unifiedReadingPage.js Outdated
Comment thread js/runtime/unifiedReadingPage.js Outdated
Comment thread js/runtime/unifiedReadingPage.js Outdated
Comment thread js/runtime/unifiedReadingPage.js
1. 恢复选项时保留计时/只读锁:restorePoolOption 恢复可用性时
   检查 state.readOnly/timerLocked,避免绕过锁定继续作答
2. 覆盖 draggable-word 候选池:统一 pool 容器解析(.pool-items/
   #word-options/.options-pool)和 item 查找(.drag-item/
   .draggable-word/.card),16 个选词填空组的 no-reuse 生效
3. 跨组交换协调两个池:重构 handleDropOnDropzone,源/目标
   dropzone 独立消耗和恢复;先移入目标旧值再恢复源旧值,
   修复源旧值误判仍在使用
4. replay 前重建消耗状态:applyReplayAnswersToDom 先重置所有
   候选池 consumed 状态,再按新记录完整答案集重新消耗

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@k-undurkhaan-2 k-undurkhaan-2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The four merge-blocking issues from my review of ae02112f are resolved in 6bfe2ef: lock-aware restoration, existing .draggable-word pool coverage, cross-group swap reconciliation, and replay-state rebuilding all now follow the required state invariants.

This approval supersedes only that resolved review state. It does not dismiss or delete its history; a separate review of the current head will track any newly discovered blocker.

@k-undurkhaan-2 k-undurkhaan-2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Requesting changes against current head 6bfe2ef. The four blockers from the previous review are resolved and are not repeated here.

One merge-blocking defect remains in this PR's no-reuse implementation: existing card-based candidate pools are not resolved, so consumed options remain reusable. This review contains no pre-existing codebase issues.

Comment thread js/runtime/unifiedReadingPage.js Outdated
swiftiejerry and others added 2 commits August 13, 2026 21:37
Workflow 全面验证发现核心修复(card-pool 容器解析)正确,
但补全以下关联遗漏:

1. consumed 样式补 .draggable-word:选词填空的单词禁用时也标灰
2. drop 处理器改用 POOL_CONTAINER_SELECTOR:卡片/选词池也能
   拖回恢复(原只识别 .pool-items)
3. parseDragPayload 透传 sourcePoolId:修复分栏兜底追踪死代码
4. initDragPools 统一容器/选项选择器:新容器获得 pool id 和
   originPool 追踪
5. 防御性纳入 .headings-pool

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Add browser regression coverage for non-reusable cardpool and option-pool variants, consecutive replay reconciliation, and the reusable-group guard. Keep the static consumed-state styling aligned with the runtime selectors.

Refs sallowayma-git#109
@k-undurkhaan-2

Copy link
Copy Markdown
Collaborator

Update: signed commit bc7d47ad has been pushed directly to the existing PR head branch. It adds regression coverage for .cardpool and .option-pool consumed-state behavior, consecutive replay replacement, reuse-enabled pools, and the static consumed-style contract. All previously addressed review threads remain resolved. No review was dismissed.

@k-undurkhaan-2 k-undurkhaan-2 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The merge-blocking card-pool defect identified at 6bfe2ef is fully resolved at bc7d47ad. Both .cardpool and .option-pool now participate in pool discovery, initialization, source tracking, consume/restore handling, drop-back behavior, and consumed-state styling.

I verified all 11 existing card-based groups: the five no-reuse groups disable consumed cards, while the six reusable groups remain reusable. The runtime and generated bundle are in sync, targeted regressions and GitHub checks pass, and this adversarial review found no new merge-blocking issue introduced by this PR. Pre-existing codebase issues were excluded from scope.

@sallowayma-git

Copy link
Copy Markdown
Owner

ALL THINGS LOOK GOOD TO ME👍No new merge-blocking issue introduced by this PR

@sallowayma-git sallowayma-git left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

LGTM

@sallowayma-git
sallowayma-git merged commit 52fda31 into sallowayma-git:opensource Aug 13, 2026
2 checks passed
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.

3 participants