Repository navigation
bake: fix a plugin leak, ignoreDirs parsing, and a router crash - #45605
Conversation
|
@robobun adopt |
There was a problem hiding this comment.
Nothing blocking. The comments below are optional suggestions. There is no need to push a fix for them before merging.
Beyond the inline findings, I also checked two sibling concerns and ruled them out: parse_plugin_array stores the plugin in self.plugin before its first fallible call, so the single destroy_plugin() in the Err arm of UserOptions::from_js covers failures inside Framework::from_js and the top-level plugins parse too; and the other on_router_syntax_error site (src/runtime/bake/router/mod.rs:676) is not affected by the cursor bug, since every Err out of style.parse goes through TinyLog::fail, which sets cursor_at/cursor_len.
Extended reasoning...
The change touches the Bake config parser (src/runtime/bake/config/mod.rs, bundler.rs, framework.rs) and the file-system router (src/runtime/bake/router/mod.rs), plus three new subprocess tests; it touches no auth, crypto, or injection surface. Three inline findings were reported (an unvalidated ignoreDirs entry type, a vacuous-on-success leak test fixture, and a pre-existing plugin leak on the accepted-config path), so this note only records the sibling plugin-lifetime and router-cursor paths that were examined and found unaffected.
ee4f15c to
ed30f72
Compare
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughBake option parsing now destroys plugins when parsing fails. Router option parsing reads ChangesPlugin Cleanup
Router Options and Diagnostics
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
37 upstream commits: SQL consolidation (oven-sh#45304), bun lint/check/fmt rewrite (oven-sh#45595), b.bytes + bindgen Bun.* functions (oven-sh#45590), WebSocket closing handshake rewrite (oven-sh#45223), install/yarn.lock migration (oven-sh#45616), YAML.parse (oven-sh#45593), bake fixes (oven-sh#45605), file-behind-symlink installs (oven-sh#45477), WebKit bump 87ee10da087b (oven-sh#45567). Conflicts (14): src/install/{PackageInstall,PackageInstaller}.rs, src/jsc/bindings/c-bindings.cpp, src/uws_sys/libuwsockets.cpp + 10 tests. Resolution: upstream structure + re-applied OHOS patches (is_linked_folder package.json identity, OHOS ELF signing, is_executable_file access(X_OK), loop post handler) and the serialization policy (bun-audit/lifecycle/ catalogs: describe.concurrent/test.concurrent -> serial).
This PR fixes three bugs in the Bake config and router. Review bots found them on #45489. They were in the code before that PR.
The bugs
appconfig leaked the bundler plugin.Framework::from_jscreates the plugin when the framework hasplugins. If a later step failed (for exampleroot: 123),UserOptions::from_jsreturned the error, and nothing unprotected the plugin's JS object. Only theDropofUserOptionsfreed it, and that value was never built.fileSystemRouterTypes[].ignoreDirswas ignored. The parser walked the outerfileSystemRouterTypesarray instead of theignoreDirsarray. When a framework setignoreDirs, the router got one"[object Object]"entry per router type in its place, so it scanned every directory, including.gitandnode_modules.TinyLog::printsliced the path from indexu32::MAX.The fixes
SplitBundlerOptions::destroy_pluginfrees the plugin. TheDropofUserOptionscalls it, andUserOptions::from_jsalso calls it when parsing fails after the plugin exists.ignoreDirsfrom its own array. The error message no longer says that"*"is allowed, because it is not.Tests
test/bake/app-options.test.tshas one test for each bug. All three fail on Bun 1.4.3:BundlerPluginobjects instead of 0;ignoreDirstest reports the invalid route in the ignored directory;range start index 4294967295 out of range for slice of length 389.On a local debug build,
app-options,framework-router,dev/bundleanddev/htmlpass.