Skip to content

contracts: follow devfactory-core semantics 1.2 - #37

Merged
monthop-gmail merged 1 commit into
mainfrom
contracts/semantics-1.2
Aug 21, 2026
Merged

contracts: follow devfactory-core semantics 1.2#37
monthop-gmail merged 1 commit into
mainfrom
contracts/semantics-1.2

Conversation

@monthop-gmail

Copy link
Copy Markdown
Owner

ปิดครึ่งของ #23 ที่ ADR-0015 ส่งกลับไปให้ devfactory-coreกลับมาแล้ว และไม่ต้องแก้ contract เลยสักตัว

⚠️ drift check ตอนนี้แดงอยู่ เพราะ semantics_version ต้นทางขยับไปแล้ว · PR นี้คือตัวแก้

FAIL  derived: approval: pin=1.1 แต่ต้นทาง=1.2 → out of conformance (ADR-0006)
FAIL  derived: event: pin=1.1 แต่ต้นทาง=1.2 → out of conformance (ADR-0006)

หลัง PR นี้: passed=20 FAIL=0 WARN=0

เกิดอะไรขึ้นที่ต้นทาง

RFC-0012 เพิ่ม guarantee ข้อที่สาม ให้ event:

ทุกการจบแบบ terminal ต้องออกใบปิดท้าย — ไม่ใช่แค่ทางที่จบสำเร็จ

JOB_COMPLETED เป็นใบปิดท้ายที่ทำงานได้จริงอยู่แล้วสำหรับ COMPLETED · สิ่งที่ขาดไม่ใช่กลไก แต่คือกฎว่ากลไกนี้ใช้กับทุกการจบ · ตอนนี้ JOB_SETTLED ออกทุก terminal รวม COMPLETED (สองใบตอบคนละคำถาม — งานถูกส่งมอบไหม vs บันทึกจบหรือยัง) พก settled_as และ event_count

ฝั่งเขา implement แล้ว: replay ได้ UnsettledTrail · PrematureSettlement · MiscountedTrail และ conformance ตรวจ trail จริงว่าครบทั้ง 4 terminal พร้อมตัดใบท้ายดูว่าถูกจับ

PR นี้แก้อะไร — pointer อย่างเดียว

ไฟล์ เปลี่ยน
contracts/event/v1/event.schema.yaml derived_from.semantics_version"1.2" · เพิ่ม rfcs/0012 ในรายการที่มา
contracts/approval/v1/approval.schema.yaml derived_from.semantics_version"1.2"
CHANGELOG ทั้งสอง บันทึกเหตุผล

ไม่มีอะไรใน schema เปลี่ยน:

  • guarantees block ในไฟล์เราเป็นของเรา และครอบของเขาอยู่แล้ว (8 ≥ 3) — drift check ยืนยัน
  • ไม่มี field ใหม่ — ใบปิดท้ายเป็น event type ไม่ใช่ field
  • event_type อ้าง EventTypeName ชุดเปิด → JOB_SETTLED validate ผ่านตั้งแต่วันนี้ โดยที่เราไม่ได้แตะอะไร

นี่คือ ADR-0015 option C ทำงานตามที่ออกแบบ — เราแยกสามชั้น ship เฉพาะชั้นที่เป็นของเรา (sequence สำหรับเรียง) แล้วชั้นความครบถ้วนกลับมาจากเจ้าของมัน

ทำไม approval/v1 ขยับทั้งที่ไม่เกี่ยว

semantics_version เป็นของ manifest ทั้งไฟล์ ไม่ได้แยกต่อ contract · RFC-0012 แตะเฉพาะ guarantee ของ event แต่ pointer ของ approval ก็ต้องขยับตาม

ถ้าอยากให้ contract ที่ไม่เกี่ยวไม่ต้องขยับด้วย ต้องแยก version ต่อ contract ที่ต้นทาง ซึ่งเป็นการเปลี่ยนกลไก ไม่ใช่การแก้รอบนี้ · เขียนไว้ใน CHANGELOG ของ approval แล้วเพื่อให้คนอ่านครั้งหน้าไม่ต้องมาขุดเอง

ที่ยังเป็นของท่านตัดสิน — ไม่ได้ทำมาให้

เพิ่ม JOB_SETTLED เข้า $defs.EventType เป็น additive ตาม ADR-0006 Rule 2 และเป็นการตัดสินใจฝั่งนี้ผ่าน ADR — เราจึงไม่ทำมาให้ในนี้

  EventType:
    enum:
      - JOB_CREATED
      ...
      - JOB_COMPLETED
      # ใบปิดท้ายของทุก terminal — devfactory-core RFC-0012
      # COMPLETED ออกทั้ง JOB_COMPLETED และ JOB_SETTLED เพราะตอบคนละคำถาม
      - JOB_SETTLED

ไม่มีอะไรรอมัน — payload ผ่านอยู่แล้ว · ค่านี้มีไว้ให้ consumer generate constant ของค่าที่ platform รับรองความหมาย ตามที่ description ของ $defs.EventType เขียนไว้เอง

consumers.md ไม่ต้องแก้ — สถานะและ pin ของ devfactory-core ไม่เปลี่ยน

Related

#23 · ADR-0015 · ADR-0006 · devfactory-core#26 · devfactory-core#29

🤖 Generated with Claude Code

RFC-0012 added a third guarantee to event: every terminal emits a closing record,
not only the one that ended well. That is a change to the frozen block upstream, so
semantics_version moved 1.1 to 1.2 and both derived contracts are out of conformance
until their pointers follow. drift_check confirms it, which is the mechanism working.

Nothing in either schema changes. The guarantee is devfactory-core's and the
guarantees block here is ours, already covering theirs at 8 against 3. The closing
record is an event type rather than a field, and event_type refs EventTypeName, so
JOB_SETTLED validates today without us having touched anything.

This closes the half of issue #23 that ADR-0015 sent back. We established there that
a number carried on an event cannot say what number the last event should have been,
and that completeness would be closed by a closing record per terminal - which was
theirs to declare. It is declared, and it needed no contract change at all.

approval/v1 moves only because semantics_version scopes the whole manifest rather
than one contract. Splitting it per contract would be a change to the mechanism, not
a fix for this round; noted in its changelog so the next reader does not have to
rediscover why an untouched contract got a version.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contract Canonical contract ที่ทุก repo ใช้ร่วม

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant