Repository navigation
eNotify × Vikunja 集成(后端):入站 webhook 适配 + 管理接口 + 迁移 - #173
Merged
todosdev[bot] merged 5 commits intoNov 5, 2026
Merged
Conversation
added 5 commits
November 5, 2026 09:59
Add the vikunja_integrations table (schema_v4), HMAC-verified inbound webhook route, per-user management endpoints, log redaction, docs and tests. Checkpoint: WIQCMHrEuGb0bV4Wn24_8
Refresh the stale schema_v1-only expectations to schema_v1–schema_v4, document the schema_v4 activation step, and return the GET view plus the one-time secret from the integration create endpoint. Checkpoint: YrQ6lRZKMDTcWHK7IOw1d
Release the canonical index name before the fresh install, assert the live unique index in step 3, and correct the cascade wording and rollback drop order. Checkpoint: OGWvZhyCIMJn7kg6sKKIy
Release the five core index names alongside the Vikunja unique index, verify and rebuild them on both rollback paths, and replace the ineffective recovery guidance with live-table index recreation. Checkpoint: 9D35Uuzb1ePVZssNId0q_
Drop the index names before recreating them in the recovery path, make the Vikunja rollback statements conditional, and distinguish core-table from integration-snapshot indexes. Checkpoint: p7n4kjIX5hWhTno85SnxY
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.
概要
trigger_source = "vikunja"记入通知历史。{prefix}vikunja_integrations新表与schema_v4迁移、HMAC 验签入站端点、每用户管理接口、日志脱敏、文档与测试;前端「集成」页签由并行单交付。改动
worker/src/types.ts、worker/src/db/schema.sql、worker/src/lib/migrations.ts、worker/src/db/queries/vikunja-integrations.ts):新表每用户一行,hook_token唯一、secret明文存储(HMAC 需要原始密钥)、base_url默认空串、enabled数值;schema_v4纯新增IF NOT EXISTS并带命名唯一索引;查询模块提供按 token/用户查询、创建、更新、删除。worker/src/routes/integrations.ts、worker/src/services/vikunja-webhook.ts):POST /api/integrations/vikunja/:hookToken,按 token 限流 60 次/分钟;顺序为查 token → 查启用 → 只读一次原始 body 做crypto.subtle.verify常量时间验签 → 解析 JSON → 事件映射 →sendNotifications(不传 channels,triggerSource: "vikunja"、itemId: null,发送完成后才回响应)。支持task.reminder.fired、task.overdue、tasks.overdue;截止时间按接收用户时区格式化,tasks.overdue汇总最多 10 行。未知事件与残缺数据返回 200{ignored:true},其余状态码按规格表实现。worker/src/routes/me.ts):创建(201 返回一次性 secret;已存在 409)、查询(永不回明文,只回secret_configured:true)、修改enabled/base_url(仅 http(s)、去尾斜杠、空串合法)、轮换 secret(一次性明文)、删除(未创建 404);沿用authMiddleware+getEffectiveUserId。worker/src/index.ts):路由挂在 SPA fallback 之前;请求日志正则扩展到/api/integrations/vikunja/<token>。README.md、README.en.md、CLAUDE.md、docs/migration-ledger-cutover-runbook.md):集成说明(端点、管理方式、事件、验签约定)、Vikunjawebhooks.enabled前置与schema_v4升级步骤;CLAUDE.md 补新表与新路由;生产切换 runbook 补新表改名、索引名释放/重建与回滚顺序。schema_v4全新安装/从 v3 升级/幂等测试;既有迁移列表断言同步到 v4。测试
pnpm typecheck、pnpm build、pnpm test(26 个测试文件 / 349 项)与pnpm format:check全部通过;pnpm lint仅剩仓库既有的worker/src/routes/items.ts未用导入告警(非本 PR 引入)。trigger_source='vikunja';轮换后旧签名 401、新签名通过;DELETE 后入站 404;重复创建 409;迁移的全新安装、v3 升级与重复执行无变化。