Skip to content

fix: suppress false positive shell integration warning for wrapper files - #1736

Merged
max-sixty merged 5 commits into
max-sixty:mainfrom
saschabratton:fix/false-warnings
Mar 26, 2026
Merged

max-sixty merged 5 commits into
max-sixty:mainfrom
saschabratton:fix/false-warnings

Conversation

@saschabratton

Copy link
Copy Markdown
Contributor

Problem: wt config show emitted a false positive "Found wt in ... but not detected as integration" warning for Nushell (and Fish) wrapper files. These files ARE the integration (they contain the shell function definition), not config files that source it, so is_shell_integration_line() correctly doesn't match their contents, but the warning logic didn't account for this.

Fix: Before emitting unmatched candidate warnings, collect paths already confirmed as integration files by scan_shell_configs. For Fish/Nushell (standalone wrapper files), any action means the file was recognized. For eval-based shells (Bash/Zsh), only AlreadyExists counts. Skip those paths when checking for unmatched candidates.

Fixes #1735

max-sixty added a commit to max-sixty/tend that referenced this pull request Mar 26, 2026
The "Install tend CI plugin" shell step installed plugins into a
standalone Claude CLI instance, but claude-code-action creates its own
settings file on startup — so the plugins were invisible to the actual
Claude session. The prompt `/tend-ci-runner:review` resolved to
"Unknown skill" with zero tokens used and no review posted.

Replace the shell step with claude-code-action's `plugin_marketplaces`
and `plugins` inputs so plugins are installed in the correct context.

Fixes max-sixty/worktrunk#1736

Co-Authored-By: Claude <[email protected]>
max-sixty added a commit that referenced this pull request Mar 26, 2026
The generated workflows referenced skills as `/tend:tend-*` (e.g.,
`/tend:tend-review`), but the plugin is named `tend-ci-runner` and the
skills are `review`, `triage`, etc. The correct format is
`/tend-ci-runner:review`.

This caused the silent review failure on #1736 — Claude resolved the
skill client-side, found nothing, and returned "Unknown skill" with zero
tokens. The CI check showed green because the process exited cleanly.

The root cause is the published `uvx tend` generator (v0.0.2) still uses
the old naming convention. A new release of the generator will fix it
for future `uvx tend init` runs; this PR fixes the existing generated
files.

> _This was written by Claude Code on behalf of @max-sixty_

Co-authored-by: Claude <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner

@worktrunk-bot /tend-ci-runner:review 1736

@max-sixty

Copy link
Copy Markdown
Owner

thanks @saschabratton . it does sound like our existing code had a problem

one concern is that the only tests that we have seem to revert the useful warnings.

@worktrunk-bot do you think you could

  • check whether those tests were asserting good behavior
  • if so, find out how restore the good behavior

and

  • add comments explaining this behavior
  • add tests for it

Add explanatory doc comments to the fish/nushell outdated wrapper tests
clarifying why the "not detected as integration" warning is correctly
absent (wrapper files ARE the integration, already recognized by
scan_shell_configs).

Add test_config_show_unmatched_candidate_not_suppressed_by_wrapper to
verify both behaviors in a single run: bash alias triggers the warning
while the fish wrapper file is correctly suppressed.

Fix the unmatched_summary URL builder to apply the same confirmed_paths
filter, preventing wrapper file lines from leaking into the report URL.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Investigated and pushed changes. Here's what I found:

Were the old tests asserting good behavior? No — the old snapshots included a false positive. When a Fish/Nushell wrapper file exists (even outdated), the system already shows the correct "Outdated shell extension" warning with actionable advice (wt config shell install fish). The additional "Found wt ... but not detected as integration" warning was redundant and misleading — it asked users to report a false negative for a file that IS recognized integration, just outdated.

Changes I made:

  1. Added doc comments to both outdated wrapper tests explaining why the "not detected" warning is correctly absent — wrapper files ARE the integration, not config files that source it.

  2. Added test_config_show_unmatched_candidate_not_suppressed_by_wrapper — verifies both behaviors in a single run: a bash alias (alias wt="git worktree") correctly triggers the warning, while a fish outdated wrapper file is correctly suppressed. This ensures the suppression is path-specific and doesn't accidentally silence all unmatched candidate warnings.

  3. Fixed a secondary bug in the summary URL builder (line ~979 of show.rs) — the report URL at the bottom was collecting unmatched lines from ALL detection results without applying the confirmed_paths filter, so fish wrapper lines leaked into the report body. Applied the same filter.

