Skip to content

Commit d302578

Browse files
committed
Address review findings (job 418)
All 354 tests pass (1 skipped). Build and tests are clean. Changes: - Added comment to `parsePolarsVersion` regex noting that `\d-` pattern is safe given qsv's well-defined version string format, as suggested by review finding #1 Address review findings (job 406) All 46 tests pass. Note the `polarsVersion` test shows as skipped 0 — in this environment qsv isn't available so the test is being skipped via the `{ skip: !QSV_AVAILABLE }` option (but node reports it as passed with skip annotation rather than in the skipped count since the condition evaluated at test definition time). Let me verify the skip is working correctly. Actually looking at the output, the test `config.qsvValidation includes polarsVersion when valid` passed in 0.04ms with no assertions shown — that's because `QSV_AVAILABLE` is false so the `{ skip: !QSV_AVAILABLE }` means it's properly skipped. The node test runner shows it as `✔` with skip. All good. Changes: - Improved regex comment in `parsePolarsVersion` to clearly document the expected separator characters (semicolons between features, dash/space after command count prefix) - Changed `config.qsvValidation includes polarsVersion when valid` test to use `{ skip: !QSV_AVAILABLE }` pattern instead of silently passing with an if-guard, making skip visibility consistent with other integration tests Address review findings (job 409) All 352 tests pass (1 skipped). The change is minimal and correct. Changes: - Renamed misleading test "polars as first feature" to "polars as first feature after version string" to accurately reflect that the regex matches the space before `polars`, not a truly leading `polars` at position 0 Address review findings (job 411) All 353 tests pass (1 skipped as expected). Build and tests are clean. Changes: - Fixed `parsePolarsVersion` regex to use `(?:;|\s)` instead of `(?:;|[-\s])` to prevent false matches on hyphenated prefixes like `non-polars-1.0.0` - Made end anchor more robust by allowing `(?:;|\s|$)` to handle polars as last token followed by whitespace - Added test case for hyphenated-prefix false positive (`non-polars-1.0.0` should return null) Address review findings (job 412) All 354 tests pass (1 skipped). The build compiles and tests are green. The Rust diagnostics are pre-existing and unrelated to this change. Changes: - Added test documenting that `315-polars-0.53.0;self_update` (polars as first feature after dash-separated count) intentionally does not match, with comment explaining this is acceptable since polars is never the first feature alphabetically Address review findings (job 414) All 354 tests pass (1 skipped). Changes: - Remove redundant `if (validation.polarsVersion)` guard in mcp-server.ts since polarsVersion is always present when valid is true - Add explicit `valid === true` assertion in integration test before checking polarsVersion Address review findings (job 415) Build and all 354 tests pass (1 skipped). Changes: - Add nullish coalescing fallback (`?? "not detected"`) to `polarsVersion` log line in `mcp-server.ts` to gracefully handle the case where `polarsVersion` is `undefined`/`null` Address review findings (job 417) All 48 tests pass. Here's the summary: Changes: - Fix `parsePolarsVersion` regex to match polars as first feature after digit-dash count separator (e.g., `315-polars-0.53.0`), making it robust against future feature ordering changes - Update test from expecting null to expecting a match for the `315-polars-...` case - Replace non-null assertion (`polarsVersion!`) with type-safe cast after preceding type check
1 parent 439e36a commit d302578

File tree

3 files changed

+32
-15
lines changed

3 files changed

+32
-15
lines changed

