@ai-matrx/messaging 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Changelog — `@ai-matrx/messaging`
2
2
 
3
+ ## 0.7.0 — 2026-09-07
4
+
5
+ 🚨 **Every RPC in this package was calling the wrong schema, so every read failed against the
6
+ live database.** Found the first time the package ran a real query — the honest verification the
7
+ work order named, which is also why no source gate could have caught it.
8
+
9
+ ### Fixed
10
+
11
+ - **RPCs are called on `public`; only the TABLES are in `communication`.** Matrx Main's messaging
12
+ tables moved into `communication` during the schema reorg, and the five auth-checked SECURITY
13
+ DEFINER functions stayed in `public` where PostgREST exposes them by default and where every
14
+ existing caller and GRANT already pointed. This package sent both to `communication`, so the
15
+ inbox read, the direct-conversation get-or-create, the unread count, the profile read and the
16
+ participant check all failed with PGRST202 — *"Could not find the function
17
+ communication.get_dm_conversations_with_details … in the schema cache"*. The whole product was
18
+ dead against the real database while 129 tests and a packed-tarball canary stayed green,
19
+ because a fake PostgREST answers whatever schema it is asked for.
20
+ - New constant `MESSAGING_RPC_SCHEMA` (`"public"`), exported and asserted by the tarball canary
21
+ beside `MESSAGING_SCHEMA`, with the verification query in a comment above it. A regression test
22
+ proves the RPC lands on `public` and the table write on `communication`; it fails when the two
23
+ are collapsed.
24
+
25
+ **The lesson, recorded where the next agent will read it:** "verified against the live schema by
26
+ inspection" is not verification. One query would have found this on day one.
27
+
28
+ ### Consumer action (C28)
29
+
30
+ None. Nothing in the API changed — the package simply works against the real database now.
31
+
3
32
  ## 0.6.0 — 2026-09-07
4
33
 
5
34
  **The two entries did not agree on their own branded ids.** A consumer that minted a
package/README.md CHANGED
@@ -314,7 +314,8 @@ One canonical schema, in Matrx Main, under the platform's DB conventions:
314
314
 
315
315
  | | |
316
316
  |---|---|
317
- | Schema | `communication` (never `public`) |
317
+ | Table schema | `communication` (never `public`) |
318
+ | RPC schema | `public` — the SECURITY DEFINER functions stayed there through the schema reorg. The two DIFFER, deliberately; collapsing them fails every read with PGRST202 |
318
319
  | Tables | `dm_conversations`, `dm_conversation_participants`, `dm_messages` |
319
320
  | RPCs | `dm_get_or_create_direct_conversation`, `get_dm_conversations_with_details`, `get_dm_user_info`, `get_dm_unread_count`, `is_dm_participant` |
320
321
 
package/dist/index.cjs CHANGED
@@ -21,6 +21,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
23
  MESSAGING_EVENTS: () => MESSAGING_EVENTS,
24
+ MESSAGING_RPC_SCHEMA: () => MESSAGING_RPC_SCHEMA,
24
25
  MESSAGING_SCHEMA: () => MESSAGING_SCHEMA,
25
26
  MessagingError: () => MessagingError,
26
27
  RPCS: () => RPCS,
@@ -1540,6 +1541,7 @@ function formatLastSeen(lastSeenMs, now = Date.now()) {
1540
1541
 
1541
1542
  // src/core/repository.ts
1542
1543
  var MESSAGING_SCHEMA = "communication";
1544
+ var MESSAGING_RPC_SCHEMA = "public";
1543
1545
  var TABLES = {
1544
1546
  conversations: "dm_conversations",
1545
1547
  participants: "dm_conversation_participants",
@@ -1574,6 +1576,7 @@ function createMessagingRepository(options) {
1574
1576
  ...options.now !== void 0 ? { now: options.now } : {}
1575
1577
  });
1576
1578
  const db = () => client.schema(MESSAGING_SCHEMA);
1579
+ const rpcDb = () => client.schema(MESSAGING_RPC_SCHEMA);
1577
1580
  async function withSessionRetry(operation, run) {
1578
1581
  try {
1579
1582
  return await run();
@@ -1591,7 +1594,7 @@ function createMessagingRepository(options) {
1591
1594
  }
1592
1595
  }
1593
1596
  async function rpc(fn, args, operation) {
1594
- const { data, error } = await db().rpc(fn, args);
1597
+ const { data, error } = await rpcDb().rpc(fn, args);
1595
1598
  if (error !== null) throw normalizeMessagingError(error, operation);
1596
1599
  return data;
1597
1600
  }