fix(core): guard JSON manifests that parse to a bare null - #122
Merged
Hydralerne merged 1 commit intoJul 22, 2026
Conversation
`JSON.parse("null")` succeeds and returns null, so the `catch` around the
parse doesn't cover the property access that follows. Three parsers read a
property straight off the result and throw a TypeError:
parseVercelConfig("null") -> parsed.installCommand
parsePackageJsonDeps("null") -> parsed.dependencies
parseComposerJson("null") -> parsed.require
The throw escapes parseDeploymentMetadata / the language detectors, so one
degenerate file aborts detection for the entire project rather than being
ignored.
metadata/railway.ts already carries this exact guard, with a comment saying
an unguarded null "would throw and crash the metadata pipeline". This
applies the same three-line check to its siblings.
Note a bare primitive (`42`, `"str"`) never threw — JS boxes those on
property access — so `null` is the only JSON literal affected.
Hydralerne
approved these changes
Jul 22, 2026
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
JSON.parse("null")succeeds and returnsnull, so atry/catcharound the parse doesn't cover the property access that comes after it. Three parsers read a property straight off the result:parseVercelConfigmetadata/vercel.tsparsed.installCommandparsePackageJsonDepslanguages/javascript.tsparsed.dependenciesparseComposerJsonlanguages/php.tsparsed.requireExecuted on
main:The TypeError escapes
parseDeploymentMetadataand the language detectors, so one degenerate file aborts detection for the whole project instead of being ignored like every other unusable manifest.This was already recognised once
metadata/railway.tscarries exactly this guard, with a comment naming the failure:Its three siblings never got it. This PR applies the same check, worded consistently and cross-referencing
railway.ts.Fix
Three lines, one per parser —
return nullfor the vercel config,return {}for the two dependency maps, matching each function's existing "unusable input" path.Scope note
A bare primitive (
42,"str") never threw — JS boxes those on property access, so they already fell through to an empty result.nullis the only JSON literal affected, which is why the guard istypeof !== "object" || === nullrather than a broader shape check.Tests
New
packages/core/test/null-json-manifest.test.ts— 6 cases (@repo/core89 → 95):nullparseDeploymentMetadatadoesn't throw and returns[]framework, npm deps + devDeps merged, composerrequire)catchpath is untouchedVerified against the unfixed source: the 4 null cases fail, and the 2 regression guards pass either way.
Full suite:
bun run test→ 5/5 turbo tasks successful (api 714, adapters 235, core 95, db 25, dashboard 17).