Skip to content

docs(storage): generate connector docs from runtime descriptor catalog - #507

Merged
AptS-1547 merged 2 commits into
masterfrom
docs/473-storage-connector-facts
Aug 9, 2026
Merged

docs(storage): generate connector docs from runtime descriptor catalog#507
AptS-1547 merged 2 commits into
masterfrom
docs/473-storage-connector-facts

Conversation

@AptS-1547

@AptS-1547 AptS-1547 commented Aug 9, 2026

Copy link
Copy Markdown
Member

Summary

  • treat the authenticated built-in StorageConnector descriptor and localization catalog as the canonical connector facts
  • add tests/storage_connector_docs.rs as an integration-test projection tool, keeping documentation generation out of production modules
  • commit a machine-readable connector manifest and generate the backend index, policy catalog, and capability matrix from it in both locales
  • build the documentation sidebar from the manifest instead of another hand-maintained backend list
  • document canonical exhaustive entry points versus stable contextual examples
  • add make storage-docs, make storage-docs-check, and a docs CI drift check
  • correct the shared object-storage capacity claim exposed by the generated matrix and cover the built-in capacity split with a unit test
  • update credential-at-rest documentation for the connector credential migration

Boundary

The generator calls the same authenticated admin descriptor/localization APIs used by the frontend. It does not expose the private registry, add a production documentation module, or define a parallel runtime capability type. Only tutorial slugs and short provider-owned “best for” summaries remain curated in the test projection.

Validation

  • ASTER_UPDATE_STORAGE_CONNECTOR_DOCS=1 cargo test --test storage_connector_docs generated_storage_connector_docs_are_current -- --exact --nocapture
  • make storage-docs-check
  • cargo test --lib storage::connectors (38 passed)
  • cargo fmt --all -- --check
  • cd docs && bun run docs:build (163 pages, links valid)
  • cd docs && bun run developer-docs:build (414 pages, links valid)
  • git diff --check

Closes #473

Summary by CodeRabbit

  • 新功能

    • 存储后端目录、侧边栏、策略目录和能力矩阵现由连接器信息自动生成,内容更完整。
    • 新增 SFTP 与远程节点的文档入口,并展示连接器 ID、部署范围、凭据模式及适用场景。
    • 明确各存储后端的容量探测支持范围。
  • 文档

    • 更新中英文存储配置、凭据加密、密钥变更影响及教程说明。
    • 新增文档生成与一致性检查流程,减少页面信息不同步。

- Add `tests/storage_connector_docs.rs` integration test that reads
  authenticated built-in connector descriptor and localization APIs,
  then projects facts into committed artifacts
- Add `docs/generated/storage-connectors.json` manifest with full
  capability, credential mode, and upload workflow data for 8 connectors
- Replace hand-maintained backend tables in storage-backends index,
  storage-policies catalog, and storage-matrix with marker-bounded
  generated blocks (`storage-connectors:*:start/end`)
- Drive `docs/astro.config.mts` storage-backend sidebar from manifest
  instead of a duplicate static list
- Add `make storage-docs` (regenerate) and `make storage-docs-check`
  (drift check) targets; wire both into CI via `docs-check.yml`
- Fix object-storage connector `capacity: false` — S3, OSS, COS, and
  Azure Blob data-plane APIs expose no portable remaining-capacity
  contract; add unit test asserting capacity claims per connector
- Add `built_in_connector_capacity_claims_match_runtime_probe_support`
  unit test in `src/storage/connectors/tests.rs`
- Expand `storage_credential_secret_key` docs to cover all
  static-secret connectors now encrypted at rest, not only OneDrive
- Update contributor docs (en + zh-CN) with new authoring workflow and
  non-exhaustive-example rule for contextual provider mentions
@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@AptS-1547, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 51 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d399589f-a402-4af5-8b50-e16d0370dbb5

📥 Commits

Reviewing files that changed from the base of the PR and between 02d2827 and 4ebde1c.

📒 Files selected for processing (4)
  • .github/workflows/docs-check.yml
  • Makefile
  • src/storage/connectors/tests.rs
  • tests/storage_connector_docs.rs
