Repository navigation
fix(x): 修复前端懒加载分包缺少可选操作 Bookmarks 的 queryId - #67
Merged
Merged
Conversation
- Expand Webpack and Vite lazy-chunk manifest discovery to support >160-char shared~* bundle names (up to 512 chars), reverse-order and ternary chunk tables, runtime `}[e]+".js"` suffixes, Vite `__vite__mapDeps` relative paths, `main.*.js` `/i/bookmarks` and `/likes` route loaders, `Promise.all([n.e(...)])` co-loaded numeric chunks, and 2nd-hop child chunk imports inside route wrappers. - Prioritize `bundle.Bookmark(s)`, `loader.*Bookmark*`, `shared~*Bookmark(s)*`, and route-linked chunks ahead of secondary `BookmarkFolders` UI bundles, keeping generic fallback chunks capped at <=2 and high-confidence chunks at <=4. - Support Webpack 5 Harmony `n.d(...)` exports, CommonJS property assignments, module-scoped hoisted identifiers, ES6 object spread/shorthand/computed keys, `BookmarkTimeline`/`BookmarksTimeline` operation aliases, nested `viewer` bookmark timeline envelopes, and `features cannot be null` switch healing from `__INITIAL_STATE__` on refresh replay. - Add synthetic Webpack and Vite lazy-chunk fixtures and unit/client tests, and update `docs/research/x.md` (zero real X requests). Closes #59 Signed-off-by: chialecode <315431287+chialecode@users.noreply.github.com>
Owner
Author
|
Agent:可合并 已审查范围(头提交
|
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.
Closes #59
做了什么
修复“我的 › X › 书签”因前端懒加载分包无法提取
Bookmarks操作而报错X 前端分片缺少可选操作 Bookmarks 的 queryId,其他核心功能不受影响(关联FR-X-008、NFR-NET-005、NFR-SEC-005):internal/site/x/frontend.go):shared~bundle...~bundle.Bookmarks...共享分包),按独立<script>块做完整线性扫描(消除 256 KiB 截断,隔离__INITIAL_STATE__干扰,支持哈希表位于名称表之前、三元表达式名称映射、无引号键名,以及}[e]+".js"已带尾缀a的构建变体);__vite__mapDeps等相对于应用根的assets/.../chunks/.../client-web/...路径,避免main位于/assets/子目录时重复拼接路径;main.*.js中的Promise.all([n.e(...), ...])并列分包、/i/bookmarks与/likes路由加载器引用的无名数字分包(<chunkId>.<hash>a.js),并在首个路由壳分包未命中时按需追踪其内部嵌套的n.e(...)/import(...)二跳子分包(对Bookmarks与Likes统一生效);bundle.Bookmark(s)、loader.*Bookmark*、shared~*Bookmark(s)*及路由关联分包排在仅含BookmarkFolders的界面分包之前;通用兜底分包维持 ≤ 2 次上限,高置信度专属/路由关联分包最多拉取 4 个(全程单飞、无 Cookie、abs.twimg.com/responsive-web/白名单、≤ 8 MiB 上限与 10 分钟冷却)。frontend.go、graphql.go、account.go):n.d(t, {...})导出(按函数模块边界隔离单字母提升变量)、CommonJS 属性赋值(t.queryId=...; t.operationName=...)、ES6 对象展开/简写属性/计算属性/方法简写、高达 128 KiB 的外层 AST 对象及局部浅窗回退,并支持BookmarkTimeline/BookmarksTimeline操作名变体回退(同时存在时严格优先使用Bookmarks);400 features cannot be null时,在单次冷却重刷后用__INITIAL_STATE__/main.*.js默认开关补齐缺失布尔键并重放一次,且可选操作刷新冷却不误触发整站自动熔断;ListBookmarks额外兼容data.viewer.bookmark_timeline_v2(及viewer.user_results.result)嵌套容器;按docs/research/x.md§15.1 第 4 条不在仓库内置易过期的硬编码queryId字面量。testdata/webpack_lazy_bookmark_route.js、webpack_lazy_bookmarks_harmony.js、vite_lazy_bookmarks.js)及覆盖上述全部分包形态与自愈边界的单测/客户端测试,同步更新docs/research/x.md。验证
TRACE_REFERENCE_DIR=<本机参考索引目录> go run ./tools/check(退出码0,耗时4m19.37s:gofmt、go vet ./...、go test ./...、依赖方向、trace-serverLinuxamd64/arm64构建与GOOS=linux go vet、tools/checkdocs含本地参考索引词项扫描、git diff --check HEAD全部通过;已在同一提交f5c0216本地跑完完整门禁,因此推送使用git push --no-verify避免重复执行同一门禁)go test -v -run "TestFrontendDiscoveryWebpackRealisticSplitBookmarksAndLikes|TestFrontendDiscoveryViteMapDepsAndOperationAliases|TestGraphQLMissingNullFeaturesSelfHealOnRefreshReplay" ./internal/site/x/...(退出码0)not-run):go test -race ./...:not-run(本机无 cgo 工具链)0次(not-run,X 不在常设授权范围内,全程使用合成夹具验证;线上实盘检查归口 授权:X 真实站点补测(≤ 32 次请求,1 次运行) #18ACT-025)风险
internal/site/x内部前端分包发现、操作解析与书签容器兼容及docs/research/x.md,未触碰docs/dev-rules/workflow.md#high-risk高风险清单,不改跨包接口、凭证存储、数据迁移或真实站点账本)risk:high,等用户合并)每个提交都带
Signed-off-by(git commit -s)。