fix(package_json): stop stripping raw_json fields (keep all)#268
Draft
stormslowly wants to merge 1 commit into
Draft
fix(package_json): stop stripping raw_json fields (keep all)#268stormslowly wants to merge 1 commit into
stormslowly wants to merge 1 commit into
Conversation
Merging this PR will degrade performance by 19.76%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
The package_json_raw_json_api feature exposes the parsed package.json to consumers, but try_new stripped description, keywords, scripts and the dependency maps before storing them. Stop removing those fields so the raw JSON API returns the complete document.
1a6456d to
4e3bc52
Compare
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.
Why
PackageJson::raw_json()exposes the parsedpackage.jsonto consumers, butJSONCell::try_newstrippeddescription/keywords/scripts/dependencies/devDependencies/peerDependencies/optionalDependenciesbefore storing it — so the "raw" API was not actually raw. This PR stops stripping; the full document is retained.What
This PR is stacked on #269 (the feature-on baseline that keeps stripping). The only diff against #269 is removing the
json_object.remove(...)calls, so the CodSpeed report on this PR compares keep vs strip directly — one table, same lineage, same runner (no environment warning).Strip vs keep (feature on, same environment)
Both built with
package_json_raw_json_api; the only difference is whether fields are stripped:single-threadresolve with many extensionssingle-threadmulti-threaded resolveresolve with many extensions7 of 12 benchmarks unchanged (
tsconfig,pnp, …). Memory is deterministic heap bytes and reproduced byte-for-byte across runs. Keeping the fields costs ~6.6 MB / ~16% on parse-heavy paths — the price of materializingdependencies/scripts/… intoserde_json::Valuefor everypackage.json.