📝 Walkthrough

Walkthrough

该变更以运行时连接器描述符和本地化数据生成存储文档产物。新增 manifest、能力矩阵、策略目录和动态侧边栏。新增 Make targets、CI 校验及中英文维护规则。

Changes

存储连接器文档事实投影

Layer / File(s) Summary
运行时容量能力契约
crates/aster_drive_storage/src/connector_descriptor.rs, src/storage/connectors/tests.rs
对象存储连接器不再声明容量探测能力。测试验证各内置连接器的容量能力声明。
文档清单与生成器
tests/storage_connector_docs.rs, Makefile
新增测试模块,从管理 API 获取描述符和本地化数据,生成并校验 manifest、索引、策略目录及能力矩阵。新增 storage-docsstorage-docs-check targets。
文档产物与侧边栏集成
docs/astro.config.mts, docs/src/content/docs/admin/..., docs/src/content/docs/en/admin/..., docs/src/content/docs/reference/..., docs/src/content/docs/en/reference/...
中英文文档改用连接器目录和生成标记。Astro 侧边栏从 manifest 动态生成。能力矩阵和凭据说明同步更新。
CI 与维护规则
.github/workflows/docs-check.yml, developer-docs/en/..., developer-docs/zh-CN/...
CI 在相关源码变更时运行 make storage-docs-check。贡献指南和设计契约规定文档生成、更新及漂移检查流程。

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

Sequence Diagram(s)

sequenceDiagram
  participant storage_connector_docs_test
  participant AdminStorageApi
  participant GeneratedDocs
  participant AstroSidebar
  participant storage_docs_check
  storage_connector_docs_test->>AdminStorageApi: 获取连接器描述符和本地化数据
  AdminStorageApi-->>storage_connector_docs_test: 返回连接器身份与能力事实
  storage_connector_docs_test->>GeneratedDocs: 生成 manifest、索引、矩阵和策略目录
  AstroSidebar->>GeneratedDocs: 读取 storage-connectors.json
  GeneratedDocs-->>AstroSidebar: 返回动态侧边栏条目
  storage_docs_check->>GeneratedDocs: 校验提交产物不存在漂移
Loading

Possibly related PRs

Suggested labels: Documentation, Enhancement, Rust, Storage Driver

Poem

描述符落笔,清单成形,
矩阵与侧边栏不再各自漂移。
CI 持尺,检查每一行事实,
连接器来时,文档自动跟上。
手工重复?退场。

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 17.39% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Linked Issues check ❓ Inconclusive PR 覆盖集中事实源、生成文档、漂移检查和非穷举示例等目标,但核心清单被过滤,无法直接核验其内容。 请提供 docs/generated/storage-connectors.json 的可审查内容,或解除 !/generated/ 过滤后重新验证清单与生成文档的一致性。
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 标题准确概括了本次变更的核心:从运行时 descriptor catalog 生成存储连接器文档。
Description check ✅ Passed 描述包含变更摘要、边界和详细验证命令,基本覆盖模板要求;虽未使用 Test plan 和 Notes for reviewers 标题,但验证信息完整。
Out of Scope Changes check ✅ Passed 所有代码和文档变更均服务于 #473,包括连接器事实集中化、生成文档、CI 校验及能力声明修正。
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/473-storage-connector-facts

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 3

🧹 Nitpick comments (3)
src/storage/connectors/tests.rs (1)

626-650: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

建议让容量断言覆盖全部注册 connector。

当前两个列表是手写的。新增内置 connector 时,测试不会失败,容量声明也不会被检查。可以先从 registry().descriptors() 取全集,再断言两个列表的并集等于全集。

这样以后加 connector 才不会偷偷漏掉。

♻️ 建议的补充断言
 fn built_in_connector_capacity_claims_match_runtime_probe_support() {
-    for connector_id in [
+    let with_capacity = [
         LocalConnector::ID,
         OneDriveConnector::ID,
         RemoteConnector::ID,
-    ] {
+    ];
+    let without_capacity = [
+        S3Connector::ID,
+        AlibabaOssConnector::ID,
+        AzureBlobConnector::ID,
+        TencentCosConnector::ID,
+        SftpConnector::ID,
+    ];
+    assert_eq!(
+        registry().descriptors().count(),
+        with_capacity.len() + without_capacity.len(),
+        "new built-in connector must declare its capacity support in this test"
+    );
+    for connector_id in with_capacity {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/storage/connectors/tests.rs` around lines 626 - 650, Update
built_in_connector_capacity_claims_match_runtime_probe_support to derive the
registered connector IDs from registry().descriptors() and verify the positive
and negative capacity lists form a complete, non-overlapping partition of that
registry. Keep the existing expected capacity assertions while adding coverage
that fails when a newly registered connector is omitted.
tests/storage_connector_docs.rs (2)

544-572: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

重复标记检查只覆盖了结束标记之后的区域。

assert!end + end_marker.len() 开始搜索 start_marker。如果同一页在生成块内部又出现一个 start_marker,检查不会触发,内容会被静默吞掉。建议在整篇文档里统计标记出现次数。

顺手补一下,成本只有两行。

♻️ 建议改为全文计数
-    assert!(
-        current[end + end_marker.len()..]
-            .find(start_marker)
-            .is_none(),
-        "{} contains duplicate marker {start_marker}",
-        path.display()
-    );
+    assert_eq!(
+        current.matches(start_marker).count(),
+        1,
+        "{} must contain exactly one {start_marker}",
+        path.display()
+    );
+    assert_eq!(
+        current.matches(end_marker).count(),
+        1,
+        "{} must contain exactly one {end_marker}",
+        path.display()
+    );
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/storage_connector_docs.rs` around lines 544 - 572, 更新
replace_generated_block 中的重复 start_marker 校验,改为统计整篇 current 文档中的 start_marker
出现次数并要求仅出现一次,覆盖生成块内部及其后的重复标记;保留现有缺失标记和替换逻辑不变。

69-118: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff

教程 slug 与“适合场景”硬编码在测试文件里。

PRESENTATIONS 是 provider-owned 文档元数据,却和生成器逻辑放在同一个测试文件中。文档贡献者要改一句“适合场景”,就必须改 Rust 测试。可以考虑把这份表拆成一个受审查的数据文件(例如 docs/generated/ 同级的 TOML/JSON 输入),生成器只负责读取。

不着急,等 connector 再多几个的时候一定会痒。

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/storage_connector_docs.rs` around lines 69 - 118, 将
ConnectorDocumentationPresentation 表从测试文件中的 PRESENTATIONS 常量移出,放入受审查的 TOML/JSON
文档数据文件中;更新文档生成逻辑以读取该数据源,并保留现有 connector_id、tutorial_slug 及中英文 best_for
内容和生成结果不变。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/docs-check.yml:
- Line 34: 在 docs-check 工作流的 actions/checkout 步骤中设置 persist-credentials:
false,关闭 GITHUB_TOKEN 的凭据持久化;保留现有只读检出行为不变。

In `@docs/src/content/docs/en/reference/storage-matrix.md`:
- Line 27: Update the English authentication documentation section for
[auth].storage_credential_secret_key to state that losing the key makes OneDrive
old refresh tokens unrecoverable and requires reauthorization. The anchor
docs/src/content/docs/en/reference/storage-matrix.md:27 and sibling
docs/src/content/docs/reference/storage-matrix.md:27 require no direct changes;
they already describe the encryption and key-preservation behavior.

In `@Makefile`:
- Around line 143-145: Update the storage-docs-check target to explicitly unset
ASTER_UPDATE_STORAGE_CONNECTOR_DOCS when invoking the
generated_storage_connector_docs_are_current test, ensuring inherited
environment variables cannot trigger assert_or_update to rewrite manifests or
documentation. Preserve the target’s existing exact test behavior.

---

Nitpick comments:
In `@src/storage/connectors/tests.rs`:
- Around line 626-650: Update
built_in_connector_capacity_claims_match_runtime_probe_support to derive the
registered connector IDs from registry().descriptors() and verify the positive
and negative capacity lists form a complete, non-overlapping partition of that
registry. Keep the existing expected capacity assertions while adding coverage
that fails when a newly registered connector is omitted.

In `@tests/storage_connector_docs.rs`:
- Around line 544-572: 更新 replace_generated_block 中的重复 start_marker 校验,改为统计整篇
current 文档中的 start_marker 出现次数并要求仅出现一次,覆盖生成块内部及其后的重复标记;保留现有缺失标记和替换逻辑不变。
- Around line 69-118: 将 ConnectorDocumentationPresentation 表从测试文件中的
PRESENTATIONS 常量移出,放入受审查的 TOML/JSON 文档数据文件中;更新文档生成逻辑以读取该数据源,并保留现有
connector_id、tutorial_slug 及中英文 best_for 内容和生成结果不变。
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0accf27b-651d-4c3a-97a9-fae3dc4dcd37

📥 Commits

Reviewing files that changed from the base of the PR and between d8905b2 and 02d2827.

⛔ Files ignored due to path filters (1)
  • docs/generated/storage-connectors.json is excluded by !**/generated/**
📒 Files selected for processing (21)
  • .github/workflows/docs-check.yml
  • Makefile
  • crates/aster_drive_storage/src/connector_descriptor.rs
  • developer-docs/en/contributing/documentation.md
  • developer-docs/en/design/storage-descriptor-normalization-contract.md
  • developer-docs/zh-CN/contributing/documentation.md
  • developer-docs/zh-CN/contributing/task-routing.md
  • developer-docs/zh-CN/design/storage-descriptor-normalization-contract.md
  • docs/astro.config.mts
  • docs/src/content/docs/admin/storage-backends/index.md
  • docs/src/content/docs/admin/storage-policies.md
  • docs/src/content/docs/en/admin/storage-backends/index.md
  • docs/src/content/docs/en/admin/storage-policies.md
  • docs/src/content/docs/en/reference/config/auth.md
  • docs/src/content/docs/en/reference/index.md
  • docs/src/content/docs/en/reference/storage-matrix.md
  • docs/src/content/docs/reference/config/auth.md
  • docs/src/content/docs/reference/index.md
  • docs/src/content/docs/reference/storage-matrix.md
  • src/storage/connectors/tests.rs
  • tests/storage_connector_docs.rs

Comment thread .github/workflows/docs-check.yml
Comment thread docs/src/content/docs/en/reference/storage-matrix.md
Comment thread Makefile
- Add `persist-credentials: false` to the docs-check workflow checkout step
- Unset `ASTER_UPDATE_STORAGE_CONNECTOR_DOCS` in `storage-docs-check` to prevent accidental doc regeneration during verification
- Refactor capacity claims test to assert all built-in connectors are covered exactly once, catching any newly added connector that is missing from either expectation list
- Replace duplicate-marker detection with exact-count assertions for both start and end markers in `replace_generated_block`
@AptS-1547

Copy link
Copy Markdown
Member Author

CodeRabbit review-summary nitpicks triaged against head 4ebde1cd2:

  • Fixed: the capacity expectation test now requires every registered connector to appear in exactly one supported/unsupported partition.
  • Fixed: generated-block replacement now requires exactly one start marker and one end marker across the full page.
  • Kept as designed: tutorial slug and short “best for” text remain beside the integration-test projection. They are the only curated provider documentation inputs. Moving them to a second TOML/JSON file would add another schema and parser without removing a duplicated runtime capability source; revisit only if the catalog grows enough to justify that boundary.

Focused validation passed for the capacity test, marker-backed docs drift check, Rust formatting, and diff whitespace.

@AptS-1547
AptS-1547 merged commit d7f64a5 into master Aug 9, 2026
15 checks passed
@AptS-1547
AptS-1547 deleted the docs/473-storage-connector-facts branch August 9, 2026 08:55
@codecov

codecov Bot commented Aug 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

docs: centralize storage backend capability facts and reduce duplicated backend lists

1 participant