Skip to content

Pay down the optional-error sink ledger: 15 sink types still declare an error that can go nowhere #10556

Description

@os-zhuang

Filed by the #9754 dev while landing PR #10555. Not a claim; unassigned.

#9754 ruled that a sink type declaring an optional error must declare a non-optionalwarn, so a durability report always has somewhere to land. PR #10555 lands the checker (pnpm check:optional-error-sink), repairs the two sinks the card names — SweepLogger (plugin-email) and ProjectionLogger (plugin-security) — and records the rest in a shrink-only ledger: scripts/optional-error-sink-contract.baseline.json.

This card is that ledger's paydown, as ONE task rather than fifteen. Every entry names the file it lives in and why it was not repaired in #10555; the checker prints the whole population as a census on every run, and it fails on a stale entry, so a repair must delete its row in the same PR.

The 15, grouped by what closing them costs

Thirteen are a one-line repair — drop the ? from warn and re-check the package's call sites:

  • packages/cloud-connection/src/cloud-connection-plugin.ts (logger@PluginContext)
  • packages/metadata-protocol/src/migrations/partial-index-probe.ts (IndexMigrationLogger)
  • packages/plugins/plugin-approvals/src/approval-service.ts (logger@ApprovalServiceOptions)
  • packages/plugins/plugin-approvals/src/lifecycle-hooks.ts (MinimalLogger)
  • packages/plugins/plugin-audit/src/auth-event-audit.ts (AuthEventAuditLogger)
  • packages/plugins/plugin-audit/src/read-audit.ts (ReadAuditLogger)
  • packages/plugins/plugin-auth/src/member-role-canonical.ts (LoggerLike)
  • packages/plugins/plugin-auth/src/reconcile-membership.ts (logger@ReconcileMembershipDeps)
  • packages/plugins/plugin-email/src/attachment-reclaim.ts (ReclaimLogger)
  • packages/plugins/plugin-reports/src/report-service.ts (logger@ReportServiceOptions)
  • packages/plugins/plugin-sharing/src/bulk-recompute.ts (MinimalLogger)
  • packages/plugins/plugin-webhooks/src/auto-enqueuer.ts (OptionalLogger)
  • packages/services/service-knowledge/src/knowledge-service.ts (KnowledgeLogger)

⚠️ The two plugin-audit entries were held back in #10555 only because packages/plugins/plugin-audit was open PR #10450's file surface — they are otherwise mechanical, and they are the sinks #9754's body calls the sharpest instances.

Two are a DESIGN call, not a ? deletion, and each is worth its own decision:

  1. packages/plugins/plugin-security/src/security-plugin.ts — the plugin's own logger field is declared { info?; warn?; error? } and initialised = {}. Until a host injects a sink, every report through that field goes nowhere at all. Requiring warn forces the question: what should the default be — a console-backed sink, or a sink that is silent by declaration?
  2. packages/services/service-settings/src/settings-service.types.tsSettingsDiagnosticsLogger is { error? } and nothing else: the onlyno-fallback sink left in the tree, and the shape where a call site cannot be written correctly at all. Its own doc explains the one-member surface is what keeps Logger, ctx.logger, console.error and a one-line spy all assignable — a required warn breaks the spy. Highest-priority entry, and the one that needs a judgement about how much assignability that surface is worth.

Two adjacent facts recorded here so they are not re-derived

  • examples/app-showcase/src/system/server/recalc-endpoint.ts holds a 16th red sink. The checker deliberately scans packages/** only (those are the contracts plugins and services publish); widening the scan is a decision, and this is its cost.
  • packages/plugins/plugin-security excludes **/*.test.ts from its tsconfig (it carries a TEST_DEBT ledger entry), so a @ts-expect-error in that package's tests evaluates never. Require a guaranteed warn channel on any sink type that declares an optional error (#9754) #10555 hit this and moved its compile-time pin to plugin-email. Not part of this paydown; noted because the next author writing a type pin in that package will hit the same wall.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions