Skip to content

Snapshot localized CLI help output (#290)#326

Draft
lodyai[bot] wants to merge 1 commit into
mainfrom
issue-290-snapshot-test-for-help-output
Draft

Snapshot localized CLI help output (#290)#326
lodyai[bot] wants to merge 1 commit into
mainfrom
issue-290-snapshot-test-for-help-output

Conversation

@lodyai
Copy link
Copy Markdown
Contributor

@lodyai lodyai Bot commented May 31, 2026

Summary

This branch adds regression coverage for issue #290 by snapshotting the
localised top-level CLI help output in en-US and es-ES. It directly
asserts that --config <FILE> is present with the Fluent-resolved
configuration-file description before storing the full rendered help text as
insta snapshots.

Closes #290.

Review walkthrough

Validation

  • cargo test localized_help_snapshots_include_config_flag --all-targets --all-features: passed.
  • make check-fmt: passed.
  • make lint: passed.
  • make test: passed.

Notes

  • coderabbit review --agent was attempted after the focused snapshot test, but the command stalled after reporting sandbox setup. The stalled process group from this worktree was stopped; no CodeRabbit findings were returned.
  • gh issue edit 290 --add-label low failed with GraphQL: Resource not accessible by integration, so the issue label could not be applied from this environment.

Summary by Sourcery

Add regression coverage to ensure localized CLI help output includes the configuration flag and is snapshotted for specific locales.

Tests:

  • Add parameterized test that snapshots localized CLI help output for en-US and es-ES and asserts presence of the config flag and its description.
  • Add insta snapshot files capturing the localized top-level CLI help output for English and Spanish locales.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 31, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 91b74702-c3e0-4054-9e4c-17a40ab8478d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-290-snapshot-test-for-help-output

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

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented May 31, 2026

Reviewer's Guide

Adds a parameterized, locale-aware CLI help snapshot test to ensure the localized help text includes the --config flag and its description, and introduces insta snapshots for en-US and es-ES outputs.

Sequence diagram for localized CLI help snapshot test

sequenceDiagram
    participant Test as localized_help_snapshots_include_config_flag
    participant Localizer as build_localizer
    participant Cli as Cli_command
    participant Localized as localize_command
    participant Normalizer as normalize_fluent_isolates
    participant Settings as snapshot_settings
    participant Insta as assert_snapshot

    Test->>Localizer: build_localizer(locale)
    Localizer-->>Test: localizer

    Test->>Cli: Cli::command()
    Cli-->>Test: command

    Test->>Localized: localize_command(command, localizer)
    Localized-->>Test: localized_command

    Test->>Localized: render_long_help()
    Localized-->>Test: rendered_help

    Test->>Normalizer: normalize_fluent_isolates(rendered_help)
    Normalizer-->>Test: normalized_help

    Test->>Test: assert contains("--config <FILE>")
    Test->>Test: assert contains(config_help)

    Test->>Settings: snapshot_settings("cli")
    Settings-->>Test: settings

    Test->>Settings: bind()
    activate Settings
    Settings->>Insta: assert_snapshot(snapshot_name, normalized_help)
    deactivate Settings
Loading

File-Level Changes

Change Details Files
Add a locale-parameterized snapshot test that asserts localized CLI help includes the --config flag and its localized description, then snapshots the full help output.
  • Introduce rstest-based parameterized test localized_help_snapshots_include_config_flag covering en-US and es-ES locales.
  • Build a localizer for each test case and apply it to the clap command via localize_command before rendering long help text.
  • Normalize Fluent isolation marks in the rendered help before assertions and snapshotting to avoid unstable artifacts.
  • Assert presence of the --config flag and its expected localized description in the normalized help output prior to snapshot comparison.
  • Use snapshot_settings("cli") to scope insta snapshot configuration and assert_snapshot! with per-locale snapshot names.
src/cli/mod.rs
Add insta snapshot files capturing the localized CLI help output for en-US and es-ES.
  • Create English CLI help snapshot file capturing the full normalized long help output for en-US.
  • Create Spanish CLI help snapshot file capturing the full normalized long help output for es-ES.
src/snapshots/cli/netsuke__cli__tests__help_en_us.snap
src/snapshots/cli/netsuke__cli__tests__help_es_es.snap

Assessment against linked issues

Issue Objective Addressed Explanation
#290 Add insta-based snapshot tests that invoke the CLI --help for each supported locale (at least en-US and es-ES) and assert that the --config flag and its localized description are present, while snapshotting the full help output.
#290 Store the new help output snapshots in the repository in an appropriate location alongside tests so regressions in flag naming, ordering, or localization are caught.
#290 Ensure these snapshot tests run in CI so that any divergence in rendered help text from the stored snapshots causes CI/test failures.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

codescene-delta-analysis[bot]

This comment was marked as outdated.

Add `insta` coverage for localized top-level help in `en-US` and
`es-ES`. Assert the `--config` flag and resolved Fluent description
before snapshotting the full rendered help output so future CLI or
localisation drift is caught in review.
@lodyai lodyai Bot force-pushed the issue-290-snapshot-test-for-help-output branch from f209922 to ec8d068 Compare June 1, 2026 10:53
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.

Add insta snapshot test for --help output covering --config flag and Fluent-localised description (en-US + es-ES)

1 participant