Declare C5.2m coursework Project defaults (module, commit_id_field) in the shared-course import mapping

未关闭
#448 6 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
55/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
django, python

调研方向

Read scripts/prod/import_shared_course_platform.py, especially _mapping(), _refuse_mapping_drift(), and _import_projects(), then run the existing importer and defaults tests. Extend scripts/tests/test_import_shared_course_platform_defaults.py for fresh defaults, replay preservation, and unknown-field refusal, and update _docs/architecture/course-platform-shared-apps-mapping.md. Done means the focused tests and required verification checks pass without changing the pinned environment or unrelated import behavior.

由索引模型根据 Issue 内容生成。

描述

bug courses data-migration integration P1

Goal

Keep the DataTalks.Club course experience, learner records, and shared-course import behavior unchanged while accepting two reviewed community-base C5.2m Project fields. Preserve the importer's refusal of every unreviewed field. This is bounded compatibility work for the shared AISL/DTC course package, not a site feature change.

Read first and authority

Evidence and field decisions

At DTC main 058956428f19aaeaa292c980afac75e92132b841, scripts/prod/import_shared_course_platform.py:_mapping() maps courses.Project to cb_coursework.Project and declares only pooled_review_window_days as a package default. _refuse_mapping_drift() checks actual concrete target fields before family writes. The P16 DTC consumer job for PR #351 reports 21 MappingCoverageDrift errors after the candidate adds two concrete fields in cb_coursework.0006_project_module_commit_id_field.

Target field DTC source decision Fresh imported row Replay
Project.module DTC projects belong to a Cohort; site modules remain site-side under decision 4, so no source module FK is inferred. Package nullable FK default None. Preserve any target-side module assignment.
Project.commit_id_field DTC's existing submission model and flow collect a commit ID. Package Boolean default True. Preserve any target-side value.

The candidate also changes ProjectSubmission.commit_id to blank=True; project validation still requires it when commit_id_field=True. That package validation change is not a DTC import mapping field and requires no DTC submission rewrite. The currently pinned community-base v0.5.10 lacks the two target fields. Exact default names are inert under that pin because the drift guard checks actual model fields; every other unclassified concrete field must still refuse the run.

Scope and non-goals

  • In scripts/prod/import_shared_course_platform.py, add only module and commit_id_field to the existing Project package-default frozenset. Keep _refuse_mapping_drift() strict and keep _import_projects() write values and identity key unchanged.
  • Extend scripts/tests/test_import_shared_course_platform_defaults.py, the existing registered test owner, with Project real-candidate default, replay, and unknown-field refusal coverage. Reuse its synthetic graph and helpers where practical; keep the test file within the coding-standard size limit.
  • Add the two decisions to _docs/architecture/course-platform-shared-apps-mapping.md beside the other reviewed package defaults.
  • Do not edit package code, site models/migrations, public readers, forms, templates, routes, API, permission rules, project-submission validation, deployment workflow, dependency pin, lockfile, quality exclusions, or broad field allowlists. Do not assign a shared module from a site module or force these values into replay update dictionaries.

Dependencies and sequencing

The exact reviewable PR #351 candidate and migration already exist, so engineering may start in its own clean isolated DTC worktree. Package merge or v0.5.19 release is not a prerequisite: the package's required P16 DTC check needs this source correction on DTC main first. Use the candidate only in a package-owned disposable consumer context for actual-model proof; keep the original DTC worktree on its tagged pin.

Development recovery #442 / aws-infra #58 is a separate operational gate. It does not block local compatibility implementation, independent testing, PM source acceptance, or source integration. If the ordinary exact-source development deploy remains refused, keep this issue open with Refs #448 and record the blocker; do not claim deployed acceptance. No further database reset, manual AWS change, deployed import, or workaround is authorized here.

Sequence: frozen DTC patch and pinned tests -> exact PR #351 candidate-model proof -> independent tester -> PM acceptance -> focused source commit and local no-ff main merge/push -> on-call observes DTC CI and ordinary development deploy -> package owner reruns final P16 against updated DTC main -> package PR merge/release under its own process.

Acceptance criteria

  • AC1: Only the two exact reviewed cb_coursework.Project fields join its package-default set. DTC source fields, import value dictionary, natural key (cohort, slug), and all other mapping families retain their behavior. The existing v0.5.10 pin, pyproject.toml, uv.lock, and source seals remain unchanged.
  • AC2: The pinned site environment accepts simulated concrete Project.module and Project.commit_id_field together. A genuinely unrelated concrete Project field still raises a named MappingCoverageDrift before _import_courses or any family write. A broad default, catch, suppression, or bypass does not satisfy this criterion.
  • AC3: Against exact candidate 97bafa0449dd5f215680b7500c65611280ae5b05 with its real 0006 migration, a fresh synthetic import produces Project module_id=None and commit_id_field=True, preserves copied fields, project submissions and equal family counts. No candidate-only skip counts as proof.
  • AC4: In that real-candidate context, replay keeps project and submission identities and existing learner/review/score records; after a target-only Project module and commit_id_field=False are set, replay preserves both while still refreshing ordinary copied source fields. An unrelated concrete target field still fails before writes. No duplicate rows or reset of target-only metadata occurs.
  • AC5: Mapping documentation states why each default is safe, the fresh and replay values, the absent-field behavior under the current pin, and continuing unknown-field refusal. No UI, URL, copy, accessibility, permission, or API behavior changes.
  • AC6: Focused importer/default tests, migration-drift check if selected, make lint, make lint-advisory, and every component selected by the versioned verification plan pass. Engineer records exact base/head, patch digest, graph/plan digests, commands/counts, and all rerun, reused, skipped, and not_applicable dispositions. Required failures or pending evidence are fixed before handoff.
  • AC7: Separate tester independently recomputes the plan, verifies frozen source and candidate evidence, runs focused Django and applicable browser checks, and posts a PASS report. PM then accepts the user-visible preservation contract. Source CI and ordinary development deployment are reported separately after push; a failed deployment is not accepted as green.

Verification scenarios

  • Pinned DTC: run uv run --frozen python manage.py test scripts.tests.test_import_shared_course_platform scripts.tests.test_import_shared_course_platform_defaults. The existing importer suite covers dry-run rollback, family equality, replay and refusals; extend the defaults suite for the two Project fields and unrelated-field refusal.
  • Candidate package: in a disposable package-owned P16 consumer checkout overlaying only the frozen DTC patch, run the same importer/default modules against the exact PR #351 SHA and real migrated model. Record package SHA, DTC base/patch digest, environment, counts and zero candidate-only skips. Run the selected broader plan when the controller requires it.
  • Generate and run the local verification plan with uv run --frozen python scripts/ci.py verification-plan, verification-run, and verification-report-check per the plan's command/environment contract. scripts/ is import/test infrastructure, so use the graph-selected full checks when required. Do not hand-narrow the plan.
  • Browser: this change has no product-page render surface, so screenshots are not_applicable with that reason. The separate tester runs at least uv run --frozen python scripts/ci.py test-playwright-smoke; use a broader browser tier if the generated plan selects it. There is no new URL, state, copy, or denial flow to screenshot. All data remains synthetic and local.

Required role handoffs

SWE owns the three named paths and freezes an uncommitted patch. A separate tester verifies it; PM accepts after tester PASS. SWE then commits with Refs #448 while the development gate is open. Root merges locally with --no-ff, pushes, and dispatches sole on-call observer. DTC creates no pull request.

主要语言
Python
星标
0
派生
0
平均合并
37 分钟
30 天内合并 PR
36

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DataTalksClub/website 的其他 Issue

查看 DataTalksClub/website 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。