6d835e947e
三家公司的密钥挤在一页上,而"筛选"是拿当前页那 10 行在前端筛的:total 不动, 第 2 家的令牌要翻到它所在页才筛得出来。操作列给 160px 装不下三颗按钮, 最后一颗(删除)被 td 的 overflow:hidden + table-layout:fixed 整颗裁掉—— DOM 里在、事件也在,就是看不见点不到,这就是"没有删除功能"的真相。 - GET /api/admin/shop-keys 新增 keyword / token / whitelist_status,在公司读范围之内 由服务端筛。keyword 那组 OR 必须括起来:不括就被后续 AND 短路成 「备注名命中 OR (账号命中 AND 本公司)」,第 2 家的 tab 能读到第 1 家的令牌。 - create 的归属改为过读门(认当前 tab),不再只认操作者会话那一家。 读认 tab、写认会话=两把尺子:admin 是 super_admin 且 company_id=1, 他在别家 tab 点新增会"提示已新增、行却落进米椿花名下",再点一次就撞令牌唯一键。 这一条推翻 10-06 定案,controller 的反向钉子(create 不许碰读门)同步换成 「tab 必须过门 + 不许把请求原值直传下去」。 - 操作列 160→270px,.ops-cell 补 flex-wrap: wrap,把"超宽=静默消失"退化成"多占一行"; 同族结构隐患一次扫过 8 个页面(宽度够不够是像素账,会不会消失是结构账)。 - 护栏:ops-cell-must-wrap 钉跨页结构,shop-key-filter-params 钉参数下发与列宽; source-pin 棘轮补第二把尺子 reads=全文读点(体内+体外), pins 降而 reads 不同步降=把 readSource 挪出用例体冒充改进,当场红。 验证:将要提交的树(HEAD + 本批白名单)在独立 worktree 实跑——前端 1762 例 0 红、 vue-tsc rc=0、Java 41 例 0 红且 959 主源 + 498 测试源全量编译过(证明不依赖并行会话 未提交的符号);主树全量 1766 例 0 红。变异自证三支全杀:摘掉一页的 flex-wrap ⇒ 恰好 1 红点名该页;把体内读盘挪进 helper ⇒ 棘轮 1 红且文案点名"不算改进"; 归属退回按会话、controller 绕门直传原值 ⇒ 各自红。
67 lines
3.0 KiB
TypeScript
67 lines
3.0 KiB
TypeScript
import test from 'node:test'
|
|
import assert from 'node:assert/strict'
|
|
import { existsSync, readdirSync, statSync } from 'node:fs'
|
|
import { join } from 'node:path'
|
|
import { readSource } from './helpers.ts'
|
|
|
|
/**
|
|
* 操作列的按钮一旦超过列宽,会**整颗消失**而不是换行:这些页的 td 是 `overflow:hidden` +
|
|
* `table-layout:fixed`,而 `.ops-cell` 是 nowrap flex。2026-10-08 店铺密钥那单"没有删除功能"
|
|
* 就是这么来的——按钮在线上包的 DOM 里、事件也在,只是被裁到看不见点不到(列给 160px、实测需 240px)。
|
|
*
|
|
* 这条看守钉的是**结构**不是像素:宽度按当前文案够,改天多一颗按钮或文案变长就又塌了,
|
|
* 而 `flex-wrap: wrap` 让"超宽"从"静默消失"退化成"多占一行",不需要有人去重算宽度。
|
|
*/
|
|
|
|
const SRC = 'src/pages'
|
|
|
|
function vueFiles(dir: string): string[] {
|
|
const out: string[] = []
|
|
for (const name of readdirSync(dir)) {
|
|
const p = join(dir, name)
|
|
if (statSync(p).isDirectory()) out.push(...vueFiles(p))
|
|
else if (name.endsWith('.vue')) out.push(p)
|
|
}
|
|
return out
|
|
}
|
|
|
|
interface Cell {
|
|
file: string
|
|
buttons: number
|
|
wrapped: boolean
|
|
}
|
|
|
|
/** 只做解析,不碰磁盘:读源码这一步留在用例体内(见 source-pin-ratchet 对"隔层 helper"的口径)。 */
|
|
function opsCells(sources: Array<{ file: string; source: string }>): Cell[] {
|
|
const cells: Cell[] = []
|
|
for (const { file, source } of sources) {
|
|
const block = /\.ops-cell[ \t]*\{([^}]*)\}/.exec(source)
|
|
if (!block) continue
|
|
const td = /<td[^>]*class="[^"]*ops[^"]*"[^>]*>([\s\S]*?)<\/td>/.exec(source)
|
|
const buttons = td ? (td[1].match(/<button/g) || []).length : 0
|
|
// 行锚 + 分号:不锚就会被块内注释里的散文喂饱(本仓踩过一次)。
|
|
const wrapped = /\n[ \t]*flex-wrap:[ \t]*wrap[ \t]*;/.test(block[1])
|
|
cells.push({ file: file.replace(/\\/g, '/'), buttons, wrapped })
|
|
}
|
|
return cells
|
|
}
|
|
|
|
test('ops_cell_ruler_actually_sees_the_family', () => {
|
|
assert.ok(existsSync(SRC), `扫不到 ${SRC}:目录挪了就是整面恒绿`)
|
|
const cells = opsCells(vueFiles(SRC).map((file) => ({ file, source: readSource(file) })))
|
|
assert.ok(cells.length >= 14,
|
|
`只认出 ${cells.length} 个带 .ops-cell 的页(今天 14 个)⇒ 扫描形状与源码脱节,这条看守已经失明`)
|
|
const multi = cells.filter((c) => c.buttons >= 2)
|
|
assert.ok(multi.length >= 11,
|
|
`只认出 ${multi.length} 页操作列有 ≥2 颗按钮(今天 11 页)⇒ 按钮计数读不到,下面的断言无从判定`)
|
|
})
|
|
|
|
test('every_multi_button_ops_cell_wraps', () => {
|
|
const offenders = opsCells(vueFiles(SRC).map((file) => ({ file, source: readSource(file) })))
|
|
.filter((c) => c.buttons >= 2 && !c.wrapped)
|
|
.map((c) => `${c.file}(${c.buttons} 颗按钮)`)
|
|
assert.deepEqual(offenders, [],
|
|
'这些页的操作列是 nowrap flex + td overflow:hidden:按钮总宽一旦超过列宽,'
|
|
+ '最后一颗会整颗被裁掉(看不见也点不到),补一行 flex-wrap: wrap 即可')
|
|
})
|