Skip to content

feat(evidence): support Gitee and local-only repositories - #354

Merged
tt-a1i merged 2 commits into
tt-a1i:mainfrom
sunsunsun-java:codex/issue-143-portable-evidence
Sep 8, 2026
Merged

tt-a1i merged 2 commits into
tt-a1i:mainfrom
sunsunsun-java:codex/issue-143-portable-evidence

Conversation

@sunsunsun-java

@sunsunsun-java sunsunsun-java commented Sep 8, 2026 •

Copy link
Copy Markdown
Collaborator

Problem and value

Closes #143. Fixes #301.

目前,即使本地仓库中的提交、文件和行号都正确,Gitee 或自建 Git 仓库仍会因为地址不是 GitHub 而无法使用源码证据。

这次把“检查本地源码”与“生成网页链接”分开:

  • GitHub 保持原有用法;Gitee 可以生成对应提交、文件和行号的链接。
  • 内网 GitLab、Gitea、Forgejo、Bitbucket 等仓库可设置 link_mode: "local-only"。图中仍显示已验证的 SRC、文件路径和行号,也能搜索路径,但不生成可能错误的网页链接。支持 repository-evidence: identity binding is hard-coded to github.com, blocking self-hosted Git (Gitea/GitLab/Forgejo) #301 提到的 HTTP Gitea 地址。
  • 所有模式仍检查仓库根目录、origin、固定提交、Git 中的文件内容和行号。校验通过只代表本地证据成立,不代表读者能访问远程仓库。

例如,自建仓库可这样声明:

{
  "repository": {
    "url": "http://git.internal:3000/Team/service.git",
    "revision": "<完整的 40 位提交 SHA>",
    "link_mode": "local-only"
  }
}

本次范围沿用 #143 的首期方向:网页链接先支持 GitHub/Gitee,其他平台先提供本地校验。与 issue 中省略 URL 的示例不同,url 在 local-only 中仍必填,用来确认本地 origin 对应的是声明的仓库。无 origin、多仓库绑定和其他平台的网页链接不在本次范围内。完整规则见 authoring contract。

Stability impact

  • Impact class: Shared behavior + Contract change。新增可选 provider、link_mode,调整地址校验和共享 Viewer;render、validate、deliver、preview、compare 使用一致的仓库身份规则。
  • 保留的行为: 现有 GitHub 输入及默认收据字段保持兼容。错误 origin、缺失提交/文件、越界路径和非法行号仍失败;失败不会覆盖上一次可信产物。读取固定提交中的文件,不受工作区未提交改动影响。
  • 明确的边界: 未知平台应填写实际 clone 地址,不猜测 HTTPS/SSH、.git 后缀或不同路径是否等价。审核发现的两个误判已修复:git@host:Team/repo 与 ssh://git@host/Team/repo 不再被当成同一位置;SCP 地址里的 repo%41 不再被误解为 repoA。凭据不进入生成内容或失败诊断。
  • No unrelated changes: 不改版本号,不新增其他平台的网页适配器;生成文件仅随共享模板、语言数据和打包源码更新。

Tests run

