波次0-P2 模块卫生:hello 认证去重 + /life/* 收紧 + 参考实现达标(#82) - #84
Merged
Conversation
- 删 createAuthMiddleware 死码(从未挂载,认证统一 requireAuth 收口,#45 遗留项①) - GET /life/export、POST /life/purge 挂 requireAuth 与 /api/count 同规(缺 CORE_JWKS_JSON 503、无 Bearer 401 人话;#45 遗留项②) - 页面内联样式改 var(--color-*) 同名 token(tokens.css 单源),源内零裸 hex(grep 零命中) - 测试:export 响应喂活 ExportBundleSchema.parse(lifecycle-schema.ts);新增匿名调 /life/* → 401 用例;export/purge 用例按新契约带 token Signed-off-by: HandyWote <huangyinghui01@corp.netease.com>
ModuleLifecycle 对象接口暂未运行时接入——真值是 GET /life/export + POST /life/purge;对象接口 M6 卸载编排时接入 Signed-off-by: HandyWote <huangyinghui01@corp.netease.com>
This was referenced Sep 9, 2026
Closed
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.
背景
issue #82(波次0-P2):M0 审查发现 hello 参考实现带病——两份认证实现一份是死代码、/life/* 裸奔、export 形状无校验、样式裸 hex。#45①② 的落地。
改动
1. 认证去重(#45①)
modules/hello/src/index.ts的createAuthMiddleware(导出但从未挂载的死代码,grep 全仓零引用)requireAuth收口(本文件唯一验签实现,/api/* 与 /life/* 共用)2. /life/* 收紧(#45②)
GET /life/export、POST /life/purge挂requireAuth,与/api/count同规:无 Bearer → 401 人话(不含 jose/jwt 原始错误);缺 CORE_JWKS_JSON → 503;export 同时补齐 storage 缺绑定 503(与 count/purge 一致,不再静默导出 0 行)3. export 形状机器校验(喂活 contracts)
ExportBundleSchema.parse断言/life/export响应形状(version/moduleId/exportedAt/tables/files),lifecycle-schema.ts 从此被真实消费4. 页面样式 tokens 化(§6.5 单源)
<style>裸 hex 全部改var(--color-*)(与 apps/shell/src/tokens.css 同名),间距/字号/圆角同步取 tokens(--space-* / --font-size-* / --radius-*):root保留一份与 tokens.css 同名同值的副本(值以rgb()表达,与十六进制等价且源内零裸 hex,满足验收 grep)。唯一单源的终极形态(令牌下发/共享 css 资产)建议后续轮次做5. contracts 契约真值标注
packages/contracts/src/lifecycle.ts注释标注:M0/M1 真值 = HTTP 端点(GET /life/export、POST /life/purge);ModuleLifecycle对象接口 M6 卸载编排时接入,此前只是形状约定测试
/life/export、/life/purge→ 401 人话ExportBundleSchema.parse(带 token;形状断言保留 rows 深等);purge 用例按新契约带 tokenpnpm -r typecheck && pnpm -r test && pnpm -r build全绿(7 包 typecheck 过;test 7 包全过;build 过)grep -E '#[0-9a-fA-F]{3,8}'于 modules/hello 零命中验收对照
附属观察(供主会话,非本 PR 范围)
m1/issue-83(reflog:HEAD@{0}),工作目录同时残留 波次0-P1 后端卫生:token 契约对真 + core-api 拆分 + 身份行接通 #81/波次0-P3 前端卫生:壳拆分 + 死代码清理 + 手机登出 #83 的未提交改动。本 PR 在独立 worktree(/tmp/unself-issue82)中验证提交,未混入任何外来改动;但建议主会话确认并行会话的分工与目录隔离策略(AGENTS「一个 issue 一个新会话」在共享 tree 下会互相踩)tsconfig.base.json有未提交改动(新增"noUnusedLocals": true),会让 base 的packages/uitypecheck 挂(input.vue TS6133)——疑似 波次0-P1 后端卫生:token 契约对真 + core-api 拆分 + 身份行接通 #81/波次0-P3 前端卫生:壳拆分 + 死代码清理 + 手机登出 #83 侧的本地实验,未纳入本 PR;三件套验证在干净 worktree 完成