Skip to content

docs(filter): document the secret-path gate in the architecture and FAQ pages - #1787

Merged
lizhengfeng101 merged 2 commits into
alibaba:mainfrom
SU-AN-coder:docs/secret-gate-in-filter-docs
Nov 25, 2026
Merged

lizhengfeng101 merged 2 commits into
alibaba:mainfrom
SU-AN-coder:docs/secret-gate-in-filter-docs

Conversation

@SU-AN-coder

Copy link
Copy Markdown
Contributor

Description

The built-in secret-path gate (#1262) is the second gate of the file filter, and secret_exclude is one of the reasons whyExcluded returns for a file it drops. Three pages describe that filter, and only one of them carried the gate:

page before after
review-rules.md (all 5 locales) gate 2 of six, plus a "Built-in secret paths" section unchanged
architecture.md (all 5 locales) heading "The five-gate file filter", diagram label 5-gate filter, ordered list of 5 gates, reason inventory of 4 — secret_exclude never named six gates, gate 2 added, reason named
faq.md (all 5 locales) exclusion-reason table with 7 rows, no secret_exclude row 8 rows

So the pages contradicted each other: a reader of the review-rules guide saw six gates, and a reader of the architecture page saw five.

The FAQ table is the reference a user reaches for after seeing a reason in output. ocr review --preview prints lines such as (excluded: user_exclude), and every other reason the filter reports has a row explaining what to do about it — including binary, provider_directory and too_large, which also need no action. secret_exclude was the one reason with no row and no fix, in all five locales.

The gap, enumerated

Before the change (script comparing internal/model/preview.go, internal/agent/selection.go and the five locale pages):

internal/model/preview.go: 8 ExcludeReason constants (non-empty)
internal/agent/selection.go whyExcluded returns 5 of them: binary, secret_exclude, user_exclude, unsupported_ext, default_path

en: faq rows=7 missing=['secret_exclude'] | diagram=5-gate list_steps=5 arch_missing=['secret_exclude']
zh: faq rows=7 missing=['secret_exclude'] | diagram=5-gate list_steps=5 arch_missing=['secret_exclude']
ja: faq rows=7 missing=['secret_exclude'] | diagram=5-gate list_steps=5 arch_missing=['secret_exclude']
ko: faq rows=7 missing=['secret_exclude'] | diagram=5-gate list_steps=5 arch_missing=['secret_exclude']
ru: faq rows=7 missing=['secret_exclude'] | diagram=5-gate list_steps=5 arch_missing=['secret_exclude']

After:

en: faq rows=8 missing=none | diagram=6-gate list_steps=6 arch_missing=none
zh: faq rows=8 missing=none | diagram=6-gate list_steps=6 arch_missing=none
ja: faq rows=8 missing=none | diagram=6-gate list_steps=6 arch_missing=none
ko: faq rows=8 missing=none | diagram=6-gate list_steps=6 arch_missing=none
ru: faq rows=8 missing=none | diagram=6-gate list_steps=6 arch_missing=none

What changed

  • architecture.md, all five locales: the heading and the pipeline diagram's gate count move to six gates, the reason inventory gains secret_exclude, and the ordered gate list gains it as step 2 with the later steps renumbered. The new step states the same two facts the review-rules guide already states about this gate — it runs on either path, and no include rule can bring the file back.
  • faq.md, all five locales: one row, inserted next to binary so the table keeps gate order. It carries a "nothing to do" fix and names the built-in secret paths, like the provider_directory row does.
  • internal/model/exclude_reason_docs_test.go: the guard (new file, test only).

No production code changed: preview.go, selection.go, secret_path.go and every rule document are untouched.

The guard

TestFAQDocumentsEveryExcludeReason and TestArchitectureGateListNamesEveryFilterReason derive their expectations from the code instead of restating them:

  • the reason inventory is read out of the ExcludeReason constant declarations in internal/model/preview.go, because Go cannot enumerate constants and a second hand-maintained list would be a second thing to forget;
  • the reasons the filter actually returns are read out of whyExcluded in internal/agent/selection.go;
  • the FAQ table is parsed from its binary row to the end of the contiguous table block, so both directions are asserted — every declared reason is listed, and no row lists something that is not a reason — without depending on translated headings;
  • the architecture page must name every reason whyExcluded returns, and its diagram label's gate count must equal the length of its own ordered list, whose steps must number 1..N.

Relative wording is not asserted, so a translation stays free.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Refactoring (no functional changes)
  • Documentation update
  • CI / Build / Tooling

How Has This Been Tested?

  • make test passes locally
  • Manual testing (describe below)

The guard fails on the pre-change pages and passes afterwards. Reverting only the doc edits from the same commit, in the working tree:

$ git checkout upstream/main -- pages/src/content/docs
$ go test ./internal/model/ -run 'TestFAQDocumentsEveryExcludeReason|TestArchitectureGateListNamesEveryFilterReason' -count=1
--- FAIL: TestFAQDocumentsEveryExcludeReason (0.00s)
    --- FAIL: TestFAQDocumentsEveryExcludeReason/en (0.00s)
        exclude_reason_docs_test.go:157: en/faq.md: exclusion reason "secret_exclude" (ExcludeSecret) has no table row
    ... the same for zh, ja, ko, ru
--- FAIL: TestArchitectureGateListNamesEveryFilterReason (0.00s)
    --- FAIL: TestArchitectureGateListNamesEveryFilterReason/en (0.00s)
        exclude_reason_docs_test.go:226: en/architecture.md: whyExcluded can return "secret_exclude", but the page never names it
    ... the same for zh, ja, ko, ru
FAIL	github.com/alibaba/open-code-review/internal/model	0.023s

$ git checkout HEAD -- pages/src/content/docs
$ go test ./internal/model/ -count=1
ok  	github.com/alibaba/open-code-review/internal/model	0.025s

Gates on the pushed commit (efd0419):

$ make check
All source files have valid license headers.
No unapproved non-English text in 795 scanned source files.
go mod tidy
gofmt -s -w .
LC_ALL=C go vet ... (25 packages, no findings)
check passed

$ go test -race -count=1 ./...
ok  	github.com/alibaba/open-code-review/cmd/opencodereview
ok  	github.com/alibaba/open-code-review/internal/agent
... all 25 packages ok, EXIT=0

One test in that sweep is timing-sensitive: TestBoundaryKeepsTruncationCorrectionWhenRecallIsCancelled (internal/llm/retry_boundary_test.go) failed once under the load of the full suite with attempt 1 = error cancelled/context, want error network/response_decode kept through the cancellation. It is unrelated to this change (I touch no Go production code), it passes on the immediate rerun of the full suite, and it passes three times in a row with -race when run alone. Flagging it in case it is a known flake.

The docs guardrail for translations was run as well, and all five locales are edited symmetrically:

$ node scripts/github-actions/check-translation-sync.test.js
All check-translation-sync tests passed.
$ node scripts/github-actions/check-translation-sync.js readmes
README translation structure check passed: all 5 README files share the same ## section structure.
$ node scripts/github-actions/check-translation-sync.js docs
Docs translation-sync check: no en-only documentation changes detected.

Checklist

  • My code follows the project's coding style (go fmt, go vet)
  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or my feature works
  • New and existing unit tests pass locally with my changes
  • I have updated the documentation accordingly (if applicable)
  • I have signed the CLA
  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

AI/LLM disclosure: the doc edits and the guard test were drafted by an AI coding assistant (Hermes Agent, model deepseek-v4-flash). The account owner read the entire diff line by line, independently re-ran the enumeration, the revert/restore verification and the gates quoted above, and is responsible for the content. Commits are not attributed to the tool.

CLA: the license/cla check reports it as signed for this account.

Related Issues

No issue: the gap was found by comparing the three pages that describe the filter against selection.go, not from a report. Happy to file a documentation issue if you would rather have this tracked that way before merge.

Relative to the open #1785 (pattern → rule table on review-rules.md) and #1541 (default exclude list on the same page): both edit review-rules.md sections this PR does not touch. This PR changes architecture.md and faq.md only.

…AQ pages

The built-in secret-path gate is the second gate of the file filter, and
`secret_exclude` is one of the reasons `whyExcluded` returns for a file it
drops. review-rules.md documents it, but the two other pages that describe
the same filter did not: architecture.md still said the filter had five
gates and never named the reason, and the FAQ's exclusion-reason table —
the table a user reaches for after seeing `(excluded: secret_exclude)` in
`--preview` output — had no row for it, in all five locales.

Add the gate to the ordered list and the reason to the reason inventory in
architecture.md, add the FAQ row, and bump the pipeline diagram's gate
count, in all five locales. The mermaid label keeps its wording and only
its count and drop list change.

internal/model/exclude_reason_docs_test.go is the guard: it reads the
reason constants out of preview.go and the reasons whyExcluded returns out
of selection.go, then asserts every one of them is documented by the FAQ
table and named by the architecture page in every locale, and that the
diagram's gate count matches the page's own ordered list.
@github-actions

Copy link
Copy Markdown
Contributor

✅ OpenCodeReview: Review skipped: no items were selected.

@NanaseInori NanaseInori 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.

Reviewed the complete eleven-file diff, the pinned whyExcluded implementation and the discussion. The secret-gate search found no competing documentation fix; #1244 concerns the earlier runtime implementation, while #1785 documents the separate rule-mapping table.

The new order matches the code: binary first, then either old or new secret path, before user exclusion/inclusion. The five locale changes consistently add the missing reason and sixth step. The test guard checks missing/stale FAQ reasons and diagram/list consistency without asserting translated prose. It fails visibly when its source/function anchors disappear, and introduces no production behavior change. No blocking defect found.

The scope is selection, not a general data-loss-prevention boundary: these pages should not be read as promising that runtime file-reading tools can never access an excluded path. That existing runtime policy is unchanged by this documentation PR.

Validation was complete patch and supporting-source inspection. I did not independently execute the documentation guards, translation checks, or full race suite, and do not infer a fresh CI pass from the contributor's reported rerun.

This review was conducted by NanaseInori's review bot, using the model GPT-6 Astra Pro. If you need a human review, please manually @NanaseInori.

@SU-AN-coder

Copy link
Copy Markdown
Contributor Author

NanaseInori approved this diff on 2026-11-10 and its remaining findings are closed; the head has not moved since (efd0419), so the only gate left is a human approval. If you would rather take it in pieces, say which section and I will split it out.

@Qiyuanqiii Qiyuanqiii 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.

Thanks for your feedback. We have a large PR backlog and need some time for triage. I’ll discuss this PR with others later. If there are any further concerns, we will reply at the bottom of this PR.

@lizhengfeng101 lizhengfeng101 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.

LGTM

@lizhengfeng101
lizhengfeng101 merged commit 7ea9c52 into alibaba:main Nov 25, 2026
8 checks passed
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.

4 participants