Skip to content

feat(xtask): add docs-sync and examples smoke#290

Merged
EffortlessSteven merged 2 commits into
mainfrom
release/docs-sync-smoke
Mar 23, 2026
Merged

feat(xtask): add docs-sync and examples smoke#290
EffortlessSteven merged 2 commits into
mainfrom
release/docs-sync-smoke

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Summary

  • Add xtask docs-sync to generate README tables from docs/metadata/workspace-docs.json.
  • Add xtask examples-smoke to validate example metadata, compile every runnable example, and optionally run curated smoke examples.
  • Add single source-of-truth metadata file under docs/metadata/workspace-docs.json.
  • Wire both commands into xtask command dispatch.

Validation

  • cargo xtask docs-sync --check
  • cargo xtask examples-smoke
  • cargo xtask examples-smoke --run

Scope guardrail

Only docs/metadata/*, xtask/src/main.rs, and xtask/src/docs_sync.rs are changed.

@gemini-code-assist

Copy link
Copy Markdown

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Mar 22, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@EffortlessSteven has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 24 minutes and 36 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 47979c60-ae58-4c44-89ff-f85ecb3e588f

📥 Commits

Reviewing files that changed from the base of the PR and between c15bc16 and cb398cf.

📒 Files selected for processing (3)
  • README.md
  • docs/metadata/workspace-docs.json
  • xtask/src/docs_sync.rs

Walkthrough

This pull request introduces a documentation synchronization system for automated README maintenance. It adds a structured metadata file containing workspace crates, adapter information, examples, and feature matrices, along with a new xtask module that parses this metadata and regenerates README sections delimited by HTML comments. Two CLI subcommands manage and validate the documentation generation process.

Changes

Cohort / File(s) Summary
Documentation Content
README.md, docs/metadata/workspace-docs.json
Added HTML comment markers (<!-- docs-sync:*-start/end -->) to README sections; added structured JSON metadata defining workspace crates, adapter crates, runnable examples, feature matrices, and dependency snippets for automated regeneration.
Task Automation
xtask/src/docs_sync.rs, xtask/src/main.rs
Introduced new docs_sync module with logic to load metadata JSON, render markdown tables, update README sections, and validate runnable examples via cargo; extended CLI with DocsSync and ExamplesSmoke subcommands.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant CLI as xtask CLI
    participant DocSync as docs_sync Module
    participant MetaFile as workspace-docs.json
    participant README as README.md
    
    User->>CLI: docs-sync --check
    CLI->>DocSync: docs_sync_cmd(check=true)
    DocSync->>MetaFile: Load and parse metadata
    MetaFile-->>DocSync: Structured data (crates, examples, matrices)
    DocSync->>DocSync: Render markdown tables from metadata
    DocSync->>README: Locate sync markers
    README-->>DocSync: Marker positions
    DocSync->>DocSync: Compare current vs. generated content
    alt Content matches
        DocSync-->>CLI: ✓ Check passed
    else Content differs
        DocSync-->>CLI: ✗ Check failed (dry-run in check mode)
    end
    CLI-->>User: Exit status
Loading
sequenceDiagram
    actor User
    participant CLI as xtask CLI
    participant ExampleSmoke as examples_smoke_cmd
    participant DocSync as docs_sync Module
    participant CargoBuild as cargo check/run
    participant Examples as example .rs files
    
    User->>CLI: examples-smoke --run
    CLI->>ExampleSmoke: examples_smoke_cmd(run=true)
    ExampleSmoke->>DocSync: docs_sync_cmd(check=true)
    DocSync->>DocSync: Validate README consistency
    ExampleSmoke->>Examples: List example files in crates/uselesskey/examples
    Examples-->>ExampleSmoke: File list
    ExampleSmoke->>ExampleSmoke: Cross-check against metadata entries
    alt Mismatches found
        ExampleSmoke-->>CLI: ✗ Validation failed
    else All match
        ExampleSmoke->>CargoBuild: cargo check (each example)
        CargoBuild-->>ExampleSmoke: ✓ Check results
        alt run=true and run_smoke=true
            ExampleSmoke->>CargoBuild: cargo run (each enabled example)
            CargoBuild-->>ExampleSmoke: Execution results
        end
        ExampleSmoke-->>CLI: ✓ Smoke tests passed
    end
    CLI-->>User: Exit status
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 Hops excitedly
Metadata dances, markers align,
README tables, now by design!
Examples smoke-tested, docs stay in sync,
Automation's rhythm in a markdown link,
One happy rabbit, one well-tended doc! 📚✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately captures the main changes: adding two xtask subcommands (docs-sync and examples-smoke) for documentation and example management.
Description check ✅ Passed The description clearly outlines the changes, validation steps, and scope boundaries, directly relating to the changeset modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch release/docs-sync-smoke

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 and usage tips.

@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: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/metadata/workspace-docs.json`:
- Around line 299-305: The "extra_features" field currently contains the literal
"-" which is rendered as code-formatted `-` instead of the empty-state glyph;
change the value of the extra_features property for the "uselesskey-ring"
adapter from "-" to an empty string "" so xtask/src/docs_sync.rs (which maps
empty extra_features to the normal glyph) will render the correct empty-state;
update the JSON entry where "adapter": "uselesskey-ring" and "extra_features"
appear accordingly.

In `@xtask/src/docs_sync.rs`:
- Around line 144-152: The Markdown fences need blank lines around them; in the
loop over metadata.dependency_snippets replace the two-step write
(writeln!(output, "  ```toml\n{}", indent_lines(...)) and the subsequent
output.push_str("  ```\n\n")) with a single writeln! that writes the opening
fence, the indented snippet, and the closing fence with trailing blank line (use
the format string "  ```toml\n{}\n  ```\n" and pass indent_lines(&item.snippet,
"  ")), and remove the separate output.push_str call so each list item gets
blank lines before and after its fenced snippet.
- Around line 287-329: In validate_examples_match_workspace, add validation over
metadata.runnable_examples to 1) detect duplicate paths (use a HashSet/BTreeSet
to track normalized entry.path and push an error if an entry.path is already
seen) and 2) verify each entry.name equals the file stem of entry.path (use
Path::new(&entry.path).file_stem().and_then(|s| s.to_str()) and push an error on
mismatch); include these errors in the same errors Vec and bail with them like
the existing filesystem/metadata drift messages so duplicates or mismatched
names are rejected before compile_example runs.
- Around line 266-274: The function compile_example uses cargo check which
doesn't perform codegen/linking; change the cargo invocation in compile_example
to use "build" instead of "check" (i.e., call cargo build --example <name> with
the same flags such as -p, --no-default-features and optional --features when
example.feature_set is non-empty) so examples are fully compiled and linked;
keep the existing crate::run(...) and with_context(...) error handling
unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 5c87ca94-9bb2-4a74-98c9-2b698fcd9de5

📥 Commits

Reviewing files that changed from the base of the PR and between 08475b3 and c15bc16.

📒 Files selected for processing (4)
  • README.md
  • docs/metadata/workspace-docs.json
  • xtask/src/docs_sync.rs
  • xtask/src/main.rs

Comment thread docs/metadata/workspace-docs.json Outdated
Comment thread xtask/src/docs_sync.rs Outdated
Comment on lines +144 to +152
for item in &metadata.dependency_snippets {
writeln!(output, "- **{}**", item.name).expect("write to string");
writeln!(
output,
" ```toml\n{}",
indent_lines(&item.snippet, " ")
)
.expect("write to string");
output.push_str(" ```\n\n");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Generate blank lines around the fenced snippets.

These blocks currently regenerate README.md with MD031 warnings because the fence starts immediately after the list item text.

🔧 Proposed fix
     for item in &metadata.dependency_snippets {
-        writeln!(output, "- **{}**", item.name).expect("write to string");
+        writeln!(output, "- **{}**\n", item.name).expect("write to string");
         writeln!(
             output,
-            "  ```toml\n{}",
+            "  ```toml\n{}\n  ```\n",
             indent_lines(&item.snippet, "  ")
         )
         .expect("write to string");
-        output.push_str("  ```\n\n");
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@xtask/src/docs_sync.rs` around lines 144 - 152, The Markdown fences need
blank lines around them; in the loop over metadata.dependency_snippets replace
the two-step write (writeln!(output, "  ```toml\n{}", indent_lines(...)) and the
subsequent output.push_str("  ```\n\n")) with a single writeln! that writes the
opening fence, the indented snippet, and the closing fence with trailing blank
line (use the format string "  ```toml\n{}\n  ```\n" and pass
indent_lines(&item.snippet, "  ")), and remove the separate output.push_str call
so each list item gets blank lines before and after its fenced snippet.

Comment thread xtask/src/docs_sync.rs
Comment thread xtask/src/docs_sync.rs
@EffortlessSteven EffortlessSteven merged commit e8fd81d into main Mar 23, 2026
2 of 4 checks passed
@EffortlessSteven EffortlessSteven deleted the release/docs-sync-smoke branch March 23, 2026 05:47
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