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

Aperta
#448 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
django, python

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
0
Fork
0
Merge medio
37m
PR unite (30g)
36

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DataTalksClub/website

Tutte le issue di DataTalksClub/website

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.