Skip to content

docs: cookbook expansion and learning path improvements#132

Merged
Tuntii merged 1 commit intomainfrom
docs-maintenance-2026-02-23-12444186712278693427
Feb 22, 2026
Merged

docs: cookbook expansion and learning path improvements#132
Tuntii merged 1 commit intomainfrom
docs-maintenance-2026-02-23-12444186712278693427

Conversation

@Tuntii
Copy link
Owner

@Tuntii Tuntii commented Feb 22, 2026

This PR updates the RustAPI documentation as part of the scheduled maintenance run.

Key changes:

  1. Fixes: Corrected MockServer examples in recipes/testing.md which were using incorrect async syntax and nonexistent methods.
  2. New Content: Added a comprehensive "Graceful Shutdown" recipe covering CTRL+C and SIGTERM handling.
  3. Learning Path: Expanded Module 11 to include a concrete mini-project ("The Email Worker") and better knowledge checks.
  4. Tracking: Updated agent run report and coverage map.

PR created automatically by Jules for task 12444186712278693427 started by @Tuntii

- Fixed `MockServer` usage in `recipes/testing.md` to match actual API.
- Added new "Graceful Shutdown" recipe in `recipes/graceful_shutdown.md`.
- Updated `recipes/README.md` and `SUMMARY.md` to include new recipe.
- Enhanced "Module 11: Background Jobs" in `learning/curriculum.md` with mini-project.
- Generated run report and updated docs coverage/inventory.
Copilot AI review requested due to automatic review settings February 22, 2026 04:00
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the RustAPI documentation with fixes, new content, and learning path improvements. The changes primarily focus on correcting MockServer examples, adding a comprehensive graceful shutdown guide, and enhancing the background jobs module in the learning curriculum.

Changes:

  • Fixed MockServer API usage in testing recipe (removed incorrect .await and replaced nonexistent url() method)
  • Added new "Graceful Shutdown" recipe covering signal handling and run_with_shutdown API
  • Enhanced Module 11 of the learning curriculum with a mini-project and improved knowledge checks

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
docs/cookbook/src/recipes/testing.md Fixed MockServer example to use correct API (removed .await on builder, use base_url() + format string)
docs/cookbook/src/recipes/graceful_shutdown.md New comprehensive recipe for graceful shutdown with CTRL+C and SIGTERM handling
docs/cookbook/src/recipes/README.md Added link to new Graceful Shutdown recipe
docs/cookbook/src/learning/curriculum.md Enhanced Module 11 with "The Email Worker" mini-project and better knowledge checks
docs/cookbook/src/SUMMARY.md Added Graceful Shutdown to table of contents
docs/.agent/run_report_2026-02-23.md New run report documenting the changes
docs/.agent/last_run.json Updated last run metadata
docs/.agent/docs_coverage.md Added Graceful Shutdown entry to coverage map
Comments suppressed due to low confidence (1)

docs/cookbook/src/recipes/testing.md:115

  • The MockServer test is missing a verification call at the end. According to the rustapi-testing implementation, MockServer does not auto-verify expectations on Drop; tests must explicitly call mock_server.verify() at the end to ensure that all expectations were met. Add mock_server.verify(); after the assertions to complete the test properly.
async fn test_external_integration() {
    // 1. Start a mock server
    let mock_server = MockServer::start().await;

    // 2. Define an expectation
    mock_server.expect(
        rustapi_testing::RequestMatcher::new()
            .method("GET")
            .path("/external-data")
    ).respond_with(
        MockResponse::new()
            .status(200)
            .body(r#"{"data": "mocked"}"#)
    );

    // 3. Use the mock server's URL in your app configuration
    let mock_url = format!("{}{}", mock_server.base_url(), "/external-data");

    // Simulating your app logic calling the external service
    let client = reqwest::Client::new();
    let res = client.get(&mock_url).send().await.unwrap();

    assert_eq!(res.status(), 200);
    let body = res.text().await.unwrap();
    assert_eq!(body, r#"{"data": "mocked"}"#);
}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

2. Enqueue this job inside your `POST /register` handler.
3. Write an integration test using `TestClient` to verify the registration endpoint.
- **Expected Output:** Registration returns 200 immediately (low latency); console logs show "Sending welcome email to ..." shortly after (asynchronous). Tests pass.
- **Pitfalls:** Forgetting to start the job worker loop (`JobWorker::new(queue).run().await`).
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

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

The API usage mentioned here is incorrect. The rustapi-jobs library doesn't have a JobWorker type. Based on the actual implementation in crates/rustapi-jobs/src/queue.rs, the correct way to start the worker loop is to call queue.start_worker().await where queue is a JobQueue instance. The pitfall should read: "Forgetting to start the job worker loop (spawn queue.start_worker().await in a background task)".

Suggested change
- **Pitfalls:** Forgetting to start the job worker loop (`JobWorker::new(queue).run().await`).
- **Pitfalls:** Forgetting to start the job worker loop (spawn `queue.start_worker().await` in a background task).

Copilot uses AI. Check for mistakes.

#[tokio::main]
async fn main() -> Result<()> {
let app = RustApi::new().route("/", get(hello));
Copy link

Copilot AI Feb 22, 2026

Choose a reason for hiding this comment

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

The production example references a hello function on line 59, but this function is not defined in this code block. The example should either include the hello function definition (copying it from the basic example) or use an inline closure instead, such as .route("/", get(|| async { "Hello" })), to make the example self-contained and compilable.

Copilot uses AI. Check for mistakes.
@Tuntii Tuntii merged commit 189ae08 into main Feb 22, 2026
11 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 22, 2026
…tenance-2026-02-23-12444186712278693427

docs: cookbook expansion and learning path improvements 189ae08
@Tuntii Tuntii deleted the docs-maintenance-2026-02-23-12444186712278693427 branch February 26, 2026 05:49
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.

2 participants