worktrunk-bot
worktrunk-bot previously approved these changes Mar 26, 2026
@worktrunk-bot
worktrunk-bot dismissed their stale review March 26, 2026 02:04

CI failed — snapshot formatting guard violation

Same phase-boundary pattern as the existing unmatched_candidate_warning
snapshot — blank line separates "Shell integration not active" diagnostic
from per-shell status section.

Co-Authored-By: Claude Opus 4.6 <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

CI is failing: test_no_blank_line_before_hint_in_snapshots rejects the new snapshot because it has a blank line before a ↳ hint.

This is the same pattern as the two existing allowlisted snapshots — the blank line separates the "Shell integration not active" diagnostic from the per-shell status section. The ↳ is a status item (bash: Not configured), not a detached hint.

Fix: Add the new snapshot to BLANK_BEFORE_HINT_ALLOWED in tests/integration_tests/snapshot_formatting_guard.rs:

const BLANK_BEFORE_HINT_ALLOWED: &[&str] = &[
    // config show: blank line separates "Shell integration not active" diagnostic
    // from per-shell status section. The `↳` here is a status item, not a hint.
    "config_show__config_show_partial_shell_config_shows_hint",
    "config_show__config_show_unmatched_candidate_warning",
    // Same pattern: blank line between "Shell integration not active" and per-shell status
    "config_show__config_show_unmatched_candidate_not_suppressed_by_wrapper",
];

The code changes themselves look correct — the confirmed_paths filter logic is sound, the secondary fix for the URL builder is consistent, and the new test covers the important property (path-specific suppression).

@max-sixty

Copy link
Copy Markdown
Owner

@worktrunk-bot please can you give some simple examples of where we hit this false positive

if possible include those in tests but at least explain here

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Here are the concrete false positive scenarios this PR fixes:

Scenario 1: Fish wrapper (outdated)

User has ~/.config/fish/functions/wt.fish containing:

function wt
    command wt $argv
end

scan_shell_configs correctly identifies this as outdated Fish integration (the file IS the integration, but the contents don't match the current template). wt config show displays:

▲ fish: Outdated shell extension @ ~/.config/fish/functions/wt.fish
↳ To update, run wt config shell install fish

But then the separate detection scan finds function wt on line 2, and is_shell_integration_line() doesn't match it (it looks for eval/source/wt config shell init patterns — the eval line lives in .bashrc/.zshrc, not in wrapper files). So it also emitted:

▲ Found wt in ~/.config/fish/functions/wt.fish:2 but not detected as integration
↳ If function wt is shell integration, report a false negative…

That second warning is wrong — the file was already recognized. It asks users to report a bug that doesn't exist.

Scenario 2: Nushell wrapper (outdated)

Same pattern. ~/.config/nushell/vendor/autoload/wt.nu containing:

def --wrapped wt [...args] {
    # ...
}

Again, scan_shell_configs knows it's outdated integration, but the detection scan sees def --wrapped wt and emits a spurious "not detected as integration" warning.

What the fix does

Before emitting unmatched candidate warnings, the PR collects paths that scan_shell_configs already confirmed as integration files. For Fish/Nushell (standalone wrapper files), any recognition counts. For Bash/Zsh (eval-based), only AlreadyExists counts. Those paths are then skipped in the unmatched candidate loop.

The new test_config_show_unmatched_candidate_not_suppressed_by_wrapper test verifies this is path-specific: in the same config show run, a bash alias wt="git worktree" still correctly triggers the warning while the fish wrapper is suppressed.

@max-sixty

Copy link
Copy Markdown
Owner

excellent, thank you!

would there be a simpler way to design this? I worry a bit about the shell match sparse from the original check...

Replaces five `matches!(r.shell, Shell::Fish | Shell::Nushell)` checks
with a single method, so adding a new wrapper-based shell only requires
updating one place.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Good call — I pushed a refactor that adds Shell::is_wrapper_based() and replaces all five matches!(shell, Shell::Fish | Shell::Nushell) checks across show.rs and configure_shell.rs. Now adding a new wrapper-based shell only requires updating one place.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@max-sixty
max-sixty enabled auto-merge (squash) March 26, 2026 05:14
@max-sixty
max-sixty merged commit bda6d33 into max-sixty:main Mar 26, 2026
22 checks passed
@saschabratton

Copy link
Copy Markdown
Contributor Author

thanks @max-sixty!

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.

wt config show emits false positive "not detected as integration" warning for Nushell

3 participants