Skip to content

Add controlled upstream synchronization from CMP main #145

Description

@alexeygrigorev

Parent epic: #5
Related baseline: #30 (closed)

Outcome

Keep the adopted Course Management Platform copy current without turning this repository into a blind mirror. A clean, reviewed CMP commit must be synchronizable into the website while preserving the target-owned site shell, studio_courses namespace mapping, integration overlays, and migration safety gates.

Scope

  • Add a versioned CMP upstream-sync command and documentation using uv.
  • Fetch a clean CMP source checkout at an explicit commit/ref; never copy an uncommitted source worktree.
  • Compare the current pinned source commit with the requested CMP commit and produce a changed-path report.
  • Reuse the adoption allowlist and literal source-to-target mapping from Copy the existing course platform verbatim and establish its characterization baseline #30, including cadmin/*studio_courses/* and source templates → course_platform_templates/*.
  • Copy new/changed non-overlaid allowlisted files mechanically and regenerate copied-files.tsv plus the pinned-source metadata.
  • Preserve files listed in integration-patched-files.tsv; generate a deterministic conflict report when the upstream source side of an overlay changes.
  • Fail closed for source deletions/renames, migration removals/replacements, target-owned collisions, unknown allowlisted roots, or a dirty source checkout.
  • Add a dry-run mode that makes no target changes and reports the exact source commit, changed files, conflicts, and required follow-up.
  • Add focused tests for clean sync, dry-run, path mapping, overlay conflict detection, and destructive-change rejection.
  • Add a manual CI workflow (and a non-mutating scheduled drift check if practical) that verifies CMP main drift but never deploys or merges it automatically.
  • Keep the existing adoption verifier authoritative after a sync.

Non-goals

  • Do not automatically deploy or merge CMP changes.
  • Do not copy source secrets, databases, caches, deployment files, editor metadata, or untracked worktree changes.
  • Do not overwrite target-owned integration files or silently resolve overlay conflicts.
  • Do not squash, rewrite, or remove existing Django migrations.
  • Do not redesign Course → Cohort models, routes, Studio, or the website shell.
  • Do not replace the tester/PM lifecycle with a green workflow check.

Acceptance criteria

  • A documented uv run command can dry-run a clean CMP commit and reports the exact pinned/current SHA and changed source paths without changing tracked files.
  • A successful sync uses the recorded allowlist/path mapping and updates the source pin and copied-file checksums deterministically.
  • cadmin/* maps to studio_courses/*, source templates map to course_platform_templates/*, and target-owned cadmin compatibility adapters remain untouched.
  • Any changed destination listed in integration-patched-files.tsv is preserved and reported as a conflict with old source, new source, and target-overlay evidence.
  • Dirty source checkouts, deleted/renamed allowlisted files, migration removals/replacements, unknown roots, and target-owned collisions fail before mutation.
  • Sync never removes an existing target migration or creates a squash/replacement migration.
  • Unit tests cover the dry-run, successful non-overlap, mapping, overlay conflict, and fail-closed paths.
  • The existing adoption verifier, migration check, lint/format checks, and focused copied-course tests pass after a no-op sync.
  • CI provides manual sync/drift invocation and a non-mutating report; no workflow can merge or deploy upstream changes by itself.
  • Documentation explains the clean-commit requirement, conflict resolution, review gates, rollback to the previous pin, and the current uncommitted CMP-worktree limitation.

Test scenarios

  1. Dry-run against the current pinned commit: no file changes and a zero-change report.
  2. Dry-run against a clean CMP commit containing only an excluded .claude/metadata change: report it as excluded and make no target change.
  3. Sync a fixture source with one changed non-overlaid allowlisted file: copy it, update the manifest, and verify the adoption checker.
  4. Change a source file whose destination is in integration-patched-files.tsv: preserve the overlay and emit a stable conflict report.
  5. Delete or rename an allowlisted file, remove a migration, dirty the source checkout, or collide with a target-owned file: fail before writing.
  6. Run the no-op sync and then uv run python scripts/verify_course_platform_adoption.py, make migrations-check, and the focused course test set.
  7. Run the CI drift check: it reports differences but does not modify the branch, issue state, deployment, or source checkout.

Dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions