Skip to content

fix(channels): point every channel's docs field at a page that exists - #784

Merged
huichen merged 1 commit into
mainfrom
fix/chan-docs-targets
Sep 22, 2026
Merged

huichen merged 1 commit into
mainfrom
fix/chan-docs-targets

Conversation

@huichen

@huichen huichen commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

fix(channels): point every channel's docs field at a page that exists

Every shipped channel declared docs: "docs/guide/channels-<id>.md", and none
of those fourteen files were ever created — there is no channels-telegram.md,
no channels-signal.md, no per-channel page at all. The value is user-facing:
it is what future channel list --json reports as the channel's documentation.
So the product advertised a link for each channel that led nowhere, and the
documentation that does exist (a section per channel in
docs/guide/channels-providers.md, and the configuration blocks for the
self-bridged pair in docs/guide/channels-config.md) was reachable only by
knowing to look for it.

Each definition now points at the section that documents it:

  • the twelve framework channels → docs/guide/channels-providers.md#<channel>
    (cli → #terminal, imessage → #imessage-macos);
  • Feishu and DingTalk → docs/guide/channels-config.md#feishu / #dingtalk.

Enforced from now on by
every_channel_documents_itself_somewhere_that_exists, which walks
providers::all_definitions() and resolves each target: the file must exist and,
when the value names an anchor, some heading in that file must produce it
(GitHub's slug rule). The crate's tests are the right home for this because the
documentation gate is deliberately run by hand and not wired into CI — a Rust
test is what actually fails a pull request.

Verified as a real guard rather than a restatement, by breaking it both ways:
pointing Telegram at the old channels-telegram.md fails with "which cannot be
read … expected a file at …", and #telegram-typo fails with "no such heading".
Both messages name the channel, so the next person to hit it knows what to fix.

The provider contract now says where docs should point, since nothing said so
and that is why fourteen of them were written this way.

Every shipped channel declared `docs: "docs/guide/channels-<id>.md"`, and none
of those fourteen files were ever created — there is no `channels-telegram.md`,
no `channels-signal.md`, no per-channel page at all. The value is user-facing:
it is what `future channel list --json` reports as the channel's documentation.
So the product advertised a link for each channel that led nowhere, and the
documentation that does exist (a section per channel in
`docs/guide/channels-providers.md`, and the configuration blocks for the
self-bridged pair in `docs/guide/channels-config.md`) was reachable only by
knowing to look for it.

Each definition now points at the section that documents it:

* the twelve framework channels → `docs/guide/channels-providers.md#<channel>`
  (`cli` → `#terminal`, `imessage` → `#imessage-macos`);
* Feishu and DingTalk → `docs/guide/channels-config.md#feishu` / `#dingtalk`.

Enforced from now on by
`every_channel_documents_itself_somewhere_that_exists`, which walks
`providers::all_definitions()` and resolves each target: the file must exist and,
when the value names an anchor, some heading in that file must produce it
(GitHub's slug rule). The crate's tests are the right home for this because the
documentation gate is deliberately run by hand and not wired into CI — a Rust
test is what actually fails a pull request.

Verified as a real guard rather than a restatement, by breaking it both ways:
pointing Telegram at the old `channels-telegram.md` fails with "which cannot be
read … expected a file at …", and `#telegram-typo` fails with "no such heading".
Both messages name the channel, so the next person to hit it knows what to fix.

The provider contract now says where `docs` should point, since nothing said so
and that is why fourteen of them were written this way.
@huichen
huichen enabled auto-merge (squash) September 22, 2026 17:09
@huichen
huichen merged commit 81a3691 into main Sep 22, 2026
12 checks passed
@huichen
huichen deleted the fix/chan-docs-targets branch September 22, 2026 17:14
huichen added a commit that referenced this pull request Sep 22, 2026
…vered (#785)

The invariant added in #784 carried four uncovered lines: its three `assert!`
messages and the `panic!` arm only materialise when the check fails, so a
passing suite never executes them. Worse, the negative controls that did
exercise them were throwaway edits — I confirmed the check works by breaking it
by hand and then put the file back, which leaves nothing behind that keeps
working.

Both problems have one fix: take the definitions as an argument and give each
failure mode a test that sees it fail.

* `docs_problem(root, docs)` returns why a target leads nowhere, or `None`;
* `undocumented(definitions, root)` collects them — parameterised, so a
  definition can be built per case;
* `a_docs_target_is_rejected_when_it_cannot_be_followed` covers all four
  shapes: a resolvable path, a resolvable path with a valid anchor, a file that
  is not there, an anchor that is not there, and an empty value. The assertions
  name the channel in the message, which is what makes the failure actionable.

The three remaining uncovered lines were the multi-line `assert!` format
arguments, evaluated only on failure; hoisting each into a binding ahead of the
assert closes them.

`an_anchor_is_the_slug_github_makes` pins the slug rule directly, including the
two real cases that make it non-obvious (`### \`feishu\`` → `feishu`,
`### iMessage (macOS)` → `imessage-macos`), so the anchor half of the check does
not depend on the page staying the way it is today.

`providers/mod.rs` is back to zero uncovered lines and the crate's total is
unchanged at 47 (22 framework, 25 in the older Feishu/DingTalk bridges and gRPC
client), which is the number `docs/architecture/channels-test-coverage.md`
records.
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.

1 participant