Skip to content

Fix import config/CA completion (cross-dir search + coloring) - #27

Merged
maxlandon merged 3 commits into
mainfrom
dev
Jul 18, 2026
Merged

Fix import config/CA completion (cross-dir search + coloring)#27
maxlandon merged 3 commits into
mainfrom
dev

Conversation

@maxlandon

Copy link
Copy Markdown
Member

The import command completers were supposed to search other teamserver applications' directories for connection configs / user-CA files and highlight them, but the feature was effectively dead and later a fix removed default file coloring.

Fixes

  • Cross-directory search returned nothing. isConfigDir had an inverted condition — with noSelf=true (which both import commands use) it required a directory to be the current app and then rejected it, so no other-app config was ever found.
  • CA files never listed. ConfigsCompleter skipped any file that didn't parse as a teamclient config, so .teamserver.pem CA files never appeared under teamserver import. It now lists matching-extension files, adding the [user] host:port description only when the file parses as a config.
  • Directories lost their color. GetConfigStyle returned "" for non-config files; chained onto ActionFiles() it replaced carapace's default style.ForPath coloring, so directories (blue) and other typed files went uncolored. It now falls back to style.ForPath — config/CA files are highlighted red, everything else keeps its normal coloring.
  • Server import CA had no styling. It now shares the exported GetConfigStyle.

Tests

Unit tests for isConfigDir (the inversion) and GetConfigStyle (highlight + default-styling fallback). Full suite passes with -race.

🤖 Generated with Claude Code

The `import` completers (client configs and server user-CA) were supposed
to look through other teamserver apps' directories and highlight config
files, but several things were broken:

- isConfigDir had an inverted condition: with noSelf=true (both import
  commands) it required the dir to equal the current app AND then
  rejected it, so the cross-application search always returned nothing.
- ConfigsCompleter skipped every file that didn't parse as a teamclient
  config, so CA .pem files never showed up under `teamserver import`.
- GetConfigStyle (was unexported getConfigStyle) returned "" for
  non-matching files. Chained onto ActionFiles(), that REPLACED
  carapace's default style.ForPath styling, so ordinary files - most
  visibly directories - lost their color. It now falls back to
  style.ForPath, so configs are highlighted while directories stay blue.
- The server `import` CA file completion had no styling at all; it now
  shares the exported GetConfigStyle.

Add unit tests for isConfigDir and GetConfigStyle.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
CI intermittently failed on the unix (-race) jobs with "wasm error: out
of bounds memory access" deep inside ncruces SQLite query execution
(never on the windows job, which runs without -race). The optimizing
wazero compiler emits native code the Go race detector cannot instrument,
which occasionally traps under -race.

Split the runtime configuration by build tag: normal builds keep the
optimizing compiler with the persistent on-disk compilation cache (fast
startup, ~19ms warm); the `race` build selects wazero's pure-Go
interpreter, which is race-clean. Startup caching is irrelevant to test
binaries, so nothing is lost there.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 29.59%. Comparing base (720d5fe) to head (c1756e7).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
client/commands/commands.go 36.36% 7 Missing ⚠️
internal/db/sqlite_runtime.go 60.00% 1 Missing and 1 partial ⚠️
internal/db/sqlite_runtime_race.go 60.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #27      +/-   ##
==========================================
+ Coverage   29.29%   29.59%   +0.30%     
==========================================
  Files          60       61       +1     
  Lines        4031     4017      -14     
==========================================
+ Hits         1181     1189       +8     
+ Misses       2714     2695      -19     
+ Partials      136      133       -3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

The persistent wazero compilation cache populated itself with a
temp-file-then-rename. On Windows, that rename fails ("Access is denied")
when another process holds the destination, and ncruces turns it into a
fatal connection error — so concurrent cold starts (parallel `go test`
packages, or a user launching several teamserver processes at once)
broke. It surfaced as flaky Windows CI.

Compile the module once while holding a cross-process advisory lock
(O_CREATE|O_EXCL lock file, with stale-lock stealing), so only one
process writes the cache; the rest wait and then read it warm. Reads
never collide, so warm startup stays ~20ms and query speed is unchanged.

The race build keeps the interpreter (no cache, no lock) from the
previous commit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@maxlandon
maxlandon merged commit 46b3581 into main Jul 18, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants