Pin public error display output (#8) - #47
Conversation
Compile and execute external UI fixtures for every public variant of `CliError`, `DurationParseError`, and `ClockConfigError`. Keep their user-facing messages stable when the error definitions are refactored.
Explain why the executable `trybuild` fixtures use pass mode, how their expected strings act as reviewed snapshots, and which commands contributors must run when adding or intentionally updating public error messages.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
SummaryAdd executable Document the UI test workflow, fixture ownership, snapshot rules, and repository layout. Add Related issueImplement the UI-testing objectives from issue WalkthroughAdd a ChangesPublic error display tests
Sequence Diagram(s)sequenceDiagram
participant Cargo
participant Trybuild
participant DisplayFixtures
Cargo->>Trybuild: run cargo test --test ui
Trybuild->>DisplayFixtures: execute *_display.rs cases
DisplayFixtures-->>Trybuild: assert Display output
Trybuild-->>Cargo: report test results
Suggested labels: Suggested reviewers: Poem
Important Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional. ❌ Failed checks (4 warnings, 2 inconclusive)
✅ Passed checks (14 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
Reviewer's GuidePins the user-facing Display output of public error types via executable trybuild-based UI tests and documents the associated workflow and layout, with trybuild added as a test-only dependency. Sequence diagram for trybuild-based public error Display UI testssequenceDiagram
actor Developer
participant CargoTest as cargo_test
participant UIHarness as tests_ui_rs
participant Trybuild as trybuild_TestCases
participant CliFixture as cli_error_display_crate
participant CliError
Developer->>CargoTest: run_cargo_test_test_ui
CargoTest->>UIHarness: main
UIHarness->>Trybuild: TestCases_new
UIHarness->>Trybuild: pass_cli_error_display_rs
Trybuild->>CliFixture: compile_crate
Trybuild->>CliFixture: run_binary
CliFixture->>CliError: Display
CliFixture->>Trybuild: assert_eq_expected_message
Trybuild->>UIHarness: report_pass
UIHarness->>CargoTest: exit_success
CargoTest->>Developer: tests_passed
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Keep the spelling helper's local coverage database out of the working tree after documentation gates run.
|
@coderabbitai review |
✅ Action performedReview finished.
|
Issue #8 asked for compile-fail UI tests covering the Display output of the public error types. Rust evaluates Display at runtime, so a compile-fail fixture can only snapshot compiler diagnostics and never observes a formatted message. Pass-mode fixtures remain the only way to pin the message text. Cover both guarantees instead of choosing one. Add compile-fail fixtures that match every public variant of CliError, DurationParseError, and ClockConfigError without a wildcard arm, with .stderr snapshots pinning E0004. These catch the removal of #[non_exhaustive], which would silently turn every later variant addition into a breaking change downstream. Document both modes and the TRYBUILD=overwrite regeneration step, add the missing docstrings to the fixture helpers, and record the UI milestone, current test counts, and validation evidence in the living execplan. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Note on compile-fail vs pass modeThe task list asks for compile-fail UI tests covering the Rather than pick one, the branch splits the harness across both
Both run under standard Cargo test discovery via Flagging this because it deviates from the wording of the tasks above; the |
Summary
This branch pins the public error surface of
CliError,DurationParseError,and
ClockConfigErrorat the crate boundary so refactoring cannot silentlychange it. It resolves issue #8 with a
trybuildharness that runs in bothmodes: pass fixtures pin the user-facing
Displaymessages, and compile-failfixtures pin
#[non_exhaustive]on all three enums.Closes #8.
Review walkthrough
CliErrorfixture,DurationParseErrorfixture, andClockConfigErrorfixture for the pinned public messages.CliError,DurationParseError, andClockConfigError, each with an adjacent.stderrsnapshot.trybuilddependency.Why two modes
Issue #8 asks for compile-fail tests of
Displayoutput, which is notexpressible: Rust evaluates
Displayat runtime, so a compile-fail fixture onlycaptures compiler diagnostics and never sees a formatted message. Each guarantee
is therefore covered by the mode that can express it.
Pass fixtures are compiled as external crates and then executed, testing the
public boundary and the actual message text. Compile-fail fixtures match every
public variant without a wildcard arm and are expected to fail with
E0004,pinning the contract that keeps adding an error variant a non-breaking change
downstream. A compile-fail fixture that starts passing means an enum has lost
#[non_exhaustive].Validation
make check-fmt: passed.make markdownlint: passed; three helper tests passed with 95.45% coverage and Markdown lint reported no errors.make nixie: passed; all diagrams are valid.make lint: passed rustdoc, Clippy, and Whitaker.make test: passed all 27 tests across six binaries, including the UI harness.make typecheck: passed.cargo test --doc: passed all 14 doctests.coderabbit review --agent: completed after both major milestones with zero findings.References
Summary by Sourcery
Add executable UI tests to pin user-facing display output of public error types and document their workflow and location.
Build:
Documentation:
Tests: