feat(diff): 迁入 diff 域,与 render 共用 gorge-render 二进制 - #3
Merged
Conversation
新增 go/internal/diff,提供 POST /api/diff/generate 与 /api/diff/prose: - unified 引擎逐字节替代 PHP 侧的 `diff -U65535` 子进程调用。输出被 ArcanistDiffParser 解析而非渲染,所以格式必须精确:行模型是 (文本, 是否有尾换行) 的二元组、hunk 头按三种写法输出、 `\ No newline at end of file` 跟在承载它的记录之后;相同输入这一支 刻意照抄 PhabricatorDifferenceEngine 而不是 GNU diff。 - prose 引擎四级递归,唯一硬不变量是无损:拼回 "="/"-" 得到旧文本, 拼回 "="/"+" 得到新文本。 - 本域不定义域级错误码——两个引擎都没有可报告的失败模式,过大的输入 已经是 ERR_TOO_LARGE。 部署面没有新增东西:两个域都是纯计算、无外部依赖,第二个进程只会多出 一样要部署的东西,所以 diff 走既有的 :8140,原先规划的 :8130 废弃, compose 里也没有新 service,只多了 GORGE_DIFF_MAX_BYTES(限制的是 len(old)+len(new),不是单边)。service token 一个覆盖两域。 契约与测试: - 新增 api/openapi/diff.yaml、go/internal/contracts/diff.go - 新增 14 份 tests/contract/diff 固件(unified 部分做字节精确断言) - 新增 tests/e2e/diff.sh 并挂进 make e2e - 把 render 的固件 runner 抽成 go/internal/contracttest,两域共用同一套 断言词汇,避免各写一份后开始用不同方式描述自己的契约 - layering_test.go 的 forbiddenPrefixes 补上 internal/diff 文档:新增 docs/modules/diff.md,更新 architecture / testing / findings / compat/phorge 与 compose 注释。findings 新增一条:进程级配置 config.Base 目前嵌在 render.Config 里,diff 只能从 render.Load() 借 token,第三个域 进来时会开始咬人。
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
新增 go/internal/diff,提供 POST /api/diff/generate 与 /api/diff/prose:
diff -U65535子进程调用。输出被 ArcanistDiffParser 解析而非渲染,所以格式必须精确:行模型是 (文本, 是否有尾换行) 的二元组、hunk 头按三种写法输出、\ No newline at end of file跟在承载它的记录之后;相同输入这一支 刻意照抄 PhabricatorDifferenceEngine 而不是 GNU diff。部署面没有新增东西:两个域都是纯计算、无外部依赖,第二个进程只会多出
一样要部署的东西,所以 diff 走既有的 :8140,原先规划的 :8130 废弃,
compose 里也没有新 service,只多了 GORGE_DIFF_MAX_BYTES(限制的是 len(old)+len(new),不是单边)。service token 一个覆盖两域。
契约与测试:
文档:新增 docs/modules/diff.md,更新 architecture / testing / findings / compat/phorge 与 compose 注释。findings 新增一条:进程级配置 config.Base 目前嵌在 render.Config 里,diff 只能从 render.Load() 借 token,第三个域 进来时会开始咬人。