Skip to content

fix(email): a log-only transport's send is recorded as logged, not sent - #39139

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-39114-logged-status
Dec 2, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-39114-logged-status

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #39114

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:管理员在邮件日志里,对「只写日志、不发信」通道发出的邮件,状态从「已发送」改为新的「仅记录(未投递)」;真正发出的邮件仍显示「已发送」;设置页邮件栏目对日志通道的提示也改为「仅记录、未投递」。
  • 为什么做:运维看邮件日志时会误以为邮件已送达,其实一封也没发出去;这是按你对「新增日志状态值」的裁决实现的。
  • 出错会怎样:最坏情况是把某封真实发出的邮件标成「仅记录」,或反过来;不影响发信本身,代码改动可以直接撤回,已写下的日志行保持原样。
  • 要你做什么:无。

What changes

Ruling-ref: the maintainer, in the seat's session: 「39114 A」 (claim comment 7344600357) — a log-only transport's send is recorded with a new EmailDeliveryStatus value, logged, not sent plus a flag.

  • Spec (widening). EmailDeliveryStatus gains 'logged'. TransportSendResult gains an optional outcome?: 'logged': the transport's own typed statement that it only recorded the message. Absent means a real hand-off, so every existing transport is unchanged. The free-form response string is never read for this.
  • Signal choice. The transport's result, not instanceof LogTransport and not the response: 'logged' text. It is per send, so a hot swap of the transport mid-send cannot mislabel the row. It is typed and closed. A third-party log-only or dry-run transport can say it too, which class identity cannot.
  • Runtime. LogTransport.send answers outcome: 'logged'. EmailService.deliverNormalized writes status: 'logged' with the message id and no sent_at, and answers status: 'logged'. This covers send, sendTemplate, sendInline, the outbox drain and the queue worker.
  • Objects. The status select on sys_email and sys_identity_email gains logged (not delivered) (yellow). It is translated for sys_email in all 11 shipped objects.generated bundles. The bundles carry no sys_identity_email entries at all (on main too), so that object shows the English label, like the rest of its fields. check:i18n reports in sync, with no stale-fill entry.
  • Readers in plugin-email.
    • TERMINAL_EMAIL_STATUSES includes logged. Without it, a logged row's out-of-row attachments stall and are never reclaimed.
    • TERMINAL_EMAIL_STATUSES is now exhaustive by construction: a satisfies check against a Record keyed by every EmailDeliveryStatus except queued. Deleting logged: true fails tsc with TS1360.
    • The queue worker's redelivery guard is unchanged. A logged row carries its message id, so the existing row.message_id clause skips it.
    • The boot outbox sweep counts logged apart from sent: OutboxSweepResult.logged and the summary line.
    • Settings › Mail "Send test email" decides its "only logged" warning from result.status === 'logged', not from instanceof LogTransport. Every reachable path answers the same as before: the press tests a built-in transport, or the live LogTransport.
  • Operator copy.
    • The Setup › Email banner for the log transport (MAIL_DELIVERY_COPY.noMailText, all 11 locales) says messages are recorded as logged (not delivered), not as sent.
    • So do the missing-API-key boot error (capability-arg.ts) and the OS_EMAIL_API_KEY row of content/docs/deployment/environment-variables.mdx.
  • isConfigured() stays on class identity. The outcome jsdoc and the changeset say so. A host-supplied transport answering outcome: 'logged' has its rows recorded logged, but isConfigured() still answers true. Its readers are the messaging email channel's mount gate, the invitation link_only answer and the sign-up refusals.
  • Client. The client.email.send JSDoc names logged among the statuses.
  • QA checklist. The live oracles that pinned status: 'sent' at the dev transport now say logged:
    • integration-system.email-template-render acceptance[7], revision 18 to 19.
    • identity-auth.self-service-password-reset fixtures.requires[0], revision 6 to 7.
    • Both carry a history entry. The older history entries are records and are left as written.
  • Docs: content/docs/kernel/runtime-services/email-service.mdx § Returns. The logged paragraph sits after the field list.

