A native Interchange mailbox, and nothing else - #20
Merged
Merged
Conversation
The library now does exactly one thing: a native Interchange mailbox for human principals. README documents the surviving routes and write paths; package.json bumps to 1.0.0 for the breaking API cut.
The published tarball listed @intx/mailbox, @intx/mime, and @intx/types as workspace:* devDependencies only, so a plain npm/node consumer had no way to resolve them at runtime (CI's node consumer smoke test caught this: `Cannot find package '@intx/mailbox'`). @intx/mailbox has never been published, so there is nothing on npm to depend on instead. scripts/build.mjs now bundles the three vendored packages straight into dist/index.js via `bun build` (everything else stays external), and compiles their declarations separately into dist/vendor/<name>/, rewriting the bare specifiers in every emitted .d.ts to relative paths so a consumer's own tsc can resolve them too. @intx/mime and @intx/types drop out of peerDependencies; @intx/crypto (a real, byte-identical npm dependency the vendored code imports at runtime) moves from devDependencies to dependencies.
package.json's sideEffects: false is metadata for a CONSUMER's bundler.
On Linux, bun build read that same field for this package's own build
and collapsed src/index.ts's re-export-only module to a bare
'export { ... }' stub with every import deleted, leaving the export
list referencing nothing — every named export threw "X is not
declared in this file" at import time. --ignore-dce-annotations makes
bun bundle its own build honestly regardless of that field.
The bun bundler's own tree-shaking (even with --ignore-dce-annotations, per the previous commit) still produced a dist/index.js under bun on Linux where named exports were declared but not defined, failing the reference-host acceptance job. Bundling is gone: tsc now emits our own src/ and the three vendored @intX packages as plain module-for-module JS + d.ts, and every bare @intx/* import plus every vendored package's own extensionless relative import is rewritten to a relative dist/ path afterward. mountMailbox gains a POST /me/inbox/send route: builds an RFC 5322 message via the vendored frame builder, appends it to the caller's Sent folder through the native store, and hands it to a new required deliver mount dep — this package still owns no transport of its own.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Owner ruling:
@corbits/mailboxexists ONLY to give human principals anative Interchange mailbox (
createPrincipalMailboxStore/NativeMailboxStoreovermailbox.principal_mail+mailbox.mailbox_state,vendored
@intx/mailboxon top). Everything else — triage(priority/classification/status/assignee), delegation/assign, this
package's own threading/search,
/me/threads*, the pre-nativeread/write model — is deleted.
Four commits, in order:
file/describe exercising triage columns, readAt/archivedAt/trashedAt,
this library's own threading/search,
/me/threads*, and the mountroutes/features tied to them.
mount.tsis now a thin wrapper:GET /me/inbox(vendoredexecuteSearchoveropen(folder), keysetby uid, envelope+raw fetched per ref),
POST /me/inbox/:uid/read| unread(addFlags/removeFlags\Seen),archive|trash|restore(
moveNativeMailboxMessage),GET /me/inbox/events(SSE, unchanged).read.ts,thread.ts,mutations.ts,vocabulary.tsare deleted.write.ts(writeMailboxMessage,deliverInboxItems) andpersist.ts(the transport dual-write seam) now land every writethrough
NativeMailboxStore.append.0005_drop_pre_native_ columnsdropsmailbox.mailbox(the read_at/archived_at/trashed_at/priority/classification/status/assignee management table — nothing
reads it anymore) and sets
principal_mail.uid/modseqNOT NULL.schema.ts,schema-check.ts, and the DDL parity test follow.surviving routes/write paths;
package.jsonbumped to1.0.0forthe breaking cut.
Line counts
origin/main(pre-vendoring, full pre-native model): 15,632 lines insrc/54f657f, native store added, old model still present): 16,288 linessrc/after Slice B: 6,355 lines — a 60% cut from the branch baseVendored ledger
Unchanged by this slice —
VENDORED.mdstill listsvendor/intx-mailbox,vendor/intx-mime,vendor/intx-typesat the same pinned commit, killcondition still "first npm publish of
@intx/mailbox". Note for whoeverpicks this up next: publish
@intx/mailbox(and a matching@intx/mime/@intx/typesnpm refresh) to retire all three vendored rows.Remaining public API
mountMailbox(routes above),MAX_MAILBOX_PAGE_LIMIT,MAX_PENDING_SSE_EVENTSrunMailboxMigrations,MigrationChecksumErrorassertExpectedColumnTypes,expectedColumnTypes,SchemaTypeMismatchErrorcreateMailboxDbcreatePrincipalMailboxStore,openNativeMailboxStore,moveNativeMailboxMessageprincipalMail,mailboxPgSchema(schema/table exports)assertMailboxScope,assertMailboxTenantId,MAX_MAILBOX_FRAME_BYTES,assertMailboxFrameBytespurgeTenantMailbox,purgePrincipalMailboxcreateInMemoryMailboxEventBus,MailboxEventSchema,MAILBOX_EVENT_OPS(now 6 ops, noenrich/assign)writeMailboxMessage,deliverInboxItemsbuildMailFrame,generateMailboxMessageId,MESSAGE_ID_FALLBACK_DOMAINcreateMailboxPersist,MAX_MAILBOX_RECIPIENTSparseAddressList,resolveMailboxRecipientsDeleted from the public API:
writeMailboxMessages,mailboxKey,MAX_MAILBOX_REFS/refs support, all ofread.ts's exports (list/filter/sort/enrichment/sender-display), all of
thread.ts's exports,all of
mutations.ts's exports (enrich/assign/bulk), all ofvocabulary.ts's exports —mountMailboxno longer takes avocabularyorresolveSenderDisplaysoption.Test plan
bun run typecheckgreen (pre-existing, unrelated errors only inexamples/reference-host, not touched by this PR)bun test srcgreen — 156 pass, 2 pre-existing/unrelated fails inrecipients.test.ts(isRunAddressfromintx-types-compat.tsnot recognizing
ins_addresses — present before this PR's firstcommit, untouched by any of these changes)