Allow sites to select immutable Relay mail template versions

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

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

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
25/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
django, python
領域
api, backend

調査の方向性

Start with community_base.mail.service.send() and the existing EmailDelivery.template_version handling, then read the mail and kernel hook docs and docs/plan/phase-6.md. Trace the idempotency, resend, worker, and Relay paths, and add the resolver without site imports or a migration. Done means the listed acceptance criteria and package quality gates pass, CI comparisons are reported, and v0.5.35 and its release wheel are verified.

索引モデルが issue の本文から書いたものです。

説明

enhancement

Allow sites to select immutable Relay mail template versions

Status: in progress
Plan card: C6.2b in docs/plan/phase-6.md
Depends on: C1.2b
Blocks: AI-Shipping-Labs/website#2009

Goal

Let each consuming site select the published Relay template version for a mail purpose while every
EmailDelivery remains pinned and immutable. AI Shipping Labs needs reviewed version 2 templates
after removing its local renderers. DataTalksClub and unconfigured consumers must remain on version
1.

Scope

  • Add COMMUNITY_BASE["MAIL_TEMPLATE_VERSION_RESOLVER"], accepting a callable or dotted path with
    contract (purpose: str) -> int; no override resolves to 1.
  • Resolve the version once in community_base.mail.service.send() before any delivery or job is
    created. Persist it in the existing EmailDelivery.template_version; the worker and Relay
    backend continue using that stored value.
  • Accept only a strictly positive integer. Reject booleans, zero, negative integers, strings,
    None, and other types with MailError("invalid mail template version") and no writes.
  • Keep template_version in the immutable idempotency comparison. An exact replay returns the
    original delivery. If the resolver changes for the same idempotency key, raise MailConflict
    without mutating or requeueing the pinned delivery. A new audited resend resolves the current
    version for its new idempotency key.
  • Keep the package free of site imports. AI-Shipping-Labs/website#2009 will configure the dotted
    hook email_app.relay_versions.template_version_for, selecting version 2. DTC config remains
    unchanged and therefore selects version 1.
  • Add no model field or migration. Do not add a row-mutation command or resolve the version again
    in the worker.
  • Update the mail/kernel hook docs and architecture list. Bump package version and changelog for
    immutable release v0.5.35.
  • No AWS access, production data, containers, or real sends. No unrelated package work.

Acceptance Criteria

  • With no resolver configured, send() persists template_version=1 and the Relay request
    sends version 1 exactly as before.
  • A callable or dotted-path resolver receives the exact purpose and its positive integer result
    is persisted and sent to Relay.
  • Invalid results, including booleans, fail with MailError("invalid mail template version")
    before any EmailDelivery or JobIntent is created or enqueued.
  • Exact replay with the same resolved version returns the original delivery and creates no
    second job or send.
  • Resolver drift for the same idempotency key raises MailConflict and leaves the original
    delivery version, job, and dispatch unchanged.
  • resend() resolves the current version into its new logical delivery.
  • No migration is generated and package boundary tests confirm there is no site import.
  • Package mail tests and all quality gates pass with all extras installed and the collected
    test count recorded.
  • Package CI reports DTC baseline versus linked and AISL baseline versus linked separately,
    with no new linked failure; a pre-existing baseline failure is reported rather than called green.
  • Package main is green before immutable v0.5.35 and its release wheel are created; AISL
    does not pin the package before the tag exists.

Verification

  • uv sync --all-extras
  • uv run pytest tests/mail
  • uv run pytest
  • uv run ruff check .
  • uv run ruff format --check .
  • uv run python testproject/manage.py check
  • uv run python testproject/manage.py makemigrations --check --dry-run
  • Fresh SQLite uv run python testproject/manage.py migrate
  • uv run pytest tests/test_boundaries.py
  • python3 scripts/plan.py check
  • After direct HEAD:main push: package CI plus both P16 consumer comparison jobs.
  • git ls-remote --tags origin v0.5.35 and GitHub release wheel verification.

Workflow Override

The owner authorized direct HEAD:main delivery with no pull request for this dependency. Package
implementation, tester review, product acceptance, CI observation, immutable-tag rules, and both
consumer checks still apply.

主要言語
Python
スター
0
フォーク
0
平均マージ
1時間 5分
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

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

DataTalksClub/community-base のほかの issue

DataTalksClub/community-base の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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