dsh-agent
954d626afc
refactor(stage8): 建表语句集中到 server/db/schema,并修复只读模式的漏写
...
问题
- 4 处运行时 DDL(scheduling / ele / feedback / mileage 日报)分散在路由与 store 里;
- 只读保护只按 HTTP 方法拦截,而建表由 GET 处理器触发,
于是 DB_READ_ONLY=1 的"只读预览"仍可能执行 CREATE TABLE / ALTER TABLE(已记录在案的漏洞)。
改动
- 新增 src/server/db/schema/{guard,scheduling,ele,feedback,mileage-report}.ts:
建表/改表的唯一位置;guard 提供 ddlAllowed(),DB_READ_ONLY=1 时每个 ensure* 直接跳过并打印一行日志。
- daily-report-store 的表名改为从 schema 模块导出,避免两处各写一份表名。
- 移除 feedback/index.ts 与 ele/migration.ts 中的内联 DDL。
验证
- 实测:DB_READ_ONLY=1 下依次调用 4 个 ensure*,全部跳过且未触碰数据库(无连接错误/挂起)。
- 架构测试新增 2 条:DDL 只允许出现在 server/db/schema;每个 schema 模块必须检查 ddlAllowed()。
lint / test(139) / build 全绿。
2026-09-11 10:29:50 +08:00
dsh-agent
507bc90ed2
refactor(stage5): 合并重复实现,移除失效的演示能力
...
Excel 导出(原先 4 份各自拼装 workbook)
- 新增 src/shared/xlsx.ts 作为唯一实现:文件名统一 .xlsx、sheet 名截断到 31 字符,
对外提供 buildAoaSheet / buildJsonSheet / writeWorkbook / exportAoaSheet / exportJsonSheet。
只收敛"组装与写出"这一层,各调用方仍自行决定列宽、冻结与数字格式,导出样式不变。
- 迁移 assets(内联 json_to_sheet + writeFile)、mileage/xlsx-export、
hydrogen 的两份 helper(prototype-download.ts 与 download-xls.js,均已删除)。
高德地图(原先 2 份近乎逐行复制)
- 新增 src/shared/amap.ts:SDK 版本、插件列表、安全码注入、底图参数、
控件位置与热力图色带只在此处定义;两个画布只保留各自的半径/透明度。
- 图例渐变条原先把同一组色值又写了一遍,改为复用 shared 的常量,图例与地图不会漂移。
数值格式化
- 两个下钻视图各自复制了同样的 formatNumber/format(共 42 处调用),
统一到 hydrogen/model/display-format.ts 的 formatFixed;默认路径与既有行为逐字一致。
- 原 display-format.ts 里的 finiteNumber/formatNumber/formatScaled 无任何生产调用方,
只被自己的测试引用;改为 formatFixed + blankForMissing 显式选项,
既保留了"真零 vs 不可用"的区分能力,也不再留无人使用的导出。测试同步重写。
失效的演示能力
- Blur / DemoModeProvider 恒为 enabled=false,等于永久 no-op:
移除 13 个文件里 50 处 <Blur> 包裹(渲染结果不变)、删除 components/Blur.tsx
与 Shell 中的 Provider,调用方直接渲染原表达式。
未做(刻意)
- src/lib/cn.ts 不引入 tailwind-merge:全仓只有 2 处调用,不值得新增传递依赖。已在文档说明。
架构守护新增 2 条:只有 shared/amap.ts 可加载高德 SDK;
modules/** 不得再出现 book_new / book_append_sheet / writeFile(。
lint / test(137) / build 全绿,可达性仍为 0 未引用文件。
2026-09-11 10:28:32 +08:00
dsh-agent
5d14a28b0f
refactor(stage6): 去掉热力图写死的默认区间与线上文件的演示数据
...
热力图默认区间
- 新增 src/shared/date-range.ts(近 N 天滚动窗口,按本地自然日)。
- 前端两个热力图与后端两个 query 模型原先都把默认区间写死为
2026-01-01 ~ 2026-07-13,会随时间永久指向一段历史数据;
现改为"近 30 天"滚动,并把 now 作为可注入参数以便测试。
- 两个 model 测试改为注入固定时钟并断言滚动窗口,不再硬编码日期。
氢能看板去演示数据(board/EnergyBiBoardApp.tsx,6554 -> 3765 行)
- 取消线上路径的 mock 兜底:省份下拉、站点汇总表、客户费用汇总表、
区域排行在 overview 未就绪时显示空,而不是假的 25 个站点 / Top30 账单。
- 删除已确认"零渲染点"的死代码(用 TypeScript AST 精确定位声明范围,
避免手工推断括号边界):
KpiDrillModal / CustomerBillDrillModal / StationBillDrillModal /
DrillPeriodControls / getYearTimeRange / getDrillTimeRange /
MOCK_STATION_SUMMARY_LIST / MOCK_CUSTOMER_SUMMARY_LIST
这些组件内含大量写死的 2026-08-08 快照日期与假流水,均不可达。
线上 KPI 下钻走的是 PrototypeDrillModal(真实 API)。
- 单站日报"最后更新时间"初值不再用伪造时间戳,改为与接口空态一致的文案。
注:本次未改动任何 DOM 结构与 CSS 类名;删除的均为不可达分支。
lint / test(134) / build 全绿。
2026-09-11 10:23:31 +08:00
dsh-agent
b28ca49491
refactor(stage7): 后端目录分层、架构守护测试与文档
...
后端目录
- db/:mysql / hydrogen / heatmap 连接与氢能只读 SQL 守卫收拢到一处。
- middleware/:auth(JWT → 注入 user)与 read-only 归位。
- 相关测试随文件移动(middleware/read-only.test.ts、db/hydrogen-read-only.test.ts)。
import 改写由一次性 codemod 完成,未改变任何逻辑。
架构守护
- 新增 src/architecture.test.ts,断言 6 条分层铁律:
server 不依赖 modules、前端不依赖 server、shared 为叶子层、
无 vendor 引用、model.ts 不依赖 react、@ts-nocheck 仅限已登记的原型快照。
豁免清单只减不增。
测试基建
- npm test 的 glob 同时匹配 .test.ts 与 .test.tsx(此前 .tsx 测试会被静默漏掉)。
文档
- 新增根 README.md:入口、快速开始、命令、目录、部署注意事项
(JWT_SECRET 必须注入且 >=32 字符,否则拒绝启动)。
- 新增 docs/ARCHITECTURE.md:依赖方向、6 条硬规则、业务域形状、
中间件顺序、新增模块步骤,以及"已知未尽事项"的诚实清单。
lint / test(134) / build 全绿。
2026-09-11 10:20:47 +08:00
dsh-agent
9a9c9d08e1
refactor(stage4): 集中配置与启动校验,权限守卫 fail-closed,凭据移出仓库
...
配置分层
- 新增 src/server/config.ts:环境变量集中读取 + 启动期校验。
删除公开兜底密钥 ln-bi-default-secret:SSO 模式下 JWT_SECRET 缺失或
短于 32 字符时 assertRuntimeConfig() 直接拒绝启动(已实测)。
- index.ts 不再自己读端口/环境;auth/config.ts 与 auth/login.ts 改为引用集中配置。
权限守卫
- energy / scheduling / hydrogen-heatmap 的守卫由 “user 存在才校验” 改为
“无角色即拒绝”:user 缺失时按无权限处理,不再静默放行(fail-closed)。
- /api/ele/* 此前完全无鉴权,任何已登录用户都能写入电费表;现按能源域
(BI-LEADER-ENERGY) 守卫。
接口契约
- 未匹配的 /api/* 由 200 text/html(SPA) 改为 404 application/json;
未认证时仍是 401,避免向未授权调用方暴露路由是否存在。
- 新增全局 onError 返回 JSON 500。
凭据治理(此前均为 git 跟踪文件中的明文)
- Dockerfile 删除烧进镜像的 JWT_SECRET,改为必须运行时注入。
- docker-compose.yml 删除生产库口令/JWT 密钥/失效的 MILEAGE_DB_*,
改为强制注入写法;补齐 OSS_* 与 NODE_ENV/DEV_BYPASS_AUTH/BI_AUTH_*。
- woodpecker.yml 删除 Harbor base64 凭据改用 secret,pull_request 不再推镜像。
- 删除 scripts-tmp/(含生产库 root 口令)与已跟踪的 .DS_Store;.gitignore 补全。
- 文档中残留的里程库口令改为占位符。
lint / test(128) / build 全绿。
2026-09-11 10:19:07 +08:00
dsh-agent
680c7e0662
refactor(stage3): 下线 5 个无调用方的 legacy 氢能接口
...
先确认调用方再删:/hydrogen/station-board 被单站日报页面(StationDailyApp /
StationDailyDetailView)实际使用,必须保留;其余 5 个确认零调用方。
- 删服务端路由 hydrogen-overview / -overview-detail / -daily / -daily-detail /
-settlement(约 1,080 行),energy/index.ts 保留原有注册顺序语义。
- 删客户端对应请求函数与类型:api.ts 由 202 行精简为 74 行;
types.ts 由 291 行精简为 112 行(只保留 StationBoard / Electric / ETC 闭包)。
- 顺带修正命名:HydrogenDailyQuery -> EnergyRangeQuery(它服务于电能按月接口)。
- routes.test.ts 同步收敛:删除 settlement / overview 两个已下线接口的测试,
'四个处理器' 改为只覆盖电能;路由顺序断言更新为现存 9 条。
电能 SQL 指纹沿用原值,证明取数口径未变。
测试 131 -> 128(删掉的 3 个用例覆盖的是已下线接口)。lint / test / build 全绿。
2026-09-11 10:16:43 +08:00
dsh-agent
7556dbcebc
refactor(stage2): 生产代码移出 src/vendor,氢能收敛为分层 feature
...
src/vendor 语义是'第三方/参考',却装着线上氢能看板并反向 import
src/modules,依赖方向倒挂。本次把生产代码归位并建立氢能分层:
src/modules/energy/hydrogen/
index.tsx 导航入口(原 HydrogenModule.tsx)
api.ts types.ts HTTP 与 DTO
dev-mock-api.ts 仅 dev 的 vite 插件(仍由 vite.config.ts 引用)
model/ 纯逻辑(format / bearing-labels / daily-detail-format)
board/ 经营看板 UI(原 vendor energy-h2-bi-board)
station-daily/ 单站日报 UI(原 vendor energy-h2-station-daily)
drill/ 下钻弹层 UI(原 hydrogen-bi-v2 的 UI 部分)
common/ 工具与共享组件(原 vendor common + prototype-download)
fonts/ JetBrains Mono(原 vendor resources/design-system)
- UI 与 CSS 逐字节保留,仅移动位置与改写相对 import。
- 删除自挂载原型入口后遗留的 2 个 annotation-source.json。
- vite.config.ts 与 tsconfig 的路径/exclude 同步清理。
- independent-entry.test.ts 不再硬编码路径,改为断言'两个入口解析到同一文件'。
导入改写用一次性 codemod 完成(按旧位置解析、按新位置重写),
lint / test(131) / build 全绿,可达性分析仍为 0 未引用文件。
2026-09-11 10:14:37 +08:00
dsh-agent
3daa9808ce
refactor(stage1): 删除已证实无引用的死代码
...
按 import 图可达性分析(从 main.tsx / server index+local / vite.config 出发)
删除 0 引用的文件,删除后可达性分析 UNREACHABLE 归零。
- 删旧氢能实现:PrototypeBoard / HydrogenBiV2App / prototype-adapter /
prototype-source 全部 / HydrogenView+Overview+Daily+Settlement+BoardChrome+
StationBoard / hydrogen-overview / hydrogen-daily
- 删死 CSS 4 个(约 12k 行)、删死 vendor 残留(自挂载 index.tsx、AccessGate、SdDatePicker)
- 删 server/mileage-db.ts(含硬编码凭据的死模块)
- DailyRangeControls:移除从未被传入的 vehicleScope/onVehicleScopeChange 死分支
- tsconfig:移除指向已删除/不存在路径的 exclude
测试 146 -> 131(删掉的 3 个测试文件覆盖的是被删的死代码)。
lint / test / build 全绿。
2026-09-11 10:11:33 +08:00
kfluous and HiFox Agent
89dca5c5a4
feat(energy): rotate phone fullscreen drill tables for wider viewing
...
ci/woodpecker/push/woodpecker Pipeline was successful
Co-authored-by: HiFox Agent <agents-noreply@hifox.com >
2026-09-05 18:42:57 +08:00
kfluous and HiFox Agent
7d792933dd
fix(auth): allow non-empty short access passwords
...
ci/woodpecker/push/woodpecker Pipeline was successful
Co-authored-by: HiFox Agent <agents-noreply@hifox.com >
2026-09-05 18:28:39 +08:00
kfluous and HiFox Agent
0dc7e89c1d
feat(auth): add configurable password login with SSO default
...
ci/woodpecker/push/woodpecker Pipeline was successful
Co-authored-by: HiFox Agent <agents-noreply@hifox.com >
2026-09-05 18:22:41 +08:00
kfluous
4430fb75f1
Merge remote-tracking branch 'origin/main' into codex/hydrogen-oneos709
ci/woodpecker/push/woodpecker Pipeline was successful
2026-09-05 18:04:33 +08:00
kfluous and HiFox Agent
df259fc12b
feat(energy): improve hydrogen drill workspace and verification cutoff
...
Co-authored-by: HiFox Agent <agents-noreply@hifox.com >
2026-09-05 18:04:33 +08:00
kfluous and HiFox Agent
df6b8201e8
fix(ci): use npmmirror for CI and Docker dependency installs
...
ci/woodpecker/push/woodpecker Pipeline was successful
Co-authored-by: HiFox Agent <agents-noreply@hifox.com >
2026-09-05 17:15:28 +08:00
kfluous and HiFox Agent
a177781fe7
feat(energy): integrate self-operated station customers and receipts
...
ci/woodpecker/push/woodpecker Pipeline was canceled
Co-authored-by: HiFox Agent <agents-noreply@hifox.com >
2026-09-05 17:03:15 +08:00
kfluous and HiFox Agent
637a72c1e9
feat(energy): optimize mobile hydrogen daily and customer lists
...
ci/woodpecker/push/woodpecker Pipeline was canceled
Co-authored-by: HiFox Agent <agents-noreply@hifox.com >
2026-09-05 15:51:52 +08:00
kfluous and HiFox Agent
98efde3f75
fix(energy): checkpoint validated drill pagination and read-only preview
...
Co-authored-by: HiFox Agent <agents-noreply@hifox.com >
2026-09-05 15:36:09 +08:00
kfluous and HiFox Agent
6c91a6694a
fix(energy): deliver prototype-aligned hydrogen board and acceptance fixes
...
ci/woodpecker/push/woodpecker Pipeline was successful
Co-authored-by: HiFox Agent <agents-noreply@hifox.com >
2026-09-03 22:27:23 +08:00
kkfluous
5eb38a4b05
chore: checkpoint local changes
ci/woodpecker/push/woodpecker Pipeline failed
2026-08-25 12:37:58 +08:00
kkfluous
2518d9ee54
chore: bump version to 1.1.15
ci/woodpecker/push/woodpecker Pipeline was successful
2026-08-20 14:36:18 +08:00
kkfluous
62efef0ab9
feat(energy): rebuild hydrogen BI board and drill-through
ci/woodpecker/push/woodpecker Pipeline was successful
2026-08-20 13:59:03 +08:00
kkfluous
37a9f303ec
chore: release v1.1.14
ci/woodpecker/push/woodpecker Pipeline was successful
2026-08-13 12:04:02 +08:00
kkfluous
06fe75b4c7
refactor: modularize application domains
2026-08-13 12:03:34 +08:00
kkfluous
d610e4b841
feat(mileage): add report loading overlay
ci/woodpecker/push/woodpecker Pipeline was successful
2026-08-12 23:17:06 +08:00
kkfluous
7fce6b8474
feat(mileage): refine daily report controls
2026-08-12 23:11:35 +08:00
kkfluous
bd0627d00f
feat(mileage): add daily operations report
2026-08-12 23:05:07 +08:00
kkfluous
17c839a35e
feat(mileage): add statistic-time sorting and refresh control
ci/woodpecker/push/woodpecker Pipeline was successful
2026-07-23 15:44:01 +08:00
kkfluous
99b4efda6d
chore: release v1.1.13
ci/woodpecker/push/woodpecker Pipeline was successful
2026-07-23 15:12:36 +08:00
kkfluous
6b72f0ce3c
feat(mileage): default to instrument-only source
2026-07-23 15:12:36 +08:00
kkfluous
b0c8d6a5b8
chore: release v1.1.12
ci/woodpecker/push/woodpecker Pipeline was successful
2026-07-23 14:11:57 +08:00
kkfluous
d8773ff0a0
feat(mileage): add OneOS source priority controls
2026-07-23 14:11:52 +08:00
kkfluous
becacecc67
chore: release v1.1.11
ci/woodpecker/push/woodpecker Pipeline was successful
2026-07-23 12:29:29 +08:00
kkfluous
67f3ec7306
perf(mileage): filter single-vehicle range queries
2026-07-23 12:27:23 +08:00
kkfluous
3f29bed5fa
feat: integrate OneOS mileage APIs and release v1.1.10
ci/woodpecker/push/woodpecker Pipeline was successful
2026-07-23 12:19:11 +08:00
kkfluous
4d523cbce0
feat(mileage): add daily mileage columns to main export sheet
...
ci/woodpecker/push/woodpecker Pipeline was successful
- '车辆汇总' sheet now includes per-day mileage columns for date ranges
- Daily columns shown as 'MM-DD里程(km)' between base info and summary cols
- Freeze pane fixed at 7 base columns for horizontal scrolling
- '每日明细' sheet retained as detailed backup
- Bump version to 1.1.9
2026-07-15 14:30:16 +08:00
kkfluous
2b31f8efe8
feat(mileage): add brand multi-select filter and customer fuzzy search
...
ci/woodpecker/push/woodpecker Pipeline was successful
- Add brand multi-select filter (BatchMultiSelect) with 17 brand options
- Replace customer select with SearchableSelect for fuzzy search
- Server-side: add brand to vehicle-info SQL, cache, filters, and monitoring
- Customer filter now uses case-insensitive includes match on server side
- Add brand column to fullscreen table header and body
- Mobile-adaptive: compact inputs, constrained widths, scrollable dropdowns
- Bump version to 1.1.8
2026-07-15 14:25:11 +08:00
kkfluous
ae4b5d30e7
fix: restore mobile navigation typography
ci/woodpecker/push/woodpecker Pipeline was successful
2026-07-13 22:02:49 +08:00
kkfluous
392a36a0ec
feat: add vehicle and hydrogen heatmaps
ci/woodpecker/push/woodpecker Pipeline was successful
2026-07-13 21:44:03 +08:00
lingniu
a558db5795
Polish mobile BI filters and summaries
ci/woodpecker/push/woodpecker Pipeline was successful
2026-06-27 22:43:43 +08:00
lingniu
b0caa5afcb
feat: polish BI dashboards and bump version
ci/woodpecker/push/woodpecker Pipeline was successful
2026-06-27 21:59:33 +08:00
lingniu
5377d2c225
chore: ignore local worktrees
2026-06-23 16:09:54 +08:00
kkfluous
654573ac4b
merge palladium 18t color variant
ci/woodpecker/push/woodpecker Pipeline was successful
2026-06-23 13:32:29 +08:00
kkfluous
43f94ed1b8
fix asset vehicle source grouping
ci/woodpecker/push/woodpecker Pipeline was successful
2026-06-23 13:16:32 +08:00
kkfluous
fb5789d705
update asset refresh status
ci/woodpecker/push/woodpecker Pipeline was successful
2026-06-18 14:18:40 +08:00
kkfluous
94a6e0a75e
update asset validation banner
ci/woodpecker/push/woodpecker Pipeline was successful
2026-06-18 14:04:27 +08:00
kkfluous
67c5f9d281
support mileage batch multi-select
ci/woodpecker/push/woodpecker Pipeline was successful
2026-06-18 10:18:35 +08:00
kkfluous
91202bdf71
fix asset module database migration
ci/woodpecker/manual/woodpecker Pipeline was successful
2026-06-17 11:53:39 +08:00
kkfluous
c13f341d5e
feat(ui): 页面标题区分能源BI与资产BI,资产页增加OneOS迁移提示滚动条
ci/woodpecker/push/woodpecker Pipeline was successful
2026-06-11 15:30:21 +08:00
kkfluous
6962c4ff1c
feat(db): hydrogen 和 mileage 数据库连接支持 Docker 环境变量注入
...
ci/woodpecker/push/woodpecker Pipeline was successful
mileage-db.ts 改为从环境变量读取,硬编码值作为 fallback;
docker-compose.yml 新增加氢站库和里程库的连接参数。
2026-06-09 17:18:32 +08:00
kkfluous
6b7f0eedd9
Revert "fix(mileage): 已到期年度按期末里程统计"
...
ci/woodpecker/push/woodpecker Pipeline was successful
This reverts commit feb950dd59 .
2026-06-03 15:40:13 +08:00