molecule-core/platform/migrations
rabbitblood e7710d2e6f feat(channels): Lark / Feishu adapter (outbound webhook + Events API inbound)
New ChannelAdapter implementation for Lark (international, open.larksuite.com)
and Feishu (China, open.feishu.cn). Both speak the same payload format —
only the host differs — so a single adapter covers both.

Outbound: POST text to a Custom Bot webhook URL with msg_type:"text".
Lark returns 200 OK even when delivery fails — the body's `code` field is
the truth. Adapter parses the response and returns a Go error when
code != 0 so callers don't think a revoked-webhook send succeeded.

Inbound: handles both v1 url_verification (handshake) and v2 event_callback
(im.message.receive_v1) shapes. Optional verify_token field — when set,
inbound payloads with mismatching tokens are rejected via constant-time
compare (#337 class — never raw == against a stored secret).

Sender ID resolution prefers user_id → falls back to open_id (open_id is
always present; user_id only when the bot has the contacts permission).
Non-text message types and non-message events return nil, nil so the
receiver responds 200 OK without dispatching.

Tests: 23 cases — identity, ValidateConfig (6 sub-cases incl. URL prefix
matrix), SendMessage (no URL / invalid prefix / happy-path body shape /
api-error-code surfacing), ParseWebhook (handshake + token mismatch +
text message + open_id fallback + non-message + non-text + token mismatch
+ malformed JSON + malformed content + empty text), StartPolling no-op,
registry presence.

Also: make migration 023 idempotent (ADD COLUMN IF NOT EXISTS) — the
platform's migration runner has no schema_migrations tracking table, so
every .up.sql replays on every boot. Without IF NOT EXISTS the second
boot against an existing volume crashes with "column already exists".
Followup issue to be filed for proper migration tracking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 07:10:58 -07:00
..
001_workspaces.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
002_agents.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
003_events.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
004_secrets.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
005_canvas_layouts.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
006_workspace_config_memory.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
007_approvals.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
008_agent_memories.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
009_activity_logs.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
010_workspace_awareness.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
011_workspace_runtime.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
012_global_secrets.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
013_workspace_dir.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
014_indexes.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
015_workspace_schedules.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
016_workspace_channels.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
017_memories_fts_namespace.down.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
017_memories_fts_namespace.up.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
018_secrets_encryption_version.down.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
018_secrets_encryption_version.up.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
019_workspace_access.down.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
019_workspace_access.up.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
020_workspace_auth_tokens.down.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
020_workspace_auth_tokens.up.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
021_delegation_idempotency.down.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
021_delegation_idempotency.up.sql initial commit — Molecule AI platform 2026-04-13 11:55:37 -07:00
022_workspace_schedules_source.down.sql fix(schedules): backfill legacy rows to 'template' + extract import SQL const 2026-04-14 14:30:22 -07:00
022_workspace_schedules_source.up.sql fix(schedules): backfill legacy rows to 'template' + extract import SQL const 2026-04-14 14:30:22 -07:00
023_workspace_memory_version.down.sql feat(memory): optimistic-locking via if_match_version on workspace_memory writes 2026-04-16 02:32:46 -07:00
023_workspace_memory_version.up.sql feat(channels): Lark / Feishu adapter (outbound webhook + Events API inbound) 2026-04-16 07:10:58 -07:00
024_channel_budget.down.sql feat(channels): per-channel message budget with 429 enforcement (#368) 2026-04-16 11:17:14 +00:00
024_channel_budget.up.sql feat(channels): per-channel message budget with 429 enforcement (#368) 2026-04-16 11:17:14 +00:00