Atomically import normalized template bundles through canonical versions

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
18/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
python
领域
backend

调研方向

Begin with mailing/management/commands/import_templates.py and the proposed mailing/services/template_bundles.py, then review the canonical #1 template service and #29 footer contract. This work is blocked on those dependencies and owner decisions, including receipt persistence; done means the agreed synthetic validation, atomic rollback, replay, concurrency, and exact-receipt tests pass without side effects.

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

描述

community-base enhancement

Atomically import normalized template bundles through canonical versions

Status: groomed preservation child of Relay #30; implementation blocked.
Depends on: #1 accepted canonical template/version/validation capability; #29 accepted footer capability; AISL #1885 frozen normalized schema. Profile reference agreement with proposed P02 is required before importing a bundle that requests it.
Blocked by: exact importer, #1 template/API/version, #29 model/migration, transfer and AISL schema owner acknowledgements. This issue grants no shared-path ownership or runtime import authority.

Goal

Add the missing whole-bundle validation, atomic apply and replay receipt around Relay's canonical #1 template service. Consume AISL's normalized offline bundle without losing override-only keys or whole-record subject/body/footer. Do not implement a second version lifecycle, publisher, context engine, exporter or renderer.

Scope

  • Add an explicit offline normalized-bundle mode through the existing import command and one cohesive service. Agree its schema with #1885; Relay consumes resolved records and does not inspect AISL files, overrides, Python modules or preview-context tables.
  • Preflight the entire bundle before mutation: schema revision, client scope, identity/digest, unique keys, exact literal content and metadata, #1 context/source validation, #29 footer support and supported profile references. Delegate existing validation; do not infer context requirements, stringify values, strip or truncate content, or invent a second type schema. Invalid late records and unsupported nonempty footer fail closed.
  • Apply validated records and a manifest-to-exact-version receipt in one explicit transaction using #1's canonical service. Same client/bundle identity and digest returns the original receipt without new versions or publications; changed content under the same identity conflicts without mutation. Any requested publication delegates entirely to #1's accepted revision/idempotency/concurrency rules; draft import must not silently publish.
  • A receipt names the exact canonical versions/revisions selected for every key. Never replace those references with moving latest values or mutate published rows. If the canonical service cannot participate in this atomic boundary, stop for a focused owner seam decision rather than write a parallel publisher.
  • Missing target keys cause no deletion. Import changes no contacts, messages, history, delivery jobs or outbound traffic. Existing screens, routes, API permissions, editor behavior and other-client data remain unchanged. No new bulk HTTP API or operator UI.

Acceptance criteria

  • A synthetic dynamic bundle includes file-derived, whole-record override and override-only records. Every declared key and subject/body/footer/metadata value is retained exactly; no fixed template count is used.
  • Invalid last item, duplicate key, invalid type, wrong scope/digest, unsupported profile or footer leaves all existing drafts, versions and receipts byte-identical, with zero contact/message/history/job/queue/provider side effects. Errors expose safe paths/reasons rather than rejected values.
  • Valid apply yields deterministic counts and an exact canonical-version receipt. Identical replay adds nothing; changed-digest identity conflicts roll back. A canonical validation/publication error midway rolls back the complete bundle and receipt.
  • Concurrent import/replay delegates #1's existing concurrency contract and yields one coherent receipt. Publishing a later version does not change the recorded mapping or any earlier immutable content. No duplicated publisher/version policy exists.
  • #29 footer and #1 validation/version behavior are consumed directly; any requested P02 profile reference is supported and pinned through its agreed canonical seam. Unsupported constructs remain rejected under #1, not silently transformed or discarded.
  • Independent Tester terminal evidence binds exact source/tree/schema/fixture hashes and meaningful negative controls; PM accepts afterward. This is offline capability only, not an actual A6.1 override export/import or site preservation receipt.

Meaningful tests and ownership

Use the cheapest synthetic cases: two records plus override-only key; invalid final item against preexisting draft/version snapshots; exact replay; changed digest conflict; forced canonical apply failure midway; simultaneous replay; receipt unchanged after a newer canonical version. Spies prove zero sends/queues/history changes. Removing preflight or atomic rollback must fail the retained assertions. No real donor database, SES or network.

Review targets: mailing/management/commands/import_templates.py as thin adapter; proposed mailing/services/template_bundles.py and a schema module only if cohesive; #1 canonical template service and #29 footer contract as dependencies. Receipt persistence, if required, needs the current model/migration owner; no migration number or model extraction is assigned here. Do not grow the oversized models.py/api.py/transactional.py or duplicate #29 extraction. New handwritten files <=300 lines, functions <=30, no ternaries, simple loops, explicit transactions and one business owner. No size waiver.

Follow Relay's PM → SWE → independent Tester → PM acceptance → focused commit → orchestrator/on-call process, with repository test commands selected by Tester. Current committed guidance uses the obsolete Datamailer name; actual repository is DataTalksClub/relay. Resolve guidance/path ownership with owners; do not change protected guidance in this issue.

Boundaries

#1 owns credentials, version lifecycle, context engine, rendering/source selection and queued snapshots. #29 owns authored footer. Proposed P02 owns only recipient-compatible output. #1885/A6.1 own export and real source-of-truth reconciliation; P07 owns AISL business context/lifecycle; #22 campaigns, #26 history and #32 outcome certainty remain separate. No UI changes, feature/data retirement, production access, real import/publish/send, deployment, cutover or donor deletion. Existing donor paths remain until their replacements and adoption receipts pass; #30 remains open.

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

环境准备

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

从这里开始

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

DataTalksClub/relay 的其他 Issue

查看 DataTalksClub/relay 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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