Skip to content

Commit 545a3ec

Browse files
committed
feat(traces): serve scoped Git HTTP with SHA-256 negotiation
Signed-off-by: ELi Ma <eli@patch.sh>
1 parent 5a2b93d commit 545a3ec

20 files changed

Lines changed: 3228 additions & 138 deletions

‎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.75"
3+
version = "0.42.76"
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/deployment.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ Resource sizing scales with repository size and push concurrency; the write path
136136
- [ ] Leave `[traces].enabled` false until an operator writes a persistent `server_id` UUID. The process does not generate that id. A reload or a new process keeps it. TLS certificate rotation and credential rotation do not replace it.
137137
- [ ] Backups, three parts: Postgres dump, object storage bucket, `mega2 --config <path> config vault backup <destination>` (Vault core key; restore with `config vault restore`, see [`src/commands/config.rs`](../src/commands/config.rs)).
138138

139+
HTTP traces permits one receive request and one fetch per process; overload returns a retryable 503. A cancelled receive keeps its permit until the actual decoder worker exits. Reserve at least 4 GiB of available memory for the process and qualify deployment capacity against measured RSS at the maximum allowed push size; this reservation is not proof of production qualification. Give `TMPDIR` a dedicated writable filesystem, provision for the full history’s bytes and approximately 4–5 inodes per object, and monitor free space and inodes. Fetch does not truncate history at a fixed size or 300 seconds; full-tip closure reads, synchronous compression, file IO and cleanup can still occupy the runtime. Each fetch negotiation round without `done` also reads and spools the full tip closure to validate want reachability before returning NAK; clients with existing history may incur that cost repeatedly. An existing publication lock wait or stuck rollback can retain the sole receive permit, causing all other pushes to receive 503. Monitor database locks and active transactions and resolve the occupancy before restoring traffic. Admission limits do not resolve that database wait automatically. See the [traces protocol](./refactoring/traces.md) for fixed protocol limits and object-store conditional-create qualification.
140+
139141
## 6. Upgrades and mode changes
140142

141143
- Upgrades: swap the image / binary and restart. Config changes marked `restart_required` take effect only after a restart.

‎docs/deployment.zh.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,8 @@ cargo build --release -p mega2 # 产物 target/release/mega2
136136
- [ ] `[traces].enabled` 保持 false,直到操作者写入持久的 `server_id` UUID。进程不会生成这个 id。配置重载和新进程都保留它。轮换 TLS 证书或凭据不会替换它。
137137
- [ ] 备份三件套:Postgres dump、对象存储 bucket、`mega2 --config <path> config vault backup <destination>`(Vault core key;恢复用 `config vault restore`,见 [`src/commands/config.rs`](../src/commands/config.rs))。
138138

139+
HTTP traces 每进程分别允许一个接收请求和一个 fetch;过载返回可重试的 503。接收请求取消后,实际解码 worker 退出之前仍占用接收许可。为进程至少预留 4 GiB 可用内存,并用最大允许推送的实测 RSS 核定部署容量;该预留值不等于生产环境已经通过资格验收。为 `TMPDIR` 配置专用可写磁盘,按完整历史对象字节及约每对象 4–5 个 inode 预留空间并监控剩余量。fetch 不以固定历史大小或 300 秒截断;完整 tip 闭包读取、同步压缩、文件 IO 和清理仍可能占用运行时。尚未发送 `done` 的每轮 fetch 协商也会读取并暂存完整 tip 闭包以验证 want 的可达性,随后返回 NAK;已有历史的客户端可能多次产生该成本。发布事务的既有锁等待或 rollback 卡住时,单个接收许可可能持续被占用,其余推送均返回 503;监测数据库锁与活动事务,排查占用后再恢复流量。容量限制不会自动解决该数据库等待。固定协议限制和对象存储条件创建资格见 [traces 协议](./refactoring/traces.md)。
140+
139141
## 6. 升级与形态切换
140142

141143
- 升级:替换镜像 / 二进制并重启。标注 `restart_required` 的配置变更必须重启才生效。

‎docs/plan/README.md‎

Lines changed: 59 additions & 3 deletions
Large diffs are not rendered by default.

‎docs/plan/plan-20261015.md‎

Lines changed: 112 additions & 27 deletions
Large diffs are not rendered by default.

‎docs/plan/plan-long.md‎

Lines changed: 62 additions & 4 deletions
Large diffs are not rendered by default.

‎docs/plan/plan-status.md‎

Lines changed: 65 additions & 5 deletions
Large diffs are not rendered by default.

‎docs/refactoring/protocol.md‎

Lines changed: 56 additions & 2 deletions
Large diffs are not rendered by default.

‎docs/refactoring/traces.md‎

Lines changed: 60 additions & 3 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)