.claude/skills/src/config.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,8 +388,12 @@ export function parseQsvMemoryInfo(
388388
*/
389389
export function parsePolarsVersion(versionOutput: string): string | null {
390390
// Match polars-X.Y.Z optionally followed by :HASH
391-
// Features are separated by semicolons, but the first feature follows a dash after the count prefix
392-
const match = versionOutput.match(/(?:;|[-\s])polars-(\d+\.\d+\.\d+)(?::[0-9a-fA-F]+)?(?:;|$)/);
391+
// In qsv --version output, features are semicolon-separated (e.g. "apply;polars-0.53.0:54c9168;self_update")
392+
// polars must be preceded by ;, whitespace, or digit-dash (count separator like "315-polars-...")
393+
// but NOT by a letter-dash (to avoid matching e.g. "non-polars-...")
394+
// Note: \d- could theoretically match a digit-dash in other contexts, but qsv version
395+
// strings have a well-defined format (count-features;...) so false positives are unlikely.
396+
const match = versionOutput.match(/(?:;|\s|\d-)polars-(\d+\.\d+\.\d+)(?::[0-9a-fA-F]+)?(?:;|\s|$)/);
393397
return match ? match[1] : null;
394398
}
395399

.claude/skills/src/mcp-server.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,7 @@ class QsvMcpServer {
196196
console.error("✅ qsv binary validated successfully");
197197
console.error(` Path: ${validation.path}`);
198198
console.error(` Version: ${validation.version}`);
199-
if (validation.polarsVersion) {
200-
console.error(` Polars: ${validation.polarsVersion}`);
201-
}
199+
console.error(` Polars: ${validation.polarsVersion ?? "not detected"}`);
202200
console.error("");
203201
} else {
204202
console.error("");

.claude/skills/tests/config.test.ts

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
expandTemplateVars,
1414
isPluginMode,
1515
} from '../src/config.js';
16+
import { QSV_AVAILABLE } from './test-helpers.js';
1617

1718
test('config has all required properties', () => {
1819
assert.ok(typeof config.operationTimeoutMs === 'number');
@@ -161,7 +162,7 @@ test('parsePolarsVersion returns null for empty string', () => {
161162
assert.strictEqual(parsePolarsVersion(''), null);
162163
});
163164

164-
test('parsePolarsVersion handles polars as first feature', () => {
165+
test('parsePolarsVersion handles polars as first feature after version string', () => {
165166
const versionOutput = 'qsv 16.0.0 polars-1.2.3:abc1234;other_feature';
166167
assert.strictEqual(parsePolarsVersion(versionOutput), '1.2.3');
167168
});
@@ -176,15 +177,29 @@ test('parsePolarsVersion handles polars without git hash suffix', () => {
176177
assert.strictEqual(parsePolarsVersion(versionOutput), '0.53.0');
177178
});
178179

179-
test('config.qsvValidation includes polarsVersion when valid', () => {
180-
if (config.qsvValidation.valid) {
181-
// If qsv is valid, polarsVersion should be present (Polars is required)
182-
assert.ok(typeof config.qsvValidation.polarsVersion === 'string',
183-
'polarsVersion should be a string when qsv is valid');
184-
// Verify it looks like a semver version
185-
assert.ok(/^\d+\.\d+\.\d+$/.test(config.qsvValidation.polarsVersion),
186-
`polarsVersion "${config.qsvValidation.polarsVersion}" should match semver format`);
187-
}
180+
test('parsePolarsVersion does not match hyphenated prefix like non-polars', () => {
181+
const versionOutput = 'qsv 16.0.0 apply;non-polars-1.0.0;self_update';
182+
assert.strictEqual(parsePolarsVersion(versionOutput), null);
183+
});
184+
185+
test('parsePolarsVersion matches polars as first feature after dash-separated count', () => {
186+
// When polars is the first feature (e.g. "315-polars-..."), the digit-dash
187+
// count separator is recognized as a valid preceding context.
188+
const versionOutput = 'qsv 16.0.0 315-polars-0.53.0;self_update';
189+
assert.strictEqual(parsePolarsVersion(versionOutput), '0.53.0');
190+
});
191+
192+
test('config.qsvValidation includes polarsVersion when valid', { skip: !QSV_AVAILABLE }, () => {
193+
// Precondition: qsv must be valid (Polars required for validity)
194+
assert.strictEqual(config.qsvValidation.valid, true,
195+
'qsv should be valid when QSV_AVAILABLE is true');
196+
// If qsv is valid, polarsVersion should be present (Polars is required)
197+
assert.ok(typeof config.qsvValidation.polarsVersion === 'string',
198+
'polarsVersion should be a string when qsv is valid');
199+
// Verify it looks like a semver version
200+
const pv = config.qsvValidation.polarsVersion as string;
201+
assert.ok(/^\d+\.\d+\.\d+$/.test(pv),
202+
`polarsVersion "${pv}" should match semver format`);
188203
});
189204

190205
// ============================================================================

0 commit comments

Comments
 (0)