fix(channels): keep Telegram setup form available after describe timeout#6345
Conversation
houko
left a comment
There was a problem hiding this comment.
One doc comment placement issue found; everything else looks good — the fallback schema, tests, and locale string fixes are all correct.
Generated by Claude Code
| /// or release notes. `webhook` is deliberately omitted: it still has an | ||
| /// in-process entry in `CHANNEL_REGISTRY` and we must not show two | ||
| /// "webhook" cards on the page. | ||
| /// Compile-time field descriptors for the Telegram adapter. | ||
| /// | ||
| /// Telegram is the first adapter probed at daemon boot. On slow disks its | ||
| /// cold Python import can exceed the five-second describe timeout even though | ||
| /// the embedded SDK is healthy. Keep this fallback aligned with both the | ||
| /// Python and Rust Telegram schemas so the configure form remains usable. | ||
| const TELEGRAM_STATIC_FIELDS: &[StaticSidecarField] = &[ |
There was a problem hiding this comment.
Doc comment merge: the three /// lines that were already here (the "webhook" note) are the tail of the Feishu const's doc comment block, which continues immediately with /// Compile-time field descriptors for the Feishu / Lark adapter. further down in the file.
Inserting the new TELEGRAM_STATIC_FIELDS const — and its own /// doc block — right between those "webhook" lines and the Feishu const's leading /// lines merges all of them into one continuous /// block.
Rust attaches a consecutive /// block to the next item, so the Telegram const ends up with a doc comment that opens with the webhook caveat, while the Feishu const silently loses the last three lines of its documentation.
The fix is to move the insertion point to before the /// or release notes… / /// in-process entry… / /// "webhook" cards on the page. lines, so the Feishu doc comment remains intact:
/// Compile-time field descriptors for the Telegram adapter.
///
/// Telegram is the first adapter probed at daemon boot. …
const TELEGRAM_STATIC_FIELDS: &[StaticSidecarField] = &[ … ];
// ← existing Feishu doc comment block starts here (unmodified)
/// Compile-time field descriptors for the Feishu / Lark adapter.
/// …
/// or release notes. `webhook` is deliberately omitted: …
const FEISHU_STATIC_FIELDS: …This doesn't affect compilation or tests (doc comments don't participate in either), but it leaves misleading documentation in the codebase.
Generated by Claude Code
houko
left a comment
There was a problem hiding this comment.
Two issues in crates/librefang-api/src/routes/channels.rs:
1. Doc comment bleed into TELEGRAM_STATIC_FIELDS
TELEGRAM_STATIC_FIELDS is inserted immediately after the last line of the preceding constant's doc block (/// "webhook" cards on the page.) with no blank line separating them. In Rust, all consecutive /// lines before an item declaration merge into that item's doc comment — so the "webhook" text that was documenting an earlier constant (likely SIDECAR_CATALOG) will appear in TELEGRAM_STATIC_FIELDS's rendered docs instead.
Fix: add one blank line before /// Compile-time field descriptors for the Telegram adapter.
2. Multi-paragraph doc comment on TELEGRAM_STATIC_FIELDS (CLAUDE.md: "one short line max")
/// Compile-time field descriptors for the Telegram adapter.
///
/// Telegram is the first adapter probed at daemon boot. On slow disks its
/// cold Python import can exceed the five-second describe timeout even though
/// the embedded SDK is healthy. Keep this fallback aligned with both the
/// Python and Rust Telegram schemas so the configure form remains usable.
const TELEGRAM_STATIC_FIELDS: ...The WHY is worth keeping but needs to fit in one line, e.g.:
/// Compile-time fallback schema for Telegram; used when the `--describe` probe times out at daemon boot.
Generated by Claude Code
houko
left a comment
There was a problem hiding this comment.
One doc-comment issue in crates/librefang-api/src/routes/channels.rs.
The new TELEGRAM_STATIC_FIELDS constant is inserted immediately after the three /// lines that ended the previous constant's doc block:
/// or release notes. `webhook` is deliberately omitted: it still has an
/// in-process entry in `CHANNEL_REGISTRY` and we must not show two
/// "webhook" cards on the page.
/// Compile-time field descriptors for the Telegram adapter. ← inserted here, no separator
///
/// Telegram is the first adapter probed at daemon boot. …
const TELEGRAM_STATIC_FIELDS: &[StaticSidecarField] = &[…];Because there is no blank /// line between the two blocks, Rust treats all seven consecutive /// lines as a single doc comment for TELEGRAM_STATIC_FIELDS. The webhook-exclusion text is now part of the Telegram constant's docs, where it reads as noise.
Fix — add one blank /// separator before the Telegram-specific block:
/// "webhook" cards on the page.
+///
/// Compile-time field descriptors for the Telegram adapter.That makes the webhook text float as a dangling comment (or re-attach to the preceding constant if the file structure supports it). Either way it removes the incorrect attribution from the Telegram constant.
Generated by Claude Code
Summary
The dashboard builds sidecar setup forms from schemas returned by each adapter's boot-time
--describeprobe.Telegram is the first adapter in the catalog.
Its initial cold Python import can exceed the five-second probe timeout on slower systems.
Because Telegram had no static fallback schema, that one timeout left the setup drawer empty and disabled Save for the lifetime of the daemon.
Closing and reopening LibreFang Desktop did not necessarily retry discovery because the Tauri background process remained alive and retained the failed schema cache.
Changes
--describefails, so the setup form remains usable.Verification
cargo fmt --checkcargo test -p librefang-api --lib static_schema_testscargo clippy -p librefang-api --lib -- -D warningspnpm testpnpm buildlibrefang-desktopin the repository's sanctionedDockerfile.rust-devimage.librefang-desktop-bin 2026.6.26_beta.24-2fields: []schema_error: python3 ...--describe timed out after 5s