Skip to content

100x is a skill by a former Cursor engineer that turns prompts into formally verified, production-ready code

Report each failing test as its own annotation, and let sh keep ~ inside a path

Glitchd3cfc777666f
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 7b29d3f..c7e8017 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -33,8 +33,9 @@ jobs:
# Temporary: the failing part of the log as one annotation, which a check run shows without a login.
- if: failure()
run: |
- msg=$(grep -E -A22 "^ *not ok" test.log | head -c 30000 | tr -d '\r' | sed 's/%/%25/g' | sed ':a;N;$!ba;s/\n/%0A/g')
- echo "::error title=failing tests::$msg"
+ tr -d '\r' < test.log | sed 's/%/%25/g' | awk '/^ *not ok/ { if (msg) print msg; msg = $0; n = 0; next } msg && n < 16 { msg = msg "%0A" $0; n++ } END { if (msg) print msg }' > failures.txt
+ wc -l failures.txt
+ head -10 failures.txt | while IFS= read -r line; do echo "::error title=failing test::${line:0:3000}"; done
- run: node bin/100x.mjs validate --prose
- run: node scripts/vendor-companions.mjs --check
- run: node scripts/stamp-skills.mjs --check
diff --git a/lib/eval/words.mjs b/lib/eval/words.mjs
index 6853254..620d5c7 100644
--- a/lib/eval/words.mjs
+++ b/lib/eval/words.mjs
@@ -33,5 +33,6 @@ export function wrap(text, { width = 100, indent = '' } = {}) {
// On Windows the path is written with forward slashes, which cmd, PowerShell and sh all take and which need no quoting.
export const shellPath = (path) => {
const text = process.platform === 'win32' ? path.replaceAll('\\', '/') : path;
- return /^[\w@%+=:,./-]+$/.test(text) ? text : `'${text.replaceAll("'", "'\\''")}'`;
+ // A ~ is safe inside a word, as in the short names Windows gives a long folder (RUNNER~1), and not at its start, where sh expands it.
+ return /^(?!~)[\w@%+=:,./~-]+$/.test(text) ? text : `'${text.replaceAll("'", "'\\''")}'`;
};
diff --git a/test/eval-screens.test.mjs b/test/eval-screens.test.mjs
index a1ed714..f8ecb47 100644
--- a/test/eval-screens.test.mjs
+++ b/test/eval-screens.test.mjs
@@ -7,13 +7,22 @@ import { presentChecks } from '../lib/doctor.mjs';
import { markRun } from '../lib/eval/blind.mjs';
import { ASK, routingReport, scoreRouting, WRONG_SHOWN } from '../lib/eval/routing.mjs';
import { controlWords } from '../lib/eval/tally.mjs';
-import { duration, plural, wrap } from '../lib/eval/words.mjs';
+import { duration, plural, shellPath, wrap } from '../lib/eval/words.mjs';
import { bakeoff, folder, judge, ON, ORDERS, OFF, recordModels, sees } from './bakeoff-helpers.mjs';
import { cli, ROOT, sandbox } from './helpers.mjs';
// A path as the commands write it, with / on every system.
const fwd = (p) => p.replaceAll('\\', '/');
+test('a path in a command is quoted when a shell would split or expand it, and not when it would not', () => {
+ assert.equal(shellPath('/work/bake-off/arms'), '/work/bake-off/arms');
+ assert.equal(shellPath('/work/with space/arms'), "'/work/with space/arms'");
+ assert.equal(shellPath("/work/it's"), "'/work/it'\\''s'");
+ assert.equal(shellPath('/Users/RUNNER~1/bake'), '/Users/RUNNER~1/bake', 'a short Windows folder name needs no quotes');
+ assert.equal(shellPath('~/bake'), "'~/bake'", 'a path that starts with ~ would be expanded by sh');
+ if (process.platform === 'win32') assert.equal(shellPath('C:\\Users\\me\\bake'), 'C:/Users/me/bake', 'on Windows the path is written with slashes');
+});
+
// What a person sees in the terminal and in the help. The numbers are tested elsewhere. These tests read the words.
const ev = (box, ...args) => cli(['eval', ...args], { cwd: box.project, env: box.env });
// A path is as long as the folder it names, so the lines that carry one are left out.