Skip to content

ci: map octo-docs-html to the server module#89

Open
an9xyz wants to merge 5 commits into
mainfrom
chore/map-octo-docs-html
Open

ci: map octo-docs-html to the server module#89
an9xyz wants to merge 5 commits into
mainfrom
chore/map-octo-docs-html

Conversation

@an9xyz

@an9xyz an9xyz commented Jul 17, 2026

Copy link
Copy Markdown

What

Map octo-docs-html to the existing server Module option in the reusable project workflow.

Why

PRs and issues from the repository need deterministic Module metadata on Octo Board.

How

  • Add an executed contract for the repository-to-Module mapping.
  • Run workflow contract tests from Workflow Sanity.
  • Map octo-docs-html to server, matching its API-only Go server role.

Checklist

  • Tests added/updated for the changes
  • All tests pass locally
  • Based on latest main
  • Commit messages follow Conventional Commits
  • Self-reviewed the full diff

Testing

python3 -B -m unittest discover -s .github/tests -p "test_*.py"

Breaking Changes

N/A

@an9xyz
an9xyz requested a review from a team as a code owner July 17, 2026 07:35
yujiawei
yujiawei previously approved these changes Jul 17, 2026

@yujiawei yujiawei left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review — PR #89 (.github)

Summary

This PR maps octo-docs-html to the existing server Module option in the reusable "auto-add-to-project" workflow, adds a contract test asserting that mapping, and wires the test suite into the Workflow Sanity workflow via a new contracts job (plus .github/tests/** path triggers). Scope is small, focused, and matches the PR description.

1. Spec compliance

Spec: ✅

  • Missing work: none. All stated deliverables are present:
    • octo-docs-html: 'server' added to REPO_MODULE (.github/workflows/auto-add-to-project.yml:89), correctly placed alphabetically.
    • Contract test test_octo_docs_html_maps_to_server added (.github/tests/test_auto_add_to_project.py:9).
    • New contracts job runs the test suite (.github/workflows/workflow-sanity.yml:27) and .github/tests/** added to both pull_request and push path filters.
  • Out of scope: one unrelated change — removal of a trailing blank line at the end of auto-add-to-project.yml. Cosmetic and harmless, but strictly unrelated to the mapping change (nit below).
  • Deviation: none. The server (rather than web) choice is justified — octo-docs-html is a Go repository serving an API-only server role, consistent with the sibling octo-* server entries.

2. Code quality

Quality: Approved

Verified locally: python3 -B -m unittest discover -s .github/tests -p "test_*.py" → 1 test, OK.

Strengths:

  • New contracts job follows the repo's security hygiene: least-privilege permissions: contents: read, persist-credentials: false, SHA-pinned actions/checkout@de0fac2… (v6.0.2), and a timeout-minutes: 5.
  • The test parses the live REPO_MODULE block from the workflow YAML rather than hard-coding a duplicate map, so it stays coupled to the source of truth and will catch accidental removal/rename of the entry.
  • Path triggers are added symmetrically to both pull_request and push, so test changes are actually exercised.

Findings:

  • P2 (nit): The trailing-newline removal at the end of .github/workflows/auto-add-to-project.yml is unrelated to this change. Not blocking; consider keeping cosmetic churn out of feature PRs.
  • P2 (nit): The contract test only asserts the single octo-docs-html → server entry. That's appropriate for this PR's scope; if the intent is a general mapping contract, a follow-up could assert the full expected map (or at least that all values are known Module option names). No action required here.

3. Overall verdict

APPROVED — Spec ✅ and Quality Approved. No P0/P1 issues; the two items above are non-blocking nits.

mochashanyao
mochashanyao previously approved these changes Jul 17, 2026

@mochashanyao mochashanyao left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Octo-Q · automated review]

Verdict: Approve — no blocking findings; notes below (data-flow traced).


Review: .github PR#89 — ci: map octo-docs-html to the server module

Reviewer: Octo-Q (automated review)
Head SHA: 9f9971ed894c403b9f765ffce2d7e8268e186ce0
Base: main
Changed files: 3 (+48/−1)


1. Verification

Check Result
Mapping entry added in alphabetical order octo-docs-html placed between octo-deployment and octo-fleet (.github/workflows/auto-add-to-project.yml:89)
octo-docs-html is a Go project → server module ✅ Language breakdown: Go 641K, JS 163K, Shell 7K — consistent with octo-server, octo-fleet, octo-im which all map to server
Test file parses the same JS mapping block the workflow uses ✅ Regex const REPO_MODULE = \{(?P<body>.*?)^\s*\}; correctly captures the block; key-value regex '([^']+)':\s*'([^']+)', matches the single-quote + trailing-comma format used
workflow-sanity path triggers updated .github/tests/** added to both pull_request.paths and push.paths (lines 11, 16)
contracts job security posture permissions: contents: read, persist-credentials: false, no network calls in test
YAML syntax valid ✅ No syntax issues detected

2. Findings

No P0/P1 issues found.

P2 — Test covers only the new mapping, not existing ones

  • File: .github/tests/test_auto_add_to_project.py:10–28
  • What: The test has a single assertion (assertEqual(mappings.get("octo-docs-html"), "server")). It does not verify the other 19+ existing mappings.
  • Impact: If a future edit accidentally deletes or corrupts an existing mapping (e.g. octo-server), this test would not catch it.
  • Diff-scope: New — introduced by this PR (new test file).
  • Suggestion (non-blocking): Consider parameterising the test to cover all entries, or at minimum a few critical ones (octo-server → server, octo-web → web, octo-ios → ios). This is a test-robustness note, not a correctness blocker.

P2 — Regex key-value parser is format-coupled

  • File: .github/tests/test_auto_add_to_project.py:19–23
  • What: The regex ^\s*'([^']+)':\s*'([^']+)',\s*$ assumes single-quoted keys/values with trailing commas. If someone reformats to double quotes or drops the trailing comma on the last entry, the test would see a partial or empty mapping dict and could false-fail.
  • Impact: False-negative test failure, not a production correctness issue. The workflow itself uses JS (which accepts both quote styles), so the workflow would still work.
  • Diff-scope: New — introduced by this PR.
  • Suggestion (non-blocking): Acceptable as-is for a single-mapping guard test. If the test is expanded later, consider a more tolerant parser or a YAML-front-matter approach.

3. Data-Flow Trace

Production path (reusable workflow called by octo-docs-html repo):

  1. Caller repo octo-docs-html triggers workflow_call
  2. github.event.repository.name → env REPO_NAME = "octo-docs-html" (line 73)
  3. JS: const moduleName = REPO_MODULE["octo-docs-html"]"server" (line 89, new)
  4. GraphQL query resolves project, Module field, and option where name === "server" (lines 118–149)
  5. Mutation sets the Module field on the project item (lines 151–165)
  6. continue-on-error: true — failure gracefully skips, does not break the workflow

✅ Every data hop verified; the new mapping integrates correctly with the existing consumption chain. No empty-array / undefined / short-circuit risks.


4. Blind-Spot Checklist (C1–C6)

# Check Result
C1 Dual-path parity N/A — single-directional mapping (repo → module), no symmetric add/remove pair
C2 Control-flow ordering / nested reuse Clear — the mapping is consumed in a single linear JS block; no nested/duplicate call sites
C3 Authorization boundary N/A — no auth/permission changes; workflow uses PROJECT_TOKEN secret unchanged
C4 Authorization lifecycle / container-member N/A — no auth changes
C5 Build/runtime path N/A — no build artifacts; python3 -m unittest uses stdlib only, available on ubuntu-24.04
C6 Governance/policy consistency N/A — CI-only change, no governance docs touched

5. Extra Notes

  • Trailing blank line removal (auto-add-to-project.yml:320): Cosmetic cleanup of one trailing newline. No functional impact.
  • Checkout pinning (actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce8268e186ce0 # v6.0.2): Consistent with existing no-tabs and actionlint jobs. Good.

6. Cross-Round Blocker Re-check (R6)

N/A — automated review review, no prior rounds.


Verdict

[Octo-Q] verdict: APPROVE — Zero P0/P1 findings. Two P2 notes (test coverage breadth, regex format-coupling) are non-blocking test-robustness observations. The production change (one mapping entry) is minimal, correctly placed, and verified end-to-end through the data-flow chain.

lml2468
lml2468 previously approved these changes Jul 17, 2026

@lml2468 lml2468 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review at head 9f9971ed — ✅ APPROVE

org 级 .github 改动(reusable workflow,组织级 blast radius),但本 PR 极小且安全:把 octo-docs-html → server 加进 project 自动归类的 REPO_MODULE 映射 + 配套契约测试 + 在 workflow-sanity 里跑它。

Gate 1 — 规格符合度 ✅

恰好匹配描述:一行映射(octo-docs-htmlserver,与其 API-only Go server 角色一致)、一条断言该映射的 Python 契约测试、workflow-sanity 新增 contracts job 跑测试并把 .github/tests/** 纳入触发路径。无过度构建。

Gate 2 — 代码质量(org 级重点:workflow 安全)✅

  • contracts job 安全:pull_request(非 _target)、顶层 permissions: {} + job contents: read、checkout SHA-pin(de0fac2e… v6.0.2)、persist-credentials: false,只跑仓库自带 python3 -m unittest,${{}} 注入不可信 PR 数据、不运行 PR 提供的可执行代码
  • 映射改动零风险:octo-docs-html: 'server'REPO_MODULE JS map 里的纯数据项,不触碰 workflow 的 trigger/permissions/注入面。插入位置字母序正确(octo-deploymentocto-docs-htmlocto-fleet),值 server 与同类 octo-fleet/octo-im(Go API server)一致。
  • 契约测试有效:正则抓 REPO_MODULE 块断言 octo-docs-html==server,本地 python3 -m unittest 通过;能防未来误删/改错该映射的回归。
  • scope 干净:git diff 核实仅 3 文件;auto-add-to-project.yml-1 是 EOF 多余空行删除,无副作用。
  • CI 已全绿(actionlint / Workflow contracts / no-tabs / code-review approved)。

对抗检查(均无问题)

  • 新 job 是否给 PR 代码执行/写权限 → 无(pull_request + permissions:{} + read-only + 只跑自带测试)。
  • 映射改动是否影响 pull_request_target 调用方的安全语义 → 无(纯数据,不改控制流/权限/输入处理)。

Verdict: APPROVE — 最小、正确、org-workflow 安全面无回归,契约测试锁定映射,CI 全绿。可合并。

@Jerry-Xin Jerry-Xin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The mapping is correct, but the new contract job breaks reusable-workflow callers.

🔴 Blocking

  • 🔴 Critical — .github/workflows/workflow-sanity.yml:27: During workflow_call, actions/checkout checks out the caller repository. Most callers will not contain .github/tests, so line 40 fails with ImportError: Start directory is not importable: '.github/tests'. Gate this job to Mininglamp-OSS/.github, or explicitly check out the workflow repository and appropriate ref.

✅ Highlights

  • The octo-docs-htmlserver mapping is consistent with the existing mapping structure.
  • The contract test passes locally.
  • Adding .github/tests/** to the workflow path filters is appropriate.

@Jerry-Xin
Jerry-Xin dismissed their stale review July 17, 2026 07:40

Superseded: re-posting with repo-relative file citation (dropped an absolute local path).

@Jerry-Xin Jerry-Xin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The octo-docs-htmlserver mapping is correct and purely additive, but the new contracts job breaks every repo that consumes this reusable workflow.

🔴 Blocking

  • 🔴 Critical — .github/workflows/workflow-sanity.yml (new contracts job): workflow-sanity.yml is a reusable workflow (on: workflow_call:) that ~20 org repos call via uses: Mininglamp-OSS/.github/.github/workflows/workflow-sanity.yml@v1 (e.g. octo-web, octo-android). Under workflow_call, actions/checkout checks out the caller repo, not .github. Those callers do not have a .github/tests/ directory, so python3 -m unittest discover -s .github/tests -p 'test_*.py' fails with ImportError: Start directory is not importable: '.github/tests' (verified: exit code 1 on a repo without that dir). Once v1 is advanced to include this commit, every caller's Workflow Sanity turns red. The contracts job needs to run only for the .github repo — gate it with if: github.repository == 'Mininglamp-OSS/.github', or explicitly actions/checkout the .github repo at a fixed ref before discovering the tests. (The pre-existing no-tabs / actionlint jobs tolerate the caller tree; this new one does not.)

💬 Non-blocking

  • The new contracts job pins actions/checkout@de0fac2e... (SHA) and sets persist-credentials: false / permissions: contents: read — good.

✅ Highlights

  • Mapping change is a single additive entry; does not alter any existing repo→module mapping (no regression to other repos).
  • The contract test (test_auto_add_to_project.py) is a pure static-assertion test — no network, no subprocess beyond stdlib unittest.
  • Adding .github/tests/** to the pull_request / push path filters is appropriate.

@an9xyz
an9xyz dismissed stale reviews from lml2468, mochashanyao, and yujiawei via 5287a9b July 17, 2026 07:41
yujiawei
yujiawei previously approved these changes Jul 17, 2026

@yujiawei yujiawei left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review — PR #89 (.github)

Re-review at head 5287a9b. The blocking issue raised in the previous round (head 9f9971e) — the new contracts job breaking reusable-workflow callers — has been resolved.

Summary

This PR maps octo-docs-html to the existing server Module option in the reusable auto-add-to-project workflow, adds a Python contract test for that mapping, and wires the test suite into Workflow Sanity via a new contracts job (plus .github/tests/** path triggers). The current head additionally gates the contracts job to the central repository, fixing the caller-breakage flagged previously.

1. Spec compliance

Spec: ✅

  • Missing work: none.
    • octo-docs-html: 'server' added to REPO_MODULE, correctly placed alphabetically between octo-deployment and octo-fleet (.github/workflows/auto-add-to-project.yml:89).
    • Contract test test_octo_docs_html_maps_to_server present (.github/tests/test_auto_add_to_project.py:10).
    • New contracts job runs the suite and .github/tests/** added to both pull_request and push path filters (.github/workflows/workflow-sanity.yml:11,17,27).
  • Over-build: none of substance. Only a one-line trailing-blank-line removal at the end of auto-add-to-project.yml (cosmetic, harmless — nit below).
  • Deviation: none. The server (not web) choice is justified — octo-docs-html is a Go, API-only server, consistent with the sibling octo-fleet / octo-im / octo-server entries.

2. Code quality

Quality: Approved

Verified locally: python3 -B -m unittest discover -s .github/tests -p "test_*.py" → 2 tests, OK. CI on the head is green (No-tabs, actionlint, Workflow contracts all pass).

Previous blocker — now fixed (verified):

  • The prior round correctly identified that under workflow_call, actions/checkout checks out the caller repository, which has no .github/tests/ directory, so python3 -m unittest discover -s .github/tests would fail with ImportError for every consuming repo once v1 advanced.
  • Head 5287a9b adds if: github.repository == 'Mininglamp-OSS/.github' to the contracts job (.github/workflows/workflow-sanity.yml:29). This is the correct idiom: in a reusable-workflow run github.repository remains the top-level caller's repo, so the job runs only for .github's own pull_request / push / workflow_dispatch and is skipped for all callers. A job skipped by a job-level if is neutral (not a failure), so callers' Workflow Sanity will not turn red. The pre-existing no-tabs / actionlint jobs tolerate the caller tree; the new one now does too, via the gate.
  • A regression test (test_contract_job_only_runs_in_central_repository) locks in the presence of this gate — a good guard against the fix being silently removed.

Strengths:

  • The contracts job follows the repo's security hygiene: least-privilege permissions: contents: read, persist-credentials: false, SHA-pinned actions/checkout@de0fac2… (v6.0.2), timeout-minutes: 5, and it runs only the repo's own stdlib unittest (no network, no PR-supplied code execution).
  • The mapping test parses the live REPO_MODULE block from the workflow rather than duplicating the map, keeping it coupled to the source of truth.

Findings:

  • P2 (nit): The trailing-newline removal at the end of auto-add-to-project.yml is unrelated to this change. Non-blocking; consider keeping cosmetic churn out of feature PRs.
  • P2 (nit): The mapping test asserts only the single octo-docs-html → server entry, and the key/value regex is coupled to the single-quote + trailing-comma format. Both are appropriate for this PR's scope; if this is meant to become a general mapping contract, a follow-up could assert the full expected map (or a few critical entries) with a more tolerant parser. No action required here.

3. Overall verdict

APPROVED — Spec ✅ and Quality Approved. The previously-blocking caller-breakage is resolved and covered by a regression test; the two remaining items are non-blocking nits.

@lml2468 lml2468 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

修正:撤回上一轮 APPROVE → REQUEST_CHANGES(live head 9f9971ed)

我上一轮 APPROVE 时漏了 workflow-sanity.ymlworkflow_call reusable 这一面(我的 trigger 检查没覆盖 workflow_call)。Jerry-Xin 提的 org-wide 回归我 byte 亲核成立,公开纠正——我的 APPROVE 是不完整的审查。

🔴 P1 — 新 contracts job 会 org-wide 打红 ~13 个 caller 仓的 CI

byte 实证 4 点(live head 9f9971ed):

  1. workflow-sanity.yml 是 reusable:on: workflow_call:(:5,注释「Allow external repos to call this as a reusable workflow」)。
  2. 被组织仓库当 @v1 消费:gh api 核实 octo-server / octo-web / octo-android 的 .github/workflows/workflow-sanity.ymluses: Mininglamp-OSS/.github/.github/workflows/workflow-sanity.yml@v1(还有 ~12 个同类)。
  3. contracts job 无仓库门控:sed 核实该 job 没有 if: github.repository == 'Mininglamp-OSS/.github',无条件 checkout + 跑 python3 -m unittest discover -s .github/tests。reusable workflow_callactions/checkout 默认 checkout 的是调用方仓库,不是 .github
  4. 调用方仓库没有 .github/tests/:gh api 实测 octo-server / octo-web / octo-android / octo-cli / octo-ios 全 404unittest discover -s .github/tests 对不存在的目录报 ImportError: Start directory is not importableexit 1

后果:一旦 @v1 tag 前进到本 commit,所有没有 .github/tests/ 的 caller 仓(~13 个)的 Workflow Sanity CI 全变红——这不是本仓自测,是推给全组织的回归。两个 peer APPROVE(yujiawei / mochashanyao)漏了这条。

修法(任一):

  • contracts job 加 if: github.repository == 'Mininglamp-OSS/.github'(只在本仓跑,最简);或
  • job 内显式 actions/checkout .github(repository: Mininglamp-OSS/.github)再 discover;或
  • discover 前判 .github/tests 存在再跑(caller 无该目录则跳过)。
    建议加一条覆盖「caller 无 .github/tests 时不 fail」的验证。

映射改动本身(安全,无需改)

auto-add-to-project.yml 加一行 'octo-docs-html':'server':纯附加、不改其它 repo 映射、module name 是静态 dict key → 参数化 GraphQL(无注入)、字母序正确、值与同类 Go server 一致。契约测试本身也没问题。问题只在新 contracts job 的无门控 reusable 消费面。

我为何上轮漏了

我把 contracts job 当成「本仓 pull_request 触发的自测」审(那个视角下它确实安全),没检查 workflow-sanity.yml 同时是 workflow_call reusable、会在 caller 上下文运行。这条 org-wide blast radius 是我该在 org .github 仓优先查的,漏了。

Verdict: REQUEST_CHANGES — 未门控的 contracts job 会让 ~13 个消费 @v1 的仓库 CI 变红(caller 缺 .github/tests/ → discover ImportError)。修法明确、contained(加 if: github.repository 门控 + 验证),修好即可复审转 APPROVE。

致谢 Jerry-Xin 抓到这条 reusable-consumer 回归——我漏了 workflow_call 面。

lml2468
lml2468 previously approved these changes Jul 17, 2026

@lml2468 lml2468 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

更新:head 已推进到 5287a9bc,blocker 已修 → ✅ APPROVE(撤回我刚才的 CR)

我上一条 CR 锚在 9f9971ed(org-wide contracts job 无门控 → 会打红 ~13 个 caller 仓)。作者在 5287a9bc 已按建议修好,我 byte 复核确认,改判 APPROVE。

🔴→✅ contracts job 现已仓库门控

workflow-sanity.ymlcontracts job 加了 if: github.repository == 'Mininglamp-OSS/.github'——只在中央 .github 仓运行,caller 仓(octo-server/web/android… 经 @v1 消费)不再触发该 job,unittest discover -s .github/tests 不会在缺 .github/tests/ 的 caller 上跑 → org-wide ImportError 回归消除。

回归被钉死

新增契约测试 test_contract_job_only_runs_in_central_repository——正则抓 contracts job 体、断言含 if: github.repository == 'Mininglamp-OSS/.github',防止门控被误删。本地 python3 -m unittest discover2 tests OK

其余仍成立

  • 映射 'octo-docs-html':'server' 仍在、字母序正确、值与同类 Go server 一致(纯数据、无注入)。
  • job 仍 permissions: contents:read + checkout SHA-pin + persist-credentials:false;workflow_call/pull_request 触发面无其它风险。

Verdict: APPROVE — 我 CR 指出的未门控 reusable 消费回归已在 5287a9bc 修好(if: github.repository 门控 + 契约测试锁定),映射改动本身一直安全。可合并。

(说明:我那条 CR 与作者这次 push 撞车——CR 锚到了同一个 5287a9bc 但内容是针对修复前状态的,以本条 APPROVE 为准。)

mochashanyao
mochashanyao previously approved these changes Jul 17, 2026

@mochashanyao mochashanyao left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Octo-Q · automated review]

Verdict: Approve — no blocking findings; notes below (data-flow traced).


Code Review — PR #89 (.github)

Reviewer: Octo-Q (automated review)
Head SHA: 5287a9bccb4b001cf3c5188ca1e7f57bfadf6f34

Summary

This PR maps octo-docs-html to the server module in the auto-add-to-project workflow's REPO_MODULE lookup table, and adds a CI contract job to prevent future mapping regressions. The new contracts job in .github/workflows/workflow-sanity.yml runs Python unittests that verify both the mapping entry and the repository guard on the contracts job itself. Clean, well-scoped change with good test coverage.

Verification

Local checks at head 5287a9b:

  • python3 -m unittest discover -s .github/tests -p 'test_*.py' — pass (2 tests)

  • Regex correctness: independently verified both test regexes against the actual workflow files. REPO_MODULE regex captures all 21 mapping entries; octo-docs-html resolves to server. Contracts-job regex correctly captures the job body and stops at the next job boundary (no-tabs:).

  • CI security posture — no pull_request_target trigger; new job uses pull_request/push/workflow_call only. Global permissions: {} at workflow level, job-level contents: read. No secrets consumed by the test step.

  • Checkout hygieneactions/checkout@v6.0.2 pinned to SHA de0fac2e with version comment; persist-credentials: false.

  • Repository guardif: github.repository == 'Mininglamp-OSS/.github' ensures the contracts job only runs in the central repo (where the test files and workflow files coexist on the filesystem). Correctly prevents execution when called via workflow_call from other repos.

  • Mapping correctnessocto-docs-html inserted in alphabetical order between octo-deployment and octo-fleet, mapped to server (consistent with other backend infrastructure repos like octo-fleet, octo-im, octo-server).

  • Test design — tests parse the actual YAML files rather than duplicating data, so a mapping drift or accidental deletion will fail CI. The contracts-job test validates the repository guard is present, preventing accidental removal of the guard that would cause the job to run in fork contexts.

  • Concurrency — existing workflow-sanity-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} group with cancel-in-progress: true covers the new job correctly.

  • Path triggers.github/tests/** added to both pull_request and push path filters, ensuring the contracts job runs whenever test files change.

  • Trailing newline cleanup — removed one blank line at EOF of auto-add-to-project.yml; purely cosmetic, no functional impact.

Findings

No P0/P1 issues. No P2 issues. No correctness, security, build, or functional concerns.

Data Flow Trace

  • REPO_MODULE mapping in .github/workflows/auto-add-to-project.yml:89 — new entry 'octo-docs-html': 'server' correctly flows into the moduleName variable at line ~103 via REPO_MODULE[repoName]. When moduleName is truthy, it's used to resolve the project field option ID. Data path is complete.
  • The contracts job at .github/workflows/workflow-sanity.yml:27 reads workflow files from the checkout (via actions/checkout), passes them to python3 -m unittest discover. Test files read from .github/tests/ on disk. Data flow: checkout → filesystem → Path.read_text() → regex parse → assertion. Complete and correct.

Blind Spot Checklist (C1–C6)

  • C1 (dual-path parity): N/A — no symmetric add/remove paths changed.
  • C2 (control-flow ordering): N/A — no reused logic across multiple call sites.
  • C3 (authorization boundary): N/A — no new endpoints or tool exposure.
  • C4 (authorization lifecycle): N/A — no auth changes.
  • C5 (build/runtime divergence): Clear — python3 -m unittest runs identically in CI (ubuntu-24.04) and locally. Verified locally.
  • C6 (governance/policy): N/A — no policy or governance documents changed.

Cross-round Blocker Recheck (R6)

N/A — first review of this PR.

Verdict: APPROVED

Straightforward mapping addition with well-designed regression tests and a properly secured CI job. All GitHub Actions security best practices are followed. No concerns.

[Octo-Q] verdict: APPROVE — no P0/P1/P2 findings; mapping is correct, CI job is properly guarded, tests are well-designed and pass locally.

@Jerry-Xin
Jerry-Xin dismissed their stale review July 17, 2026 07:47

Fixed at head 5287a9b: the contracts job is now gated with if: github.repository == 'Mininglamp-OSS/.github', so reusable workflow_call consumers no longer run the caller-breaking discover. Re-anchoring APPROVE at the live head.

Jerry-Xin
Jerry-Xin previously approved these changes Jul 17, 2026

@Jerry-Xin Jerry-Xin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary: The org-wide regression is fixed exactly as prescribed — the contracts job is now gated to run only in the central repo, so reusable workflow_call consumers are no longer broken. Approving.

✅ Highlights (blocker resolved — byte-verified at this head)

  • contracts job gated to the central repo. .github/workflows/workflow-sanity.yml now carries if: github.repository == 'Mininglamp-OSS/.github' on the contracts job. In a reusable workflow_call invocation github.repository is the caller's repo, so for the ~15 repos that consume this workflow via @v1, the if evaluates false and the job is skipped — it no longer checks out the caller and runs unittest discover -s .github/tests against a directory those repos don't have. The prior fail-path (caller CI going red once @v1 advances) is closed.
  • Only contracts needed gating, and only it was gated. The sibling no-tabs / actionlint jobs run generic linters over workflow files that every caller has, so they don't depend on .github/tests/ and are safe under workflow_call unchanged.
  • Regression-proof. The added test_contract_job_only_runs_in_central_repository asserts the if: github.repository == 'Mininglamp-OSS/.github' guard is present on the contracts job, so the gate can't be silently dropped later.
  • Mapping change remains clean & additive. octo-docs-html → server in the REPO_MODULE map is pure data (parameterized GraphQL, no shell/injection), correctly alphabetized, value matches siblings; the reusable's pull_request_target risk surface is untouched. SHA-pinned actions, permissions: {}, no secret/infra leak.

No blocking items remain.

@an9xyz
an9xyz dismissed stale reviews from Jerry-Xin, mochashanyao, lml2468, and yujiawei via 8f56626 July 17, 2026 07:50

@lml2468 lml2468 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-review at head 8f56626a — ✅ APPROVE(重锚)

新 commit 8f56626a(docs(ci): explain central contract job guard)相对我上轮 APPROVE 的 5287a9bc 只加了一行注释:

+    # Reusable callers check out their own repository, which has no central tests.
     if: github.repository == 'Mininglamp-OSS/.github'

byte 核实 delta = 纯文档说明,无行为改动:

  • contracts job 的仓库门控 if: github.repository == 'Mininglamp-OSS/.github' 仍在(workflow-sanity.yml:30)——org-wide 回归依然被挡(reusable caller 上 if 判 false → job 跳过,不在缺 .github/tests/ 的 caller 仓跑 discover)。
  • 映射 'octo-docs-html':'server' 仍在;契约测试(含 test_contract_job_only_runs_in_central_repository 门控断言)本地 python3 -m unittest discover2 tests OK
  • 那行注释正好把「为何需要这个 guard」写进代码旁,提升可维护性,是好补充。

我上轮在 5287a9bc 的 APPROVE 理由全部继续成立(门控修复 + 回归测试 + 映射纯数据无注入 + SHA-pin + permissions 最小)。本 commit 未触碰任何安全面。

Verdict: APPROVE — 仅新增解释性注释,门控/映射/契约测试均不变且验证通过。可合并。

@mochashanyao mochashanyao left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[Octo-Q · automated review]

Verdict: Approve — no blocking findings; notes below (data-flow traced).


Code Review — PR #89 (.github)

Reviewer: Octo-Q (automated review)
Head SHA: 8f56626a2b777304a9349b9bf057cb8ec0f2d4f1

Summary

This PR adds octo-docs-html to the REPO_MODULE mapping table in the reusable auto-add-to-project workflow, assigning it to the server module. It introduces a new contracts job in the workflow-sanity pipeline that runs contract tests validating the mapping, and extends the sanity workflow's path triggers to include .github/tests/**. A trailing blank line in auto-add-to-project.yml is cleaned up. The changes are minimal, well-structured, and follow existing conventions.

Verification

Static analysis only at head 8f56626a2b777304a9349b9bf057cb8ec0f2d4f1; build and tests not executed in this environment.

  • Mapping correctnessocto-docs-html is a Go repository (confirmed via GitHub API), consistent with other server-mapped repos (octo-server, octo-fleet, octo-im). The PR's claim of "API-only Go server" holds.
  • Alphabetical insertionocto-docs-html placed between octo-deployment and octo-fleet — correct lexicographic order.
  • Column alignment — New entry 'octo-docs-html': 'server' (17-char key + 8 spaces = 25 chars before value) matches the existing alignment convention used by all other entries.
  • Test regex #1 (mapping)r"const REPO_MODULE = \{(?P<body>.*?)^\s*\};" with MULTILINE|DOTALL correctly captures the JS object block; inner r"^\s*'([^']+)':\s*'([^']+)',\s*$" correctly extracts key-value pairs from the single-quoted format used in the file.
  • Test regex #2 (contracts guard)r"^ contracts:\n(?P<body>.*?)(?=^ [a-z][a-z0-9-]*:\n)" correctly matches from contracts: to the lookahead at no-tabs:. The if: assertion string matches the actual YAML.
  • contracts job guardif: github.repository == 'Mininglamp-OSS/.github' correctly restricts the job to the central repo, preventing execution when called as a reusable workflow from child repos.
  • Permissionscontents: read is minimal and appropriate for a test-only job.
  • Checkout SHA pinningactions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 matches the version used by no-tabs and actionlint jobs in the same file.
  • Path triggers.github/tests/** added to both pull_request and push trigger paths — consistent with existing .github/workflows/** and .github/actions/** entries.
  • Concurrency — The new contracts job inherits the existing concurrency group; no conflict with no-tabs or actionlint.

Findings

No P0/P1 issues. One P2 observation and one nit below.

P2 — Test regex fragile to job reordering (.github/tests/test_auto_add_to_project.py:29)

The test_contract_job_only_runs_in_central_repository regex uses (?=^ [a-z][a-z0-9-]*:\n) as a lookahead to terminate the contracts job body capture. This requires a subsequent job header to exist after contracts. If contracts were ever moved to be the last job in the file, the lookahead would never match and the test would falsely report "contracts job is missing". Not a correctness bug today (since no-tabs follows), but worth either using end-of-file as an alternative terminator or adding a comment noting the ordering dependency.

Nit — Trailing newline removal (auto-add-to-project.yml:320)

The diff removes a trailing blank line at the end of the file. Cosmetic cleanup — fine.

Data-Flow Trace

  • REPO_MODULE[repoName] lookup at runtime consumes github.event.repository.name via process.env.REPO_NAME. When a PR/issue originates from octo-docs-html, the name resolves to "octo-docs-html", which now maps to "server". The downstream GraphQL field-resolution logic is unchanged by this PR (pre-existing path).
  • The contracts job reads the workflow YAML file from disk at CI time via WORKFLOW.read_text() and SANITY_WORKFLOW.read_text(). The regex extraction operates on the file as checked out, which is the HEAD of the PR branch or main — the data flows correctly from source file to test assertion.

Blind-Spot Checklist

  • C1 (dual-path parity): N/A — no symmetric add/remove or subscribe/unsubscribe paths.
  • C2 (control-flow ordering): N/A — mapping is a flat lookup table, no ordering-dependent control flow.
  • C3 (authorization boundary): N/A — no auth/permission changes beyond contents: read on the test job.
  • C4 (authorization lifecycle): N/A.
  • C5 (build/runtime parity): Clear — the python3 -m unittest discover command matches the PR's documented test command. The actions/checkout SHA is pinned and matches sibling jobs.
  • C6 (governance/docs self-consistency): N/A — CI-only change, no governance docs affected.

Cross-Round Blocker Recheck (R6)

N/A — first review of this PR.

Verdict: APPROVED

Clean, well-scoped CI change. The mapping addition is correct (Go server → server module), the contract tests validate the mapping and the central-repo guard, and the workflow-sanity integration follows existing conventions. The P2 regex fragility is a minor maintainability note, not a blocker.

[Octo-Q] verdict: APPROVE — No P0/P1 issues. Mapping is correct, tests validate the contract, CI integration follows conventions. Only a minor P2 regex fragility observation.

@Jerry-Xin Jerry-Xin left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Summary: Re-anchoring APPROVE at the live head — the only change since my prior approval is an explanatory comment above the repository gate; the fix and mapping are unchanged and correct.

✅ Highlights

  • Gate intact + now documented. The contracts job retains if: github.repository == 'Mininglamp-OSS/.github', and the new commit only adds a clarifying comment ("Reusable callers check out their own repository, which has no central tests.") explaining why the guard exists. No logic change — the org-wide workflow_call regression stays closed (caller repos skip the job that would unittest discover -s .github/tests against a directory they lack).
  • Regression-proofed: the contract test asserting the gate is present remains.
  • Mapping change unchanged & clean: octo-docs-html → server is pure data (parameterized GraphQL, no injection), correctly alphabetized, SHA-pinned actions, permissions: {}, no secret/infra leak.

No blocking items.

@yujiawei yujiawei left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review — PR #89 (.github)

Reviewed at head SHA 8f56626a2b777304a9349b9bf057cb8ec0f2d4f1.

Summary

Small, well-scoped CI change with three parts:

  1. Map octo-docs-htmlserver in the REPO_MODULE table of the reusable auto-add-to-project.yml.
  2. Add a Python contract test (.github/tests/test_auto_add_to_project.py) asserting the mapping and the guard below.
  3. Add a contracts job to workflow-sanity.yml, guarded so it only runs in the central .github repository, and extend the sanity triggers to .github/tests/**.

Spec compliance

  • Missing: none. All three stated goals are implemented.
  • Over-build: none functional. One unrelated cleanup (removal of a trailing blank line at the end of auto-add-to-project.yml) is outside the PR's stated scope but is harmless.
  • Deviation: none.

Correctness

  • Module classification is correct. octo-docs-html is a single static Go binary backed by PostgreSQL exposing a versioned /v1 HTTP API (per its cmd/ + internal/ + migrations/ layout and README). Mapping it to server matches its siblings (octo-server, octo-im, octo-fleet). The web bucket would be the wrong fit despite the "docs-html" name.
  • The reusable-workflow guard is necessary and correct. In a workflow invoked via workflow_call, github.repository resolves to the caller's repository. So if: github.repository == 'Mininglamp-OSS/.github' skips the contracts job for the 20+ downstream callers of this reusable workflow — which is exactly right, since a caller's checkout would not contain .github/tests/, and unittest discover would otherwise fail there. Running the tests against the central repo only is the intended behavior. The added test that asserts this guard exists is a sensible regression lock.
  • Trigger extension is right. Adding .github/tests/** to the pull_request/push path filters only affects the central repo's own triggering (path filters don't apply to workflow_call), so edits to the contract tests now correctly (re)run the sanity workflow.
  • Mapping insertion keeps the table alphabetically ordered and preserves formatting.

Security

  • Workflow-level permissions: {} with the contracts job scoped to contents: read; persist-credentials: false on checkout; action pinned by SHA. No secrets required for the contract job. Clean.

Verification performed

  • Ran the contract suite at head SHA: both tests pass (Ran 2 tests ... OK).
  • Validated both modified workflow files parse as YAML.
  • Confirmed octo-docs-html role via its repository structure and README.
  • Confirmed the reusable workflow is called by many downstream repos, validating the guard's rationale.

Nits (non-blocking)

  • The trailing-newline removal at the end of auto-add-to-project.yml is unrelated to the mapping change; fine to keep, just noting the scope.

Coverage note

This review is a single independent pass over the full diff plus the surrounding workflow context and the target repo's role. No areas were left unexamined for a change of this size; the load-bearing element (the reusable-workflow guard) was traced against workflow_call semantics rather than taken on faith.

Verdict

No blocking (P0/P1) issues. Correct, tested, and safe.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants