Repository navigation
Conversation
Dependency definitions and the cached catalog come from the server-level Supermarket source and are verified by digest on every read, but they were stored per team under FORCE RLS. Every team downloaded and stored its own copy, every definition read ran an UPDATE to renew a retention lease, and the in-memory snapshot missed whenever reads alternated between teams. Migration 0173 adds template.workspace_dependency_definitions and template.workspace_dependency_catalogs without team_id or RLS and copies the rows whose release and archive digests verify, deduplicated, plus one merged catalog per source. The per-team public tables stay for Servers running the previous release during a rolling deploy. Definitions are now append-only: the lease column, the prune query and its call are removed, and a definition read is a plain SELECT. The snapshot cache and read revalidation are keyed by source only. ReapStale loads the catalog only when an unlocked operation is left in progress, and the update worker reads the stored catalog instead of forcing a registry refresh. Refs #1744
Migration 0174 copies verified definitions that Servers still on the previous release wrote into public.workspace_dependency_definitions into the global template table, then drops the per-team definition and catalog tables. The catalog is rebuilt by the refresher. 0001_init reflects the final state. Must be deployed only after 0173 and after no previous-release Server runs. Refs #1744
HoneyBBQ
force-pushed
the
fix/dependency-catalog-global
branch
from
November 5, 2026 07:14
62f7c3c to
33283ec
Compare
This branch has not been deployed
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.
Author
Type
Summary
问题
依赖定义和依赖目录按团队存储,开启了 FORCE RLS。它们的内容来自 server 级配置的 Supermarket 地址,读取时都会按 sha256 校验,和团队无关。
这样存有三个后果:
UPDATE ... SET last_accessed_at = now() ... RETURNING,每读一次就写一次库、提交一次。ReapStale每次又先加载整份目录,再查有没有未完成的操作。后台任务按团队执行时,写入次数等于团队数 × 目录条目数 × 执行频率,写入不会停。
改动
templateschema 下建workspace_dependency_definitions和workspace_dependency_catalogs两张全局表,不带team_id,也不开 RLS。做法与 provider 模板表相同。last_accessed_at。ReapStale先查未完成的操作,没有需要处理的就直接返回,不加载目录。Related Issues
Closes #1744
Validation
go build ./...、go vet通过。./internal/workspacedeps/...、./internal/db/...的单元测试和集成测试通过,包括TestTeamSchemaGuard、TestRLSPolicyGuard、team_id 回填、复合键和 provider 模板全局性的守卫测试。mise run lint:go通过。ReapStale不加载目录。7e8637303,未含 0174):Screenshots / Recordings
应用市场:依赖目录的名称和图标都从全局表读取。
Bot「应用」页:已安装的依赖正常列出。
Human QA