已关闭
[SESSION-03] Implement frontend-neutral canonical user-event ingestion #22
urandon创建于  8月3日关闭于  8月10日
urandon
urandon成员
8月3日 创建

Parent and architecture

Outcome

Implement frontend-neutral canonical user-event ingestion, session binding/switching and run creation before adapting any transport frontend.

Estimate

  • 5 SP / 3 engineering days
  • Risk: high

Scope

  • Resolve an already authenticated external actor and authorized frontend binding without importing transport-specific types into the domain operation.
  • Create an initial canonical session/binding only through the explicit membership/enrollment policy.
  • Implement canonical session creation plus atomic binding switch for the generic clean-context operation.
  • Retain previous sessions/events without implicit archive or deletion.
  • For a normal frontend input, atomically commit:
    • frontend idempotency/deduplication fact;
    • one canonical user session_event;
    • one run referencing session_id and trigger_event_id;
    • initial attempt and dispatch outbox.
  • Store message bodies and attachment manifests under tenant/session/event Object Storage prefixes.
  • Define transport-neutral idempotency keys and metadata envelopes.
  • Provide a synthetic frontend adapter used by deterministic tests.
  • Remove context-epoch reset semantics from application/domain APIs.

Non-goals

  • Telegram update parsing, chat/user binding or commands; tracked in #36.
  • Assistant/tool event finalization.
  • Worker context reconstruction.
  • Session listing/history HTTP API.
  • Implicit tenant creation from an external identity.

Verification

  • Two generic clean-context requests create two sessions and atomically switch one binding.
  • Previous sessions remain readable by authorized ID after switching.
  • Duplicate frontend delivery creates one user event, run, attempt and dispatch record.
  • Failed object or YDB work leaves no partial canonical event/run.
  • Two tenants/frontends cannot cross-bind or access each other's sessions/artifacts.
  • Stale concurrent binding switches fail safely.

Acceptance criteria

  • Every dispatched workload has a canonical session_id and triggering event.
  • The core ingestion contract contains no Telegram-specific type or update/message ID.
  • No ingress path creates or advances context_epoch.
  • Binding switches and event sequence allocation are serializable.
  • Synthetic tests prove that a non-Telegram frontend can use the contract.
  • Public English documentation reflects the frontend-neutral boundary.
likedislike
urandonurandon成员
8月4日 修改标题为 “[SESSION-03] Implement frontend-neutral canonical user-event ingestion”,原标题为“[SESSION-03] Migrate Telegram bindings and canonical user-event ingestion”
urandonurandon成员
8月4日 修改了issue 的描述
urandonurandon成员
8月10日 关联了pull request:[SESSION-03] Implement frontend-neutral canonical user-event ingestion
urandon
urandon成员
8月10日 评论:

Implementation update

Implementation is published in MR !23, branch ai/session-03-canonical-ingestion, commit f37d32e.

The change adds the membership-gated frontend-neutral ingress application service, atomic YDB event/run/attempt/manifest/outbox commit, binding-level deduplication that survives a clean-context switch, HMAC-derived opaque IDs, canonical Object Storage prefixes, and a deterministic non-Telegram adapter.

Verified locally with make ci, two clean YDB Local migration applications, the full tagged YDB integration suite, and a focused uncached concurrent-ingress test. One of two simultaneous deliveries creates the records; the other resolves the winner. A later retry after the binding switches still returns the original session/event/run. Object failure, transactional rejection, stale revision, and cross-tenant cases leave no partial canonical workload state.

The issue remains open until the GitCode branch reaches the GitHub mirror and mandatory CI is green.

likedislike
urandon
urandon成员
8月10日 评论:

CI verification — green

GitHub mirror run #68 completed successfully for commit f37d32e4d6ec8832c0700c2a16a0115d5e6ed6fd.

All required jobs passed:

  • Go verification;
  • YDB schema and state store, including repeatable migrations and the full integration suite;
  • Terraform environments;
  • local multi-service stand, including stop/restart persistence;
  • control-plane and worker runtime image builds.

MR !23 is ready for review and merge. The issue remains open until the implementation is merged.

likedislike
urandon
urandon成员
8月10日 评论:

Completion report

SESSION-03 was merged through PR !23 as merge commit 13e886f.

Delivered:

  • frontend-neutral authenticated session creation, switching, and canonical user-event ingestion;
  • atomic event/run/attempt/manifest/dispatch-outbox persistence with tenant and session authorization;
  • delayed-delivery idempotency across binding switches;
  • immutable per-attempt Object Storage namespaces that prevent concurrent retries from overwriting canonical bytes;
  • origin-only dispatch gating until SESSION-04 adds frontend-neutral completion/projection;
  • synthetic non-Telegram coverage and public English documentation.

Verification included make ci, clean YDB Local integration coverage, duplicate/concurrency/authorization regression tests, and all requested PR review fixes. Follow-up runtime cost work continues in RUNTIME-01 #39.

likedislike
urandonurandon成员
8月10日 关闭了 issue
urandonurandon成员
15 天前 添加了label:mvpsession
urandonurandon成员
15 天前 关联了里程碑:MVP — Core platform (#6)