Investigate shared homework scoring consolidation without behavior changes
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 46/100
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from DataTalksClub/website
-
bug infra operations P1 testing
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DataTalksClub/website#329 ·
-
bug content data-migration documentation events operations P1
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
DataTalksClub/website#327 ·
-
bug frontend P0 testing
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
DataTalksClub/website#300 · 7 comments ·
-
bug data-migration events P0 testing
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
DataTalksClub/website#295 · 6 comments ·
-
courses enhancement P1 security
Difficulty 4/5 3-5 days Newbie friendliness 45/100
DataTalksClub/website#438 · 6 comments ·
All issues in DataTalksClub/website
Similar issues
-
ACK_WAITING HELP_WANTED UPDATE_CS
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
OWASP/CheatSheetSeries#2458 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
BasedHardware/omi#19711 ·
Maintainers usually reply within 1 day
-
Qwen3_5MoeModel no longer returns router_logits, breaking aux loss with output_router_logits=TrueOpen
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
huggingface/transformers#49172 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
vllm-project/vllm-metal#885 ·
Maintainers usually reply within 1 day