Investigate shared homework scoring consolidation without behavior changes
还没有人认领这个 Issue。
评估
调研方向
Start from commit f143a19b7d5ef7b713c7b8139d01619f333961b6 and inspect courses/homework_answer_checks.py, courses/homework_score_calculation.py, and courses/views/homework_answers.py, then build the required repository-wide caller inventory. Run the focused answer-check, resolution, crypto, scoring, and rendered-answer tests before and after; done means the duplicate is gone, all callers use community_base.coursework.answer_checks, behavior is unchanged, and the specified CI verification passes.
由索引模型根据 Issue 内容生成。
描述
Retire duplicate homework answer checks using the pinned shared package
Status: groomed, ready
Tags: courses, enhancement, P1
Depends on: None. #438 is complete in merged commit f143a19b7d5ef7b713c7b8139d01619f333961b6; use that revision or a descendant as the implementation base.
Blocks: —
Reporter context
The owner wants DTC, AISL, and community-base course code simplified without changing any feature or visible UX. The retirement inventory named DTC homework checking and scoring as a candidate, but a candidate is not approval to replace scoring orchestration or to bypass the larger cohort adoption in #55.
Normative references
_docs/specs/04-courses-and-cohorts.md, especially the preserved homework/question/answer/scoring contract and its characterization requirement._docs/specs/07-security-privacy-operations.mdfor bounded answer failures and redaction._docs/architecture/app-boundaries.mdandAGENTS.mdfor one domain owner and no legacy runtime shim._docs/ci/change-selective-ci.mdand_docs/specs/10-verification-strategy.mdfor versioned verification.community-basev0.5.10,community_base.coursework.answer_checks, the public owner already in DTC's pin.docs/plan/evidence/code-retirement-inventory-2026-09-29.md, ranked bundle 8.
Scope
With #438 merged at f143a19b7d5ef7b713c7b8139d01619f333961b6 as the implementation base, remove the duplicate courses/homework_answer_checks.py module and retarget its production and test imports directly to community_base.coursework.answer_checks. Production importers are courses/homework_score_calculation.py (is_answer_correct) and courses/views/homework_answers.py (is_free_form_answer_correct); verify the complete caller set on the implementation revision, including all Python import forms, aliases, tests, patch targets, and dynamic strings. Do not leave a compatibility facade or copy the checks into another site file.
The v0.5.10 shared module has the same answer and question type values and checking rules as the site duplicate. Its Question and Answer annotations do not enforce model identity at runtime; its checks use the existing DTC question/answer attributes and methods. DTC already installs community_base.coursework. Characterize this interoperability on actual DTC model instances before deleting the duplicate. Preserve the exact HomeworkAnswerCryptoError identity established by #438 and the current Question.get_correct_answer() resolution and configuration path.
Keep courses/homework_score_calculation.py as DTC's scoring owner. Its FAQ and learning-in-public components, persistence, observability, invalidation and transaction behavior are outside this slice. Retargeting its answer-check import does not adopt package scoring.py. Report actual net application lines deleted separately from changed test imports; the 145-line site check module is a gross candidate, not a promised net reduction.
Behavior to preserve
ANYanswer handling, free-form trimming, case-insensitive exact and contains checks, integer parsing, and the existing 0.01 default float tolerance.- Multiple-choice and checkbox answer indexing, comma splitting, blank answers, malformed numeric input behavior, and unknown answer/question type behavior.
- The precise crypto failure boundary:
is_answer_correctconvertsHomeworkAnswerCryptoErrortoFalse, while other exceptions keep their existing behavior. Never reveal source answers, key material or ciphertext in errors or logs. - Existing configured keyring lookup, source answer resolution, stored envelopes, scores, answer correctness fields, rendered feedback, routes and permissions.
Non-goals and dependency boundary
- No package pin bump, package change, model/schema migration, stored-data rewrite, template/view behavior change, API addition, or new UI.
- No replacement of
courses/homework_score_calculation.pyor homework batch scoring with package scoring. #55 remains the dependency-blocked domain adoption owner for that larger transition; this issue does not satisfy or bypass its prerequisites #51, #52, #53 and #244. - #438 is complete at
f143a19b7d5ef7b713c7b8139d01619f333961b6; base the isolated implementation worktree on that commit or a descendant. Do not edit or reuse #438's frozen verification worktree. Its shared crypto exception identity is part of this contract. - Keep the shared DTC
mainand other agents' work untouched. Use an isolated issue worktree; no merge, push or PR during review.
Acceptance criteria
- A pre-deletion and final-revision caller inventory covers direct, parent-package and dotted imports, aliases and attributes, tests, scripts, patch targets and dynamic references; no use of the deleted site module remains.
-
courses/homework_answer_checks.pyis deleted and every caller uses the v0.5.10 public package owner directly, with no facade or second implementation; actual net application lines deleted are reported separately from test changes. - Shared checks operate on DTC
QuestionandAnswerinstances with the sameAnswerTypesandQuestionTypesvalues, answer resolution/configuration, and exact shared crypto exception identity established by #438. - Existing tests characterize and preserve correct/incorrect
ANY, exact, contains, float, integer, multiple-choice, checkbox, blank, malformed and unknown-type outcomes, including score values and safe crypto failure. Add a focused behavior test before deletion only for a material uncovered boundary. - DTC FAQ and learning-in-public score components, persistence, observability, invalidation, scoring errors, timestamps and grading UX remain unchanged; no package scoring orchestration is adopted.
- No package pin, model, migration, template, route, API, permission, stored answer or visible page change occurs.
- Focused answer-check, answer-resolution, crypto, homework-scoring and rendered-answer tests pass before and after.
uv run --frozen python scripts/ci.py lintand the versioned_docs/ci/change-selective-ci.mdverification plan, run, evidence-check and report-check pass; execute the graph-selectedscripts/ci.pyquality contract (includingverification-qualitywhen required by the plan) with exact base/head, graph and plan digests and every component disposition recorded by Engineer and independent Tester. Use the graph-selected backend browser tier; any fallback follows the plan. - Independent Tester verifies the uncommitted isolated diff, including a repository-wide import check and screenshot evidence classified as
not_applicableonly if the graph confirms no render impact. PM accepts afterward. No commit, merge, push or PR occurs before the approved handoff.
Browser regression scenario
Learner submits and reviews graded homework
Given an enrolled learner has an existing homework containing free-form and choice questions, including a source-managed encrypted correct answer,
when the learner submits answers and later views the scored homework,
then answer correctness, question/FAQ/learning-in-public components, total score, feedback and safe answer visibility match the current site. The backend ownership change introduces no new page or browser behavior.
Repository and operations scenarios
- An answer whose stored encrypted source value cannot be resolved produces the same safe false correctness result through the shared crypto exception class.
- A malformed numeric choice retains the existing failure boundary; the refactor does not silently turn it into an incorrect-answer result.
Blocked by: None. #438 was merged at f143a19b7d5ef7b713c7b8139d01619f333961b6.
- 主要语言
- Python
- 星标
- 0
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
DataTalksClub/website 的其他 Issue
-
bug infra operations P1 testing
难度 2/5 1-3 小时 新手友好度 72/100
DataTalksClub/website#329 ·
-
bug content data-migration documentation events operations P1
难度 2/5 1-3 小时 新手友好度 84/100
DataTalksClub/website#327 ·
-
bug frontend P0 testing
难度 2/5 1-3 小时 新手友好度 90/100
DataTalksClub/website#300 · 7 条评论 ·
-
bug data-migration events P0 testing
难度 2/5 1-3 小时 新手友好度 72/100
DataTalksClub/website#295 · 6 条评论 ·
-
courses enhancement P1 security
难度 4/5 3-5 天 新手友好度 45/100
DataTalksClub/website#438 · 6 条评论 ·
查看 DataTalksClub/website 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 90/100
维护者通常 1 天内回复
-
instance instance add
难度 2/5 1-3 小时 新手友好度 68/100
searxng/searx-instances#941 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 92/100
FluidNumerics/fluid-walk-blocker#89 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复