Repository navigation
fix: keep an unreadable version from failing a logged run - #237
Merged
Merged
Conversation
Member
|
Why can't we just use safely eagerly instead of carrying the thunk around? |
Member
|
(Thanks for the report and the PR!) |
Contributor
Author
|
Good point, that's simpler. Updated to |
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.
Problem
DESIGN_RUN_LOG.mdsays "Logging never fails a run." Whenlsccan't read its own version, though, a loggedcheckorregenfails before it starts. That happens whereverlscruns bundled, withoutpackage.jsontwo levels above the module:esbuild,bun build, or a compiled binary that embeds it.Reproduction
Expected
Both commands behave as without the run log.
LSC_RUN_LOG=false node ../lsc.mjs regen …writesf.dfyand exits 0.Actual
On
dd0847e, both exit 1 before generating anything:Root cause
lsc.tspasseslscVersion()tonew RunLog(…), so the version is read eagerly, outside thesafelywrapper that the run log uses for every other filesystem read.lscVersionreadspackage.jsonby a path relative to the module, which a bundle doesn't have.Fix
lsc.tspassessafely(lscVersion)toRunLog, the wrapper the run log already uses for every other read, so a version that can't be read is recorded as"lsc": nulland the run continues.safelyis now exported fromrun-log.ts.isVerifyRecorddoesn't checklsc, solsc runsreads these records unchanged.DESIGN_RUN_LOG.mdsays the field may benull.lsc versionandinfo --typedstill read the version the same way; this PR only stops the run log from failing a run.Regression
a version that can't be read is recorded as nullintools/tests/run-log.test.ts.Validation
npm run build: pass.npm run typecheck,(cd tools && npm run typecheck)andnpm run typecheck:examples: pass.npx tsx --test tools/tests/*.test.tson Windows, Node 24.15: 227 passed and 29 failed with the change, against 226 passed and 29 failed ondd0847e. The failing set is identical: the existing CLI-subprocess tests that hit absolute ESM loader paths on Windows. Not run on Linux.regenandcheckexit 1. After,regenexits 0 andcheckreports1 verified, 0 errors; both records are written with"lsc": null.tools/test-fixtures.shwas not run: it starts with the unit suite, which stops on the Windows failures above.Compatibility
No new option, syntax or dependency. The record schema stays at
v: 1, andlscstays a string whenever the version can be read.