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

オープン
#448 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
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分
マージ済み PR(30日)
36

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DataTalksClub/website のほかの issue

DataTalksClub/website の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。