-
Notifications
You must be signed in to change notification settings - Fork 229
fix: resolve 4 bugs in termui #3651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -380,7 +380,7 @@ export class DevServer { | |||||
|
|
||||||
| this._killChild(); | ||||||
|
|
||||||
| await exitedPromise.catch(() => {}); | ||||||
| await exitedPromise.catch( => console.error()); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win Fix the malformed Line 383 is invalid TypeScript because the arrow function has no parameter list. Pass the rejection value to Proposed fix- await exitedPromise.catch( => console.error());
+ await exitedPromise.catch((error) => console.error(error));📝 Committable suggestion
Suggested change
🧰 Tools🪛 Biome (2.5.6)[error] 383-383: Expected a parenthesis '(' but instead found '=>'. (parse) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||
|
|
||||||
| if (this._running && this._entryFile) { | ||||||
| this._spawnChild(); | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,7 +182,7 @@ function _pathsEqual(a: number[], b: number[]): boolean { | |
|
|
||
| function _valuesEqual(a: string[], b: string[]): boolean { | ||
| if (a.length !== b.length) return false; | ||
| const sortedA = [...a].sort(); | ||
| const sortedA = [...a].sort((a, b) => a - b); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
if rg -n 'sort\(\(a, b\) => a - b\)' packages/ui/src/TreeSelect.ts; then
echo "Invalid string-subtraction comparator remains." >&2
exit 1
fiRepository: Karanjot786/TermUI Length of output: 257 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '--- TreeSelect relevant lines ---\n'
sed -n '160,195p' packages/ui/src/TreeSelect.ts
printf '\n--- TreeSelect test string values ---\n'
sed -n '1,120p' packages/ui/src/TreeSelect.test.ts
printf '\n--- TypeScript compiler/type presence ---\n'
if [ -f package.json ]; then cat package.json | sed -n '1,220p'; fi
node - <<'JS'
const fs = require('node:fs');
for (const name of ['package.json','tsconfig.json','packages/ui/tsconfig.json','packages/tsconfig.json']) {
if (fs.existsSync(name)) console.log(name, fs.readFileSync(name,'utf8'));
}
JSRepository: Karanjot786/TermUI Length of output: 247 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '--- TreeSelect relevant lines ---'
sed -n '160,195p' packages/ui/src/TreeSelect.ts
printf '%s\n' ''
printf '%s\n' '--- TreeSelect test string values ---'
sed -n '1,120p' packages/ui/src/TreeSelect.test.ts
printf '%s\n' ''
printf '%s\n' '--- TreeSelect type/status definitions ---'
sed -n '1,120p' packages/ui/src/TreeSelect.ts
printf '%s\n' ''
printf '%s\n' '--- TypeScript compiler/type presence ---'
node - <<'JS'
const fs = require('node:fs');
const paths = ['package.json','tsconfig.json','packages/ui/tsconfig.json','packages/tsconfig.json'];
for (const name of paths) {
if (fs.existsSync(name)) {
console.log(`--- ${name} ---`);
console.log(fs.readFileSync(name, 'utf8'));
}
}
JS
printf '%s\n' '--- Search TreeSelect equality comparator context ---'
rg -n 'selectedHasAll|sortedA|sortedB|Set|selected' packages/ui/src/TreeSelect.tsRepository: Karanjot786/TermUI Length of output: 11434 🏁 Script executed: #!/usr/bin/env bash
set -u
# Use read-only checks and print only the relevant lines under each section.
printf '%s\n' '--- _valuesEqual implementation ---'
sed -n '174,192p' packages/ui/src/TreeSelect.ts
printf '%s\n' '--- _valuesEqual callers ---'
rg -n '_valuesEqual|selectedValues|toggleSelection' packages/ui/src/TreeSelect.ts
printf '%s\n' '--- behavioral probe for current comparator ---'
node - <<'JS'
function sortedComparison(a, b) {
const sortedA = [...a].sort((a, b) => a - b);
const sortedB = [...b].sort();
return sortedA.map((v, i) => ({ sortedA: v, sortedB: sortedB[i], equalAt: v === sortedB[i] }));
}
console.log(JSON.stringify({
subtractionValuesForStrings: ['s', 'a', 'l'].map((a, i) => ({ a, b: i < 2 ? ['s','a','l'][i + 1] : undefined, sub: a - (i < 2 ? ['s','a','l'][i + 1] : 'undefined') })),
stringArrays: ['s','a','b','l'],
result: sortedComparison(['s','a','b','l'], ['s','a','b','l'])
}, null, 2));
JSRepository: Karanjot786/TermUI Length of output: 1733 Use a string-safe equality strategy for both arrays. Line 185 subtracts Use 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| const sortedB = [...b].sort(); | ||
| for (let i = 0; i < sortedA.length; i++) { | ||
| if (sortedA[i] !== sortedB[i]) return false; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Karanjot786/TermUI
Length of output: 156
🏁 Script executed:
Repository: Karanjot786/TermUI
Length of output: 312
Apply epsilon before scaling.
Line 107 adds
Number.EPSILONafter multiplying by100.Number.EPSILONis too small at this magnitude to correct every half-percent boundary, so values like0.285can round to28instead of29. Add epsilon before scaling.🤖 Prompt for AI Agents