Skip to content

Documentation: comprehensive mdbook rewrite, rustdoc fixes, and test stability#33

Merged
unclesp1d3r merged 3 commits into
mainfrom
23-documentation-rustdoc-mdbook-site-migration-guide
Feb 12, 2026
Merged

Documentation: comprehensive mdbook rewrite, rustdoc fixes, and test stability#33
unclesp1d3r merged 3 commits into
mainfrom
23-documentation-rustdoc-mdbook-site-migration-guide

Conversation

@unclesp1d3r
Copy link
Copy Markdown
Member

Summary

Closes #23

  • Rewrote all major mdbook chapters (library-api, cli-usage, output, configuration, performance) to accurately document the implemented API, CLI, and architecture -- replacing placeholder/thin content with comprehensive references
  • Updated introduction.md, getting-started.md, and migration.md with current project status, correct code examples, and C-to-Rust API mapping table
  • Fixed 3 rustdoc link warnings in src/parser/loader.rs (unresolved parse_text_magic_file references)
  • Added architecture constraints and mise toolchain notes to AGENTS.md
  • Fixed flaky test_file_buffer_binary_content caused by temp file name collisions under parallel coverage execution (replaced timestamp-based rand with atomic counter)

Test plan

  • cargo doc -- 0 warnings
  • cargo test --doc -- 118 passed, 0 failed
  • cargo test -- 940+ tests pass
  • cargo clippy -- -D warnings -- clean
  • mdbook build docs/ -- successful
  • just ci-check -- fully green (including coverage)
  • Verify rendered mdbook site looks correct
  • Verify GitHub Actions CI passes

Generated with Claude Code

Rewrite all major mdbook chapters to accurately reflect the implemented
API, CLI, and architecture. Fix rustdoc link warnings in parser/loader.rs.

Updated chapters:
- library-api.md: Full API reference (MagicDatabase, EvaluationConfig,
  EvaluationResult, error handling, MIME mapping)
- cli-usage.md: Complete CLI reference (flags, output formats, exit
  codes, magic file discovery, stdin, timeout, strict mode)
- configuration.md: EvaluationConfig presets, validation rules, usage
- output.md: Text/JSON/JSON Lines output, tag enrichment, conversion
- performance.md: Memory-mapped I/O, evaluation pipeline, benchmarking
- introduction.md: Updated project status and feature list
- getting-started.md: Updated quick start, project structure, Rust 1.91+
- migration.md: C-to-Rust API mapping table, updated examples

Rustdoc fixes:
- Fix 3 unresolved links in parser/loader.rs (use super:: prefix)
The test-only rand module used SystemTime nanoseconds for temp file
names. Under parallel test execution (especially with cargo-llvm-cov),
concurrent tests generated identical timestamps, causing filename
collisions and test_file_buffer_binary_content failures.

Replace with a monotonic AtomicU64 counter + process ID for guaranteed
uniqueness. Remove the now-unused rand module.
@unclesp1d3r unclesp1d3r linked an issue Feb 12, 2026 that may be closed by this pull request
21 tasks
@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Feb 12, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 12, 2026

Caution

Review failed

Failed to post review comments

Summary by CodeRabbit

Release Notes

  • Documentation

    • Added comprehensive CLI usage guide with examples, flags, exit codes, and stdin support
    • Published full library API reference with configuration, error types, and presets
    • Documented configuration system with validation and security bounds
    • Added performance optimization and benchmarking guidance
    • Expanded output formatters documentation for text and JSON formats
  • Tests

    • Improved deterministic temp file naming for test suite

Walkthrough

Comprehensive documentation update covering Phase 1 MVP, including rewritten mdbook chapters (CLI usage, library API, configuration, output formatters, performance), updated introduction and migration guide, plus minor code changes to temp file naming and documentation references.

Changes

Cohort / File(s) Summary
Documentation: Core API & Getting Started
docs/src/library-api.md, docs/src/configuration.md, docs/src/getting-started.md
Complete rewrite of library API reference with MagicDatabase, EvaluationConfig structs and associated methods; configuration reworked from planned to API-first with field-level defaults, bounds, and presets (default/performance/comprehensive); getting-started updated with prerequisites and code examples.
Documentation: CLI, Migration & Introduction
docs/src/cli-usage.md, docs/src/migration.md, docs/src/introduction.md
CLI documentation expanded from placeholder with args, flags, output formats, stdin support, and examples; migration guide updated with API mapping table and error handling examples; introduction enhanced with "What's Complete" and "Next Milestones" sections reflecting new features (MIME types, timeout, presets, tag extraction).
Documentation: Output, Performance & Architecture
docs/src/output.md, docs/src/performance.md, docs/src/AGENTS.md
Output formatters rewritten as Chapter 9 with tag enrichment, JSON/text formatting pipeline, and serialization details; performance documentation replaces notes with optimizations (memory-mapped I/O, SIMD, benchmarking); AGENTS.md adds architecture constraints and standard command guidance.
Code: Test Infrastructure & Parser Documentation
src/io/mod.rs, src/parser/loader.rs
Temp file naming replaced with deterministic monotonic AtomicU64 counter (eliminating rand module); loader.rs documentation references corrected to point to super::parse_text_magic_file().

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Suggested labels

documentation, testing, parser, io, size:XXL

Poem

🐰 Hops through docs with glee and care,
APIs documented everywhere!
From CLI flags to config presets bright,
And temp files named just right!
The MVP hops on stage complete—
Documentation can't be beat! 🚀

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the primary changes: comprehensive mdbook documentation rewrite, rustdoc link fixes, and test stability improvements from replacing random temp filenames with atomic counter.
Description check ✅ Passed The description clearly relates to the changeset, detailing all major documentation updates, specific file modifications, rustdoc fixes, and the test stability improvement with atomic counter implementation.
Linked Issues check ✅ Passed All primary objectives from issue #23 are met: comprehensive rustdoc documentation (library-api, cli-usage, configuration), mdbook site rewrite (getting-started, introduction, migration, output, performance chapters), rustdoc link warnings fixed, and test stability improved. Cargo doc, cargo test --doc, and mdbook build all pass.
Out of Scope Changes check ✅ Passed All changes align with issue #23 scope: documentation rewrites, rustdoc fixes, and test stability. The atomic counter fix for temp files is a direct support for testing documentation examples and aligns with MVP quality assurance.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 23-documentation-rustdoc-mdbook-site-migration-guide

Comment @coderabbitai help to get the list of available commands and usage tips.

@unclesp1d3r unclesp1d3r enabled auto-merge (squash) February 12, 2026 05:12
@dosubot dosubot Bot added the documentation Improvements or additions to documentation label Feb 12, 2026
@coderabbitai coderabbitai Bot added io File I/O and memory mapping parser Magic file parsing components and grammar testing Test infrastructure and coverage labels Feb 12, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Feb 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@unclesp1d3r unclesp1d3r merged commit 36adac5 into main Feb 12, 2026
25 checks passed
@unclesp1d3r unclesp1d3r deleted the 23-documentation-rustdoc-mdbook-site-migration-guide branch February 12, 2026 05:15
@github-actions github-actions Bot mentioned this pull request Feb 15, 2026
@coderabbitai coderabbitai Bot mentioned this pull request Apr 10, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation io File I/O and memory mapping parser Magic file parsing components and grammar size:XXL This PR changes 1000+ lines, ignoring generated files. testing Test infrastructure and coverage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation: Rustdoc, mdbook Site & Migration Guide

1 participant