Repository navigation
fix: Windows tar for rg auto-install, GNU grep fallback fixes, portable tests - #23
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The suite was written and run on Linux. On Windows about 176 tests failed, and on Linux 12 depended on the readdir order of the temp filesystem. Almost all of them were test assumptions: GNU grep on PATH, POSIX shebang fakes,
/in expected paths, file names NTFS cannot hold. Looking into them turned up three product bugs and a misleading README line.Production changes
utils/zip-extractor.ts: on Windows the rg auto-install now runs%SystemRoot%\System32\tar.exefor the probe and the extraction. It used to runtarfrom PATH. When OpenCode is started from Git Bash or MSYS2, Git's GNU tar comes first and fails on drive letters (tar: Cannot connect to C: resolve failed). betterglob could not install rg at all, and bettergrep fell back to an old GNU grep. IfSystemRootis not set, the existingExpand-Archivebranch is used.tools/grep/fallback.tsandfallback-content.ts: GNU grep older than 3.5 printsBinary file X matcheson stdout, not stderr. The fallback now recognizes that line, does not count it as a match, marks the result as truncated and adds the same warning as the stderr case. Before, the result looked complete and had one match fewer than rg.json-stream.tsgains apeek()the parser needs for this.tools/grep/path-utils.ts:resolveAbsolutePathalso normalizes absolute paths, so on Windows the GNU grep fallback no longer returns mixed separators such asC:\repo\src/a.ts.nodeon PATH is required in every session. The README said a validated rg on PATH could search without it, but the validation is kept in memory and runs again in each process.Each of the three code fixes has one new test that fails on
main.Test changes
sort: mtimewere sorted by readdir order, since the fallback ignores mtime. They are now sorted, so they pass on tmpfs, ext4 and NTFS.LOCALAPPDATAas well asXDG_CACHE_HOME. On Windows they wrote into the real managed-rg cache and downloaded from the network./on purpose (permission patterns), the expectation no longer usespath.join.CONTRIBUTING.mdlists what the tests need: Bun 1.4.4 or newer,node,rg, and GNU grep 3.5 or newer for the fallback tests.Verification
Bun 1.4.4.
check,typecheckandbuildare clean in the three packages on both systems.No test fails. The skips on Linux are the new Windows-only tests.
bun test -uleaves the snapshots unchanged, and the realLOCALAPPDATAcache is not touched by the tests.Version 1.2.3 for the three packages and the root.
Refs #21: the auto-install no longer depends on finding
tarthrough PATH.