Reader census (the card's "consumers that count sent")

Reader Reads logged handling
plugin-email attachment reclaim terminal set changed: terminal, reclaimed
plugin-email queue worker (email.send.async) sent / message_id skip; failed throws for retry unchanged: a logged row has a message id, so it is skipped and never retried
plugin-email boot outbox sweep failed vs everything else changed: counted as logged, not sent
plugin-email outbox drain hook status !== 'queued' unchanged: not re-delivered
plugin-email Settings "Send test email" failed; now logged changed: reads result.status === 'logged' for its warning
rest POST /email/send same 200 either branch unchanged route: the body now says logged. Its own test (email-send-display-name.test.ts, real plugin with the log provider) pinned sent in 4 cases, now logged
plugin-email Setup › Email banner, missing-API-key error prose changed: say logged
cli serve-email-capability.test.ts the missing-API-key error text changed: regex follows the new wording; imports from @objectstack/plugin-email, the declaration's home, so check:test-source-alias holds
runtime sandbox ctx.email.send passes status through unchanged: script sees logged
plugin-auth verify / existing-account / invitation mail throws only on failed unchanged: a log-only deployment is not a send failure (invitation already answers link_only via isConfigured)
service-messaging email channel failed only unchanged: the channel refuses a log-only service before sending (transport_not_configured), so it never sees logged
Setup mail log list / record pages, ui console metadata-driven select new option renders with its label and color; no view, dashboard or ui code counts sent
cloud data-subject-request rule blocks only status=queued logged is treated like sent (redactable): sensible, no change

Tests

  • packages/plugins/plugin-email/src/email-service.test.ts, new top-level describe:
    • send() through LogTransport answers and stores logged, with the id and no sent_at.
    • The outbox-drain path finalizes logged.
    • A real transport whose response text is "logged" still records sent.
    • The LogTransport unit test pins outcome.
  • outbox-sweep.test.ts: a logged row is counted apart from sent, and the summary line says so.
  • attachment-reclaim.test.ts: a logged row is terminal and is reclaimed.
  • email-plugin.queue-delivery.test.ts: the live-LogTransport test press used to pin status: 'sent', which was the defect. It now pins logged.
  • packages/rest/src/email-send-display-name.test.ts: four cases boot the real plugin with the log provider. They now pin logged.
  • packages/cli/src/commands/serve-email-capability.test.ts: the missing-API-key refusal now says "as logged".
  • packages/spec/src/contracts/email-service.test.ts: logged is in the union, and outcome is optional and closed. Both use @ts-expect-error controls, and the file is compiled by tsconfig.test.json.
Red on the unfixed code, and ablations
  • Runtime decision reverted on disk (status forced to 'sent', which is the code before this PR):
    • src/email-service.test.ts: Tests 2 failed | 73 passed (75).
    • send() through the LogTransport ...: expected 'sent' to be 'logged'.
    • the outbox-drain path ...: expected 'sent' to be 'logged'.
    • Restored with git checkout HEAD.
  • 'logged' removed from TERMINAL_EMAIL_STATUSES and the sweep's logged branch:
    • Tests 2 failed | 35 passed (37).
    • Reclaim: expected 'stalled' to be 'reclaimed'.
    • Sweep: the result object does not match { sent: 0, logged: 1 }.
    • Restored.
  • | 'logged' removed from the spec union: check:test-typecheck: 1 problem(s) — src/contracts/email-service.test.ts: 2 type error(s). Restored.
  • logged: true removed from the terminal record: plugin-email tsc --noEmit fails with src/attachment-reclaim.ts(109,3): error TS1360: Type '{ sent: true; failed: true; }' does not satisfy the expected type (the Record keyed by failed, sent and logged). Restored.

Verification

Local runs (rework at head 093d6e7, merged with main at b512a7b; every heavy run through os-verify-lock)
  • plugin-email test && typecheck: Test Files 54 passed (54), Tests 1058 passed (1058), check:test-typecheck: OK. VERDICT command-exit 0.
  • rest test: Test Files 450 passed (450), Tests 9270 passed | 351 skipped (9621). VERDICT command-exit 0.
  • cli and verify, every test file that boots the plugin or pins its text:
    • cli serve-email-capability, serve-email-persist, serve-email-appname-precedence and serve-stack-email-sms-door.contract, with verify harness.served-composition: Tests 52 passed (52) and Tests 10 passed (10), VERDICT command-exit 0.
    • After the import move: serve-email-capability Tests 17 passed (17).
  • Typechecks: spec, client, rest and cli typecheck each VERDICT command-exit 0 with check:test-typecheck: OK.
  • platform-objects test && typecheck (first round, unchanged since): Tests 2233 passed (2233).
  • dispatch-gates --commands derived 128 commands at 093d6e7, run with exit codes captured before any pipe.
    • 125 exited 0, including check:i18n, check:i18n-stale-fill, check:test-source-alias, check:slot-lookup, spec check:skill-examples (after building client-react), check:api-surface, check:docs, check:liveness, check:nul-bytes and check:doc-authoring.
    • check:platform-checklist exit 1: areas/dashboards.json: ABSENT SYMBOL setup-nav.contributions.ts#nav_system_overview. This comes from main at the merge base. Current origin/main (3dfffef) no longer carries that citation, and this PR touches neither file.
    • NOT MEASURED, both exit 3 on a prerequisite (unbuilt workspace dist, and an example-app config that could not be linted). CI runs both:
      • check:dual-build-cjs-loads
      • check:i18n-coverage
    • dispatch-gates --ran: 128 derived famil(ies) accounted for — 126 run, 2 NOT-MEASURED.
  • ESLint (--no-inline-config) on the rework's TS files: exit 0. Control-byte scan: no hits.

Read first (by risk):

  1. packages/plugins/plugin-email/src/email-service.ts, the deliverNormalized hunk: the one place a row's success status is chosen.
  2. packages/spec/src/contracts/email-service.ts: the contract widening.
  3. packages/plugins/plugin-email/src/attachment-reclaim.ts: the terminal set. A missed status here leaks storage.

Two-minute check:

  • Run pnpm --filter @objectstack/plugin-email exec vitest run src/email-service.test.ts.
  • Expected: the describe "a log-only transport's send is recorded logged, never sent" passes 3 of 3.

Acceptance notes

  • Rows a log-only transport wrote as sent before this release keep reading sent. No backfill: nothing on a row distinguishes them.
  • IEmailService.isConfigured() still judges by instanceof LogTransport. It is left as is, and the outcome jsdoc and the changeset say so. It answers "will mail be delivered" for the service as a whole, not for one send.
  • sys_identity_email has no translation entries in any bundle, before or after this PR. Its new option shows in English, as all its fields do.
  • cloud pin bump: cloud tests assert status: 'sent' on rows that a send with no provider configured wrote. cloud prose also says "recorded in sys_email as sent". Both go stale when cloud takes this commit; see review F7.

Generated by Claude Code

@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/client, @objectstack/platform-objects, @objectstack/plugin-email, @objectstack/spec, touching 15 documentable anchor(s).

7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/deployment/cli.mdx (via sys_email (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects))
  • content/docs/deployment/environment-variables.mdx (via sys_email (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects))
  • content/docs/frontend/plugins/plugin-detail.mdx (via sys_email (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects))
  • content/docs/kernel/runtime-services/email-service.mdx (via SendEmailResult (symbol, a top-level interface), sys_email (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects))
  • content/docs/kernel/runtime-services/sms-service.mdx (via sys_email (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects))
  • content/docs/plugins/packages.mdx (via sys_email (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects))
  • content/docs/protocol/kernel/plugin-spec.mdx (via EmailService (symbol, a top-level class))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-1.mdx (via sys_email (symbol, a field of const object arObjects; a field of const object deObjects; a field of const object enObjects; a field of const object esESObjects; a field of const object frObjects; a field of const object jaJPObjects; a field of const object koObjects; a field of const object ptBRObjects; a field of const object ruObjects; a field of const object zhCNObjects; a field of const object zhHantObjects))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 7 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 255 client-bound route-ledger rows — the other 184 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 184: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 190 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 0c45d66f793ecffcf7d7273abfdd5569aba143a7 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from b5d2a8bbe8058b5b7a66d85753b5797de07af197 — the merge of head 093d6e79c11419bba753b99aac8acafed2e37411 into base 0c45d66f793ecffcf7d7273abfdd5569aba143a7, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin b5d2a8bbe8058b5b7a66d85753b5797de07af197 && git checkout b5d2a8bbe8058b5b7a66d85753b5797de07af197
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 0c45d66f793ecffcf7d7273abfdd5569aba143a7 093d6e79c11419bba753b99aac8acafed2e37411 && git checkout -B drift-repro 0c45d66f793ecffcf7d7273abfdd5569aba143a7 && git merge --no-ff 093d6e79c11419bba753b99aac8acafed2e37411

node scripts/docs-audit/affected-docs.mjs --json 0c45d66f793ecffcf7d7273abfdd5569aba143a7

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 0c45d66f793ecffcf7d7273abfdd5569aba143a7 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#3 · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 122ed673b837608b9492dfda6706dae3c371a7fb
Local-runs: none
Scope: packages/spec/src/contracts/email-service.ts + packages/plugins/plugin-email/src/email-service.ts, packages/plugins/plugin-email/src/email-plugin.ts, packages/plugins/plugin-email/src/attachment-reclaim.ts, packages/plugins/plugin-email/src/outbox-sweep.ts, packages/platform-objects/src/audit/sys-email.object.ts, packages/platform-objects/src/audit/sys-identity-email.object.ts, the 11 packages/platform-objects/src/apps/translations/.objects.generated.ts bundles, packages/spec/src/contracts/email-service.test.ts, .changeset/39114-email-logged-status.md; cited read-only: packages/rest/src/email-send-display-name.test.ts, packages/rest/src/email-routes.ts, packages/rest/vitest.config.ts, packages/plugins/plugin-email/src/live-transport-status.ts, packages/plugins/plugin-email/src/capability-arg.ts, packages/runtime/src/sandbox/body-doors.ts, packages/plugins/plugin-auth/src/auth-manager.ts, packages/services/service-messaging/src/email-channel.ts, packages/client/src/index.ts, docs/qa/platform-checklist/areas/integration-system.json, docs/qa/platform-checklist/areas/identity-auth.json, content/docs/deployment/environment-variables.mdx, cloud origin/main (packages/objectos-runtime/src/data-subject-rules.mjs, packages/objectos-runtime/src/platform-mail-transport.ts, apps/cloud/test/data-subject-request-flow.test.ts, apps/cloud/test/environment-member-request-flow.test.ts)
Security-touching: no
Rule-change-verified: none

① Derived judgments

  • Declaration. Clause-②: yes (widening) and Metadata-protocol: none stand line-initial in the PR body and in the changeset body, and they are the right pair. EmailDeliveryStatus gains a member and TransportSendResult gains an optional member; nothing an author can write in metadata changes (the status select option is a platform object's own data, not protocol). No ADR-0087 disposition is owed: nothing is removed or renamed.
  • Generated artifacts. None owed beyond what is committed. packages/spec/api-surface/contracts.json and export-origins/contracts.json record export names only, and no export is added. The contracts file is TypeScript only, so there is no json-schema, authorable-surface or content/docs/references projection. Spec property liveness is green on this head. The 11 *.objects.generated.ts bundles carry the one new key each.
  • Stored rows. A select is stored as text (no enum or CHECK constraint in driver-sql), so logged is writable on an existing database with no migration. Rows a log-only transport wrote as sent stay sent; nothing on the row tells them apart, so no backfill is correct.
  • No reader treats an unknown status as failure or retries it. Every non-test reader of the send result in the repo branches on === 'failed' only: plugin-auth (auth-manager.ts:3254, auth-manager-auth-instance.ts:622/728, admin-import-users.ts), service-messaging email-channel.ts:534, the queue worker (email-plugin.ts:1269), Settings test mail (email-plugin.ts:1043). The row readers key on status !== 'queued' || message_id (outbox drain hook, outbox-sender-bound.ts:81, outbox-sweep.ts:222), and a logged row keeps its message id. The ctx.email.send hourly limit (body-doors.ts:334) counts by created_at, so logged rows still count. attachment-reclaim.ts:176 falls back from sent_at to updated_at/created_at, so the unset sent_at is safe.
  • No exhaustive consumer breaks. EmailDeliveryStatus is imported only inside plugin-email; no Record<EmailDeliveryStatus, …>, never switch or zod mirror of the union exists in packages/, ui/, skills/ or cloud origin/main. ui/ has no code that reads the mail status; it renders the select from metadata.
  • cloud production code. The only status reader is the data-subject rule that holds rows at status = 'queued' (data-subject-rules.mjs); logged is redactable like sent, which is right. platform-mail-transport.ts answers no outcome, so its sends stay sent.

② Semver level

patch on @objectstack/spec, @objectstack/plugin-email and @objectstack/platform-objects is correct: Metadata-protocol: none takes patch, and a non-protocol widening ships patch (AGENTS.md Post-Task Checklist step 3). OutboxSweepResult.logged is a new required member of a result type the plugin itself produces; readers are unaffected.

③ Boundary flags

  • Dev flag "isConfigured() still judges by instanceof LogTransport": answered in finding F3. Acceptable as a service-level fact for this PR, but the one reader that already holds the send result should read it.
  • Dev flag "no backfill of old sent rows": accepted, see ①.
  • SQL push-down: no new id materialisation or in-app join. The sweep and the reclaim read rows exactly as before.
  • PR author is objectstack-fleet[bot]; no out-of-relay author to name.
  • CI on this head was still running when this was read (all 12 Test Core shards and three Type Check lanes in progress). F1 is read from source, not from a finished shard.

④ Design judgment

packages/spec/src/contracts/email-service.ts holds against the ruling 「39114 A」: a new status value, not a delivered flag. outcome?: 'logged' is the right signal for the per-send decision: it is typed and closed, it is read per send so a transport hot swap cannot mislabel a row, and it does not read the free-form response. deliverNormalized is the single place a success status is chosen, and it covers send, sendInline, sendTemplate, the drain hook, the queue worker and the sweep. The object, reclaim, sweep and worker hunks agree with the contract.

Findings:

  • F1 · must-fix · the PR reds its own test suite. packages/rest/src/email-send-display-name.test.ts boots the real EmailServicePlugin with provider: 'log' whenever no transport double is passed (line 84), and packages/rest/vitest.config.ts:210 aliases @objectstack/plugin-email to its source. Four cases call boot() with no transport and assert expect(out.body.status).toBe('sent'): lines 178, 186, 237 and 245. At this head the door answers logged. The diff does not touch packages/rest, and the dev's local runs covered plugin-email, platform-objects and spec only. The census row "rest POST /email/send: unchanged" missed the door's own test. Fix: pin logged in those four cases (or give them a transport double if "sent" is the point).
  • F2 · should-fix · operator-facing copy now states the old behaviour. packages/plugins/plugin-email/src/live-transport-status.ts MAIL_DELIVERY_COPY.noMailText, in all 11 locales, tells the operator on Setup › Email that every message "is recorded in sys_email as sent, but none is delivered" (en line 106, zh-CN line 123 "标记为已发送", and the rest). After this PR the row reads logged. This is the banner beside the very log the card is about, so the operator who filters the log for sent finds nothing. Same stale sentence in a thrown error (capability-arg.ts:299) and in content/docs/deployment/environment-variables.mdx:200.
  • F3 · should-fix · the published signal and the Settings test-mail reader disagree. The spec text and the changeset invite any log-only or dry-run transport to answer outcome: 'logged'. "Send test email" (email-plugin.ts:1055 and :1065) still decides by transport instanceof LogTransport although it holds result in hand. A host-supplied transport that answers logged gets ok: true "Sent test email to …" while its row reads logged. Read result.status === 'logged' there. isConfigured() staying on class identity is acceptable here, but then the outcome jsdoc and the changeset should say that a third-party log-only transport is still judged as delivering by isConfigured() (messaging channel, invitation link_only, the sign-up refusals), or a follow-up card should carry it.
  • F4 · nit · the PR body and changeset overstate the translation. The shipped bundles hold no sys_identity_email entry at all (on main too), so the new option is translated for sys_email only; the identity log shows the English label in every locale, as the rest of that object already does. Not caused by this PR; correct the sentence, and the gap wants its own card if none exists.
  • F5 · nit · QA checklist oracles pin sent at the dev transport. docs/qa/platform-checklist/areas/integration-system.json (lines 1053, 1145, 1169) and identity-auth.json (line 1172) state status: 'sent' for a send through the log provider. A checklist run after this lands will fail those items. Follow-up card.
  • F6 · nit · prose and small gaps. The logged paragraph in email-service.mdx is inserted between the messageId and error bullets and splits the list. packages/client/src/index.ts:3051 still lists sent / queued / failed. satisfies readonly Exclude<EmailDeliveryStatus, 'queued'>[] checks membership, not exhaustiveness, so a future status is not flagged. The worker's row.status === 'logged' clause is redundant with row.message_id and has no test that can red it.
  • F7 · note for the cloud pin bump (not a finding on this PR). cloud tests assert status: 'sent' on rows a real send wrote with no provider configured: apps/cloud/test/data-subject-request-flow.test.ts:651 and :679, apps/cloud/test/environment-member-request-flow.test.ts:201. If those boots run the log transport they red when the pin takes this commit; line 661 also writes the row back as the literal 'sent'. cloud prose that says "recorded in sys_email as sent" (apps/objectos-ee/deploy/.env.example:530, composed.env.example:327, composed-artifact-boot.md:202, comments in capability-loader.ts) goes stale at the same bump.

Tests: the three ablations in the PR body match the code read (the status choice, the terminal set plus the sweep branch, the union member). The @ts-expect-error controls in the spec test are compiled by tsconfig.test.json. The census is otherwise complete for production readers.

Implemented-by: claude/issue-39114-logged-status
Reviewed-by: session_01TsNV8Bsjqmw7aXCo2QuLU1

VERDICT: FAIL

FAIL at this head: the widening itself is declared and built correctly, but four assertions in packages/rest/src/email-send-display-name.test.ts still pin sent for the log provider and will fail (F1), and two should-fix items (F2, F3) are open.

The rest send-door tests pin logged under the log provider. The Setup
banner, the missing-API-key error and the env reference say logged.
Send test email reads the send's own status. The terminal set is
exhaustive by construction. The QA checklist oracles are updated, and
the docs list is fixed.

Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#3 · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 093d6e79c11419bba753b99aac8acafed2e37411
Local-runs: none
Scope: packages/spec/src/contracts/email-service.ts + packages/plugins/plugin-email/src/email-service.ts, packages/plugins/plugin-email/src/email-plugin.ts, packages/plugins/plugin-email/src/attachment-reclaim.ts, packages/plugins/plugin-email/src/outbox-sweep.ts, packages/plugins/plugin-email/src/capability-arg.ts, packages/plugins/plugin-email/src/live-transport-status.ts, packages/plugins/plugin-email/src/live-transport-status.pin.test.ts, packages/platform-objects/src/audit/sys-email.object.ts, packages/platform-objects/src/audit/sys-identity-email.object.ts, the 11 packages/platform-objects/src/apps/translations/*.objects.generated.ts bundles, packages/spec/src/contracts/email-service.test.ts, packages/rest/src/email-send-display-name.test.ts, packages/cli/src/commands/serve-email-capability.test.ts, packages/client/src/index.ts, content/docs/kernel/runtime-services/email-service.mdx, content/docs/deployment/environment-variables.mdx, docs/qa/platform-checklist/areas/integration-system.json, docs/qa/platform-checklist/areas/identity-auth.json, .changeset/39114-email-logged-status.md; cited read-only: packages/cli/vitest.config.ts, scripts/check-test-source-alias.mjs, .github/workflows/lint.yml, .github/workflows/fleet-patrols.yml, docs/qa/platform-checklist/areas/dashboards.json, packages/platform-objects/src/apps/setup.app.ts
Security-touching: no
Rule-change-verified: none

① Derived judgments

Delta re-review of the record at 122ed673b (comment 7347179455, FAIL). The range holds one merge of origin/main (b512a7b7b, merge base 27ce3c0a0) and two rework commits (a5e4d88e6, 093d6e79c); the rework touches 14 files. The judgments of the first record on the declaration, the generated artifacts, stored rows and the reader census stand unchanged; only what the rework moved is re-judged here.

  • Declaration. Clause-②: yes (widening) and Metadata-protocol: none still stand line-initial in the PR body and the changeset. The rework adds no export, no schema and no authorable key, so no further generated artifact is owed.
  • F1 · closed. packages/rest/src/email-send-display-name.test.ts:179, :188, :240 and :249 now pin logged for the real plugin on the log provider. No other test under packages/rest, packages/cli, packages/runtime or packages/verify pins sent on a real log-provider send; the remaining status: 'sent' hits are hand-written service doubles in plugin-auth tests, which this change does not reach.
  • F2 · closed. MAIL_DELIVERY_COPY.noMailText says "logged (not delivered)" in all 11 locales (live-transport-status.ts, en line 106 on). Each locale's wording equals that locale's sys_email status option label in its *.objects.generated.ts:3318, so the banner names the value the operator sees in the log. The thrown error (capability-arg.ts:299), its cli pin (serve-email-capability.test.ts:126) and environment-variables.mdx:200 say logged.
  • F3 · closed. "Send test email" reads result.status === 'logged' (email-plugin.ts:1057). The first record's premise is corrected here: the press never tests a host-supplied transport. target is a one-shot built-in transport for smtp, resend and postmark, a one-shot LogTransport for the form's log when the live transport is not one (email-plugin.ts:977), and the live service only when it is a LogTransport. So the swap answers the same on every reachable path, and the dev's statement that no red-capable test exists for it is right. The isConfigured() limit is now stated in the outcome jsdoc (packages/spec/src/contracts/email-service.ts:151-158), the changeset and email-service.mdx:64.
  • F4 · closed. The changeset and the PR body say the option is translated for sys_email only.
  • F5 · closed. integration-system.email-template-render acceptance[7] (integration-system.json:1053, revision 19, history entry at :1190) and identity-auth.self-service-password-reset fixtures.requires[0] (identity-auth.json:1172, revision 7, history entry at :1260) say logged. Lines 1145 and 1169 of integration-system.json, named in the first record, are history entries; leaving them as written is correct. No other live clause in docs/qa/platform-checklist/areas pins sent at the dev transport.
  • F6 · closed. The list in email-service.mdx is whole (:59-62) with the paragraph after it. The client JSDoc names logged (packages/client/src/index.ts:3051). TERMINAL_EMAIL_STATUSES is built from a literal that satisfies Record<Exclude<EmailDeliveryStatus, 'queued'>, true> (attachment-reclaim.ts:104-110), so a new status fails to compile there. The worker's redundant clause is gone (email-plugin.ts:1267).
  • F7 · carried. Not a finding on this PR. It is in the dev addendum's out_of_scope_findings for the cloud pin bump.

② Semver level

Unchanged: patch on @objectstack/spec, @objectstack/plugin-email and @objectstack/platform-objects. The rework adds prose, copy, tests and a type-level check; none of it moves the level.

③ Boundary flags

  • The addendum carries no open_questions. Its three out_of_scope_findings are notes (F4 translation gap, F7 cloud, no backfill) and are accepted as notes.
  • check:platform-checklist red is not caused by this PR: verified. At the merge base 27ce3c0a0 and at this head, docs/qa/platform-checklist/areas/dashboards.json:1031 cites packages/platform-objects/src/apps/setup-nav.contributions.ts#nav_system_overview, and that file carries no such symbol at either ref. On origin/main (0c45d66f7) the same line cites packages/platform-objects/src/apps/setup.app.ts#nav_system_overview, which exists (setup.app.ts:66). Neither dashboards.json nor a setup-nav file is in this PR's diff. The gate is off per-PR CI by a standing decision (lint.yml:2475, run from fleet-patrols.yml), so no check-run on this head carries it. The two checklist files this PR does edit are well-formed edits: revision raised by one, one history entry each, ref the PR.
  • cli test import move. serve-email-capability.test.ts:25 imports resolveEmailCapabilityArg from @objectstack/plugin-email. The binding is exported there (plugin-email/src/index.ts:24), serve.ts re-exports the same one, and @objectstack/plugin-email is a declared dependency of the cli (packages/cli/package.json:137). check:test-source-alias runs in Lint · CI, release & engine gates (lint.yml:3714), which concluded success on this head. No script or vitest config was changed to make it pass.
  • Worker guard. With the logged clause dropped, a logged row is skipped by row.message_id alone. TransportSendResult.messageId is a required string and deliverNormalized stores it (email-service.ts:1487-1501), so this holds for every conforming transport. A host transport that answers outcome: 'logged' with an empty id would be logged twice on a duplicate queue delivery; nothing is mailed twice. Accepted; see N1.
  • SQL push-down: the rework adds no query.
  • CI on this head, 75 check-runs: 25 success, 14 skipped, 36 in_progress, 0 failed. Concluded green: every Lint · lane, Type Check · source gates, Spec property liveness, Build Docs, Check Documentation Links, Dogfood Regression Gate, Governed Surface Queue Guard, one Check Changeset run and one PR-body guards run. Still running, so not a pass: Build Core, Test Core 1 to 12, Test UI 1 to 16, Type Check · workspace, Type Check · consumer gates, Type Check · debt ledger, Type Check UI, Build & E2E UI, Live E2E UI and a second Check Changeset run. F1's closure and the TS1360 exhaustiveness claim are read from source; the Test Core and Type Check · workspace runs that would confirm them have not concluded. Convergence is the seat's before merge.

④ Design judgment

packages/spec/src/contracts/email-service.ts still holds against the ruling 「39114 A」. The one rework hunk in the spec is the jsdoc paragraph on outcome that separates the per-send answer from isConfigured(). It is accurate against the code: plugin-email answers isConfigured() by class, and the three readers it names are the ones that read the flag. It publishes a known limit instead of leaving two signals that look equivalent, which is the right call for a patch; closing the limit would be a behaviour change for hosts and belongs to its own card.

The exhaustive TERMINAL_EMAIL_STATUSES is sound. Object.keys of the literal yields sent, logged, failed; satisfies rejects both a missing key and an excess key, so the set cannot drift from the union in either direction. The exported type stays readonly string[], so no consumer changes.

No finding blocks. Nits, none of them owed before merge:

  • N1 · nit. The queue worker now treats logged as final only through row.message_id, while the reclaim reads the status set. Reading TERMINAL_EMAIL_STATUSES minus failed in the worker would make the two agree by construction. No reachable defect with the built-in transports.
  • N2 · nit. serve-email-appname-precedence.test.ts:29 and serve-email-persist.test.ts:29 still import resolveEmailCapabilityArg through ./serve.js. They are outside this diff and the gate is green; the same move applies if they are next touched.
  • N3 · nit. The header comment of serve-email-capability.test.ts:10 and of live-transport-status.pin.test.ts describe the pre-fix history ("recorded in sys_email as sent"). The first is history and correct as written; the second was updated. No change needed.

Implemented-by: claude/issue-39114-logged-status
Reviewed-by: session_01TsNV8Bsjqmw7aXCo2QuLU1

VERDICT: PASS

PASS at this head on the contract: F1 to F6 are closed, F7 is carried as a cloud pin-bump note, and the rework adds no finding. This is not a statement that CI is green: 36 check-runs, all of Test Core and Type Check · workspace among them, were still running when this was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud#3 · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1

席位核对 · ACCEPT · 2026-12-02T14:53Z

Head: 093d6e79c11419bba753b99aac8acafed2e37411

  • Form: the logged delivery status, per ruling 「39114 A」.

    • spec EmailDeliveryStatus and TransportSendResult.outcome.
    • plugin-email: deliverNormalized, attachment reclaim (now exhaustive), the outbox sweep, the test press reading result.status, and the Setup banner copy in 11 locales.
    • The sys_email option, translated in 11 locales.
    • The rest and cli test pins, docs, and two checklist oracle revisions.

    Not governed. Fixes #39114. Declarations: Clause-②: yes (widening), Metadata-protocol: none. The PR body was brought to this head by the seat.

  • Contract review:

    • FAIL at 122ed673b (7347179455: F1 must-fix, rest pins sent).
    • Delta PASS at this head: every prior finding closed, nits N1–N3 only.
    • The inherited check:platform-checklist ABSENT SYMBOL is verified as main's, at the merge base, and already fixed on main. It is not this PR's.
  • Gates (dev): dispatch-gates --ran: 128 derived, 126 run, 2 NOT-MEASURED (prerequisite refusals, run by CI). The rest suite is 9,270 passed, plugin-email 1,058, and the cli and verify pins are green.

  • CI at this record: 25 success, 14 skipped, 36 in progress, 0 failed. The merge queue holds the PR until the required checks conclude.

  • Cloud note: at the next cloud pin move that carries this, the cloud tests asserting sent on log-provider rows need updating. This is recorded on cloud#5359 (7347213423).

  • Landing: an ordinary queue landing (ready, then auto-merge).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 2, 2026 14:54
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge December 2, 2026 14:54
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 2, 2026
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 46912209833 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (3/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/invitation-blank-role-refusal.dogfood.test.ts > [#29158] single: invite-member refuses a blank role 400 ROLE_NOT_FOUND > an empty entry in a role list
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: {"organizationId":"org_mx6aa4hmbp2h1d2o","email":"blank-single-2@dogfood.test","role":"member","teamId":null,"status":"pending","expiresAt":"2026-12-04T15:31
    @objectstack/dogfood:test:  FAIL   isolated  test/invitation-blank-role-refusal.dogfood.test.ts > [#29158] group: invite-member refuses a blank role 400 ROLE_NOT_FOUND > an empty entry in a role list 
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: {"organizationId":"ihA3jHBX7nwLjSbd86eguoLPIRVD6hrL","email":"blank-group-2@dogfood.test","role":"member","teamId":null,"status":"pending","expiresAt":"2026-
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • test/invitation-blank-role-refusal.dogfood.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 6 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit 1536c07 Dec 2, 2026
79 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-39114-logged-status branch December 2, 2026 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plugin-email: a log-only transport's send is recorded as sys_email status 'sent' though nothing is delivered

2 participants