Skip to content

Commit 78eecd5

Browse files
Merge branch 'main' into maint/mst2-native-head-with-projection
2 parents c425496 + 896e084 commit 78eecd5

8 files changed

Lines changed: 1037 additions & 27 deletions

File tree

‎Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mega2"
3-
version = "0.42.15"
3+
version = "0.42.16"
44
edition = "2024"
55
license = "MIT OR Apache-2.0"
66
description = "Monorepo engine and Git hosting server for AI agents: trunk-based storage, Git Smart HTTP, Git LFS, OCI registry, and Agent Session Capture"

‎docs/deploy-trunk.md‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,3 +514,15 @@ HTTP 服务即可从已提交水位继续。
514514

515515
停服时 worker 丢弃正在执行的轮。已提交的根链段与投影批会保留,未提交的当前事务会回滚;服务
516516
重启后从这些已提交水位继续追赶。
517+
518+
### 13.2 视图注册的等待、查询与计数(实验)
519+
520+
本节接口处于实验阶段,适用于已按[配置说明](configuration.md)启用 `[views]` 的 trunk、sha1 部署;此处不表示视图 Git URL 已可用。
521+
522+
向 `POST /api/v1/views` 发送 JSON 请求体 `{"filter_spec":":/project/a","name":"agent/task-1"}`。`name` 可省略。注册按 `git.push_auth` 鉴权;使用 token 时,push token 须覆盖过滤器的全部源路径。成功应答包含 `filter_id`、`name`、`version` 与 `ready`。带 `?wait=true` 时,准入提交后等待就绪,最多 20 秒;返回 `ready=false` 时可轮询 `GET /api/v1/views/{filter_id}`。没有 `wait=true` 时注册立即返回。
523+
524+
`GET /api/v1/views/{filter_id}` 返回 `filter_id`、`canonical_spec`、`src_paths`、`push_enabled`、`ready`、`projected_seq`、`lag_commits` 七个字段。`lag_commits` 是 `seq(main@/)` 减去该过滤器的投影水位;`main@/` 尚未进入根链时,也计入它与根链链尾之间尚未接入的提交。`main@/` 缺失、回走不能在 `views.max_append_walk` 个提交内接上根链链尾,或遇到回滚、分叉、多父、缺失首父等不连续历史时为 `null`。
525+
526+
`GET /api/v1/views?name=agent%2Ftask-1` 按名字查询。名字含 `/` 时须百分号编码;省略 `version` 取最新版本,`&version=1` 可指定版本。响应只含 `filter_id`、`name` 与 `version`。
527+
528+
`GET /api/v1/views/metrics` 返回进程内原子计数与实时查询的 `view_cold_start_slots_in_use`。这些元数据端点不鉴权:视图不是路径级读权限边界(ADR-HP-05)。若 `/api/v1` 暴露给不可信网络,应在反向代理处对 `/api/v1/views` 限流;可热调低 `views.max_append_walk` 以限制每次滞后量查询的回走步数,代价是根链扩展的单次预算也降低。

‎docs/plan/plan-20261002.md‎

Lines changed: 24 additions & 18 deletions
Large diffs are not rendered by default.

‎docs/refactoring/history-projection.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ fn mark_ready_if_covered(F, tip) -> bool: # 只在持
12351235
### 6.5 视图注册(P0)
12361236
- **接口:**
12371237
- `POST /api/v1/views {filter_spec, name?}`:返回 `{filter_id, name, version, ready}`。支持 `wait=true`,阻塞到 ready 或超时为止。
1238-
- `GET /api/v1/views/{filter_id}`:返回 canonical 文本、`src_paths`、`push_enabled`、ready 状态、投影水位与滞后量。
1238+
- `GET /api/v1/views/{filter_id}`:返回 canonical 文本、`src_paths`、`push_enabled`、ready 状态、投影水位与滞后量。滞后量按 §4.5 计算;`main@/` 在 `views.max_append_walk` 个提交之内不能按 §3.3 第 3 步连上链尾时返回 null。
12391239
- `GET /api/v1/views?name=<name>&version=<v>`:按名字查询,省略 version 时取最新版本,返回 filter_id。视图名可以含 `/`,所以名字只出现在查询参数中,不进入路径参数。
12401240
- **`[views].enabled = false` 时【决策】。** 本节的三个接口与 6.6 的 REST 读接口(P1)都不挂载,请求由路由层直接返回 404,与 6.1 第 2 层对视图 URL 的应答一致。【代码】先例是 Agent Capture:`mount_agent_capture` 按配置决定是否把 `agent_capture_router` 并入 `storage_only_routers_with`(`src/server/http_server.rs` 约 L769–777、L845–847;`src/api/api_router.rs` 约 L72–90)。关闭时的 404 由测试 `disabled_storage_only_does_not_register_agent_capture` 断言(约 L1583)。OpenAPI 文档也按同一开关取舍(`storage_only_openapi_doc` 约 L849、`trunk_openapi_doc` 约 L870)。不采用 MST/2 在 handler 内判定的做法(`snapshot_router.rs::ensure_enabled` 约 L306),因为那样会以"未就绪"应答,与视图 URL 的 404 不一致。由此:
12411241
- 拒绝早于鉴权、请求体解析和任何查库,不写过滤器行、视图行或速率行,也不占冷启动名额;

0 commit comments

Comments
 (0)