比较基线:7ce87eff8e43e91069d43ed642f8845130e090c8(已包含 #325)。候选提交:a3f6058c76cc234f35504745544ab2172f3f431e。以下本地验证对应最终源码和生成内容,环境为 macOS、Node 22.23.1。

检查 实际结果
cd archify && npm test 1041 通过,0 失败,29 按环境条件跳过。跳过项包含需显式开启的浏览器测试、外部 MCO 仓库、非 Node 22 用例及独立站点集成 gate;不计为通过。
ARCHIFY_CHROME="/path/to/chrome" node --test test/repository-evidence.test.mjs test/desktop-reader-browser.test.mjs(在 archify/) 24/24 通过,0 跳过。包含三种证据模式、预览/比较和 #325 的全部打包示例桌面检查。
解压 archify.zip 后运行 node scripts/package-smoke.mjs <解压目录>/archify macOS 通过;另用解压包完成 HTTP local-only 的真实仓库交付。其他操作系统等待远端 CI。
与基线比较示例/Gallery 的 SVG 28 个文件一致,保留既有图形内容和几何。
git diff upstream/main...HEAD --check 通过。

两处审核问题均有先失败、修复后通过的 CLI 回归;Compare 另覆盖地址规范化后的重复解析。四个方向的子代理审核后,原安全性和规格问题已分别复审关闭。回归用例。

消融检查:移除不必要的提交链接包装函数后测试仍通过,保持删除;尝试移除相对/绝对路径区分后,CLI 和 Compare 两个回归失败,因此恢复该检查,最终测试通过。

已确认最终提交的 远端 CI 已启动。创建 PR 后首次核对时,ZIP freshness 和 published update manifest 已通过;Node 18/20/22/24、跨平台包测试及其余任务仍排队或运行中,CodeRabbit 等待结果。尚不宣称全部 CI 通过。

Visual evidence

  • Evidence provided: 浏览器回归验证 SRC 标记、路径搜索、行号、仓库链接和来源链接。预期变化是 local-only 来源显示为普通文本,GitHub/Gitee 仍可点击;图形内容保持不变。
  • Comparison conditions: 同一个 web-app fixture,1440×900,light/dark,Architecture 默认视图,点击 Users 打开 Passport,并搜索 src/router.js。
  • Reproduce: 运行上述浏览器命令;测试在系统临时目录 archify-evidence-repo-* 下保留 github.html、gitee.html、local-only.html,可打开这三个文件按相同条件人工比较。
  • Automated or browser checks: 上述 24/24 通过;这是自动化交互/布局证据。
  • Perceptual visual review: skipped. 当前会话的本地页面访问受工具策略限制,尚未完成人工视觉验收。未将自动化通过写成人工验收通过。

Generated artifacts

从合并最新 main 后的源码重建:schema 预编译校验器、两处打包示例、手写 web-app 示例的共享模板部分、Checkout Compare HTML/收据、Gallery 的 11 个页面及索引、README 演示 GIF/收据,以及 archify.zip(Node 22,78 个文件)。手写示例的 SVG 保留不变。

使用现有 render-examples、build-gallery、compare、build-readme-showcase 和 build-zip 脚本;Gallery 为 99 项检查通过,演示 GIF 为 54 帧。Guide/Start 的输入未变,完整测试中的 freshness 检查通过,因此不重建无关输出。

@coderabbitai

coderabbitai Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: a7a18537-42c2-4126-85a8-baee43295b33

📥 Commits

Reviewing files that changed from the base of the PR and between 7ce87ef and a3f6058.

⛔ Files ignored due to path filters (2)
  • archify.zip is excluded by !**/*.zip
  • docs/assets/archify-live-proof.gif is excluded by !**/*.gif
📒 Files selected for processing (38)
  • archify/assets/template.html
  • archify/bin/archify.mjs
  • archify/delta/architecture-delta.mjs
  • archify/examples/dataflow-product-analytics.html
  • archify/examples/lifecycle-agent-run.html
  • archify/examples/sequence-cache-miss-request.html
  • archify/examples/web-app-rendered.html
  • archify/examples/workflow-agent-tool-call-rendered.html
  • archify/references/authoring-contract.md
  • archify/renderers/shared/generated-validators.mjs
  • archify/renderers/shared/i18n.mjs
  • archify/renderers/shared/repository-evidence.mjs
  • archify/renderers/shared/repository-location.mjs
  • archify/schemas/architecture.schema.json
  • archify/test/architecture-delta.test.mjs
  • archify/test/repository-evidence.test.mjs
  • docs/assets/archify-live-proof.json
  • docs/gallery.html
  • docs/gallery/artifacts/agent-run.lifecycle.html
  • docs/gallery/artifacts/agent-tool-call.workflow.html
  • docs/gallery/artifacts/async-job-roundtrip.sequence.html
  • docs/gallery/artifacts/cache-miss.sequence.html
  • docs/gallery/artifacts/deployment-release.lifecycle.html
  • docs/gallery/artifacts/event-stream.dataflow.html
  • docs/gallery/artifacts/incident-response.workflow.html
  • docs/gallery/artifacts/product-analytics.dataflow.html
  • docs/gallery/artifacts/production-deployment.architecture.html
  • docs/gallery/artifacts/release-delivery.workflow.html
  • docs/gallery/artifacts/web-app.architecture.html
  • docs/gallery/manifest.json
  • examples/checkout-platform-delta.html
  • examples/checkout-platform-delta.receipt.json
  • examples/dataflow-product-analytics.html
  • examples/lifecycle-agent-run.html
  • examples/sequence-cache-miss-request.html
  • examples/web-app-rendered.html
  • examples/web-app.html
  • examples/workflow-agent-tool-call-rendered.html

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Summary

Summary

Repository evidence is no longer limited to GitHub. The change adds Gitee links and link_mode: "local-only" for self-hosted or internal repositories.

Changed behavior

  • Validates repository root, origin identity, fixed revision, files, safe paths, and line ranges locally.
  • Generates revision-pinned GitHub or Gitee links when link_mode is web.
  • Preserves verified source references without hyperlinks when link_mode is local-only.
  • Adds optional provider and link_mode repository fields.
  • Redacts credentials and query data from diagnostics and generated content.
  • Updates delta comparison, delivery receipts, schemas, documentation, examples, and generated artifacts.
  • Renders non-link source evidence as text instead of misleading anchors.

Compatibility impact

Existing GitHub configuration and link behavior remain supported. Invalid origins, revisions, files, paths, and line ranges continue to fail validation. GitLab, Gitea, Forgejo, and Bitbucket web-link generation are not implemented; use local-only for those repositories.

Validation

The author reports 1,041 tests, 24 browser tests, macOS package smoke testing, unchanged SVG comparisons, and a clean whitespace check. These results were not independently executed or verified from the current repository state.

Walkthrough

Repository evidence now supports GitHub and Gitee links, local-only verification, parsed remote identities, conditional source links, updated delta comparison, and regenerated rendered artifacts.

Changes

Repository evidence portability

Layer / File(s) Summary
Repository location and evidence contracts
archify/renderers/shared/..., archify/schemas/..., archify/references/..., archify/test/...
Repository remotes are parsed and validated across HTTPS, SSH, and SCP forms. GitHub, Gitee, and local-only modes generate the corresponding evidence records and source links.
Repository identity normalization
archify/delta/..., archify/test/architecture-delta.test.mjs
Architecture delta comparison uses canonical repository identities and preserves provider and link-mode metadata.
Conditional passport source rendering
archify/assets/template.html, archify/examples/..., docs/gallery/artifacts/..., archify/renderers/shared/i18n.mjs
Repository and source evidence render as links only when URLs exist. Non-linked sources render as plain elements, and link styling and markers apply only to anchors.
Generated artifact receipts
docs/gallery.html, docs/gallery/manifest.json, docs/assets/archify-live-proof.json, examples/checkout-platform-delta.receipt.json
Generated artifact sizes and SHA-256 receipts were updated after HTML regeneration.

Priority: ➖ Normal — Impact reflects medium issue severity.

Estimated code review effort: 4 (Complex) | ~60 minutes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to a3f60

Repository evidence portability, local-only rendering, and regenerated artifacts have no remaining actionable merge risk.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Contribution Scope ✅ Passed PASS. The PR states the user problem, intended outcome, focused repository-evidence behavior, compatibility impact, and failure behavior. It links issues #143 and #301 for the new schema fields, `link…
Validation Evidence ✅ Passed Validation evidence is sufficient and current-head CI is green. The PR records base 7ce87eff8e43e91069d43ed642f8845130e090c8, candidate a3f6058c76cc234f35504745544ab2172f3f431e, exact test command…

Warning

Some tools did not complete. Review the errors below.

🔧 ast-grep (0.45.2)
docs/gallery/artifacts/release-delivery.workflow.html

ast-grep timed out on this file

docs/gallery/artifacts/incident-response.workflow.html

ast-grep timed out on this file

docs/gallery/artifacts/deployment-release.lifecycle.html

ast-grep timed out on this file

  • 20 others

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tt-a1i tt-a1i left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed a3f6058 against the agreed scope of #143 and #301: preserve GitHub behavior, support Gitee web links, and provide verified local-only evidence for other Git hosts without guessing web URLs.

No blocking findings. Independently ran repository-evidence and architecture-delta tests with Chrome enabled: 42 passed, 0 failed, 0 skipped. Inspected the rendered GitHub, Gitee, and local-only source panels. Origin, pinned commit, file/path and line validation remain enforced. All 10 current-head CI checks passed. Remote repository accessibility is not claimed by local evidence validation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants