fix(monitor): 需下架车道恒为 0(判据用了没人写的状态)+ 隔离会改线上设置的集成测试
界面验收第三遍(禁止导入 → 需下架)暴露两处真问题: 1) 需下架车道死掉:判据 `retrieval_state='enabled'`,而 retrieval_state 在这套状态机里 描述「是否发布到生产」(unpublished/disabling/disabled/failed),全仓没有任何代码写过 'enabled',线上 5/5 发布单元都是 unpublished → 车道恒 0,界面「仍在知识库里的文件会 出现在这里」的承诺不成立。改为与设计注释一致的口径:仍在测试库存活(completed + 有 knowledge_id + 未 disabling/disabled)+ 来源项 policy_state='blocked'。 线上对照:旧判据 0 → 新判据 1,命中被禁止导入的 DH-AG95夹爪适配-指令协议.md; 修后页面显示「需下架(1)· 对内知识库 · 1 份仍在检索中」。新增集成测试覆盖 存活/未禁止/移除中/已移除/未上传五种情形(真实 Postgres + 独立 schema)。 2) 集成测试改到线上设置(直接踩到并已恢复):ui_settings_integration_test.go 只判断 TEST_DATABASE_URL 是否存在、无 schema 隔离,而它「创建候选并激活」——跑在共享库上会把 真实 active 设置挤成 retired。已先备份(backups/ui-settings/…pre-restore.jsonl),再用 单事务(先 retire 再 activate,uq_ui_setting_active 只允许一条 active)恢复 uis-d40ea1fc…(15/30/1800/7200 + https://weknora-test.dobot.cn/),并复核线上值。 根因修复:给该用例加 per-test schema 隔离,复跑后线上设置不再被改动。 同时把两处与事实不符的文案改实话(WeKnoraMonitor.tsx 需下架说明、SourceCatalogBrowser.tsx 禁止导入说明):移除走 test.remove 工作流(删除测试库知识条目,可再入库),入口当前由 变更集删除路径触发,页面尚无独立按钮——条目级列表与下架按钮列为待排期。
This commit is contained in:
@@ -73,7 +73,7 @@ export function SourceCatalogBrowserView({sources,selectedSource,page,loading,er
|
||||
<label className="routing-check"><input type="checkbox" checked={selectableNodes.length>0&&selectableNodes.every(node=>selectedIDs.includes(node.node_id))} disabled={!selectableNodes.length} onChange={event=>setSelectedIDs(event.target.checked?selectableNodes.map(node=>node.node_id):[])} />全选当前页</label>
|
||||
<div className="catalog-policy-actions"><button className="internal-policy-button" disabled={!routeReady||!selectedNodeIDs.length||!policyEnabled('internal')} onClick={()=>void applyPolicy('internal')}>对内</button><button className="external-policy-button" disabled={!routeReady||!selectedNodeIDs.length||!policyEnabled('external')} onClick={()=>void applyPolicy('external')}>对外</button><div className="blocked-policy-stack"><button className="blocked-policy-button" disabled={!routeReady||!selectedNodeIDs.length} onClick={()=>void applyPolicy('blocked')}>禁止导入</button><small className="selected-count">已选 {selectedCount} 项</small></div></div>
|
||||
</div>
|
||||
<small className="blocked-policy-note">禁止导入即生效:待入库条目自动撤销;仍在知识库里的文件会出现在“解析监控 → 需下架”,在知识清单停用检索,不删除来源文件,也不操作生产知识库。</small>
|
||||
<small className="blocked-policy-note">禁止导入即生效:待入库条目自动撤销;仍在测试库里的文件会出现在“解析监控 → 需下架”暴露差异,移除走 test.remove 工作流;不删除来源文件,也不操作生产知识库。</small>
|
||||
{routingMessage?<p role="status">{routingMessage}</p>:null}
|
||||
</section>:null}
|
||||
{visibleItems.length?<div className="catalog-table-wrap"><table className="catalog-table"><thead><tr><th>名称</th><th>类型</th><th>处理策略</th><th>文件数量</th><th>导入与解析</th><th>大小</th><th>更新时间</th></tr></thead><tbody>{visibleItems.map(node=>{const visibility=appliedPolicies[node.node_id]||node.visibility;const size=node.node_type==='folder'?(node.subtree_bytes>0?`已知合计 ${bytes(node.subtree_bytes)}`:'大小未提供'):typeof node.size_bytes==='number'?bytes(node.size_bytes):'大小未提供';return <tr key={node.node_id}><td>{node.node_type==='folder'?<div className="catalog-node-control"><input type="checkbox" aria-label={`选择${node.name}`} checked={selectedIDs.includes(node.node_id)} onChange={()=>toggleNode(node.node_id)} /><button className="catalog-name" onClick={()=>onOpenFolder(node)}><span aria-hidden="true">📁</span>{node.name}</button></div>:<label className="catalog-file"><input type="checkbox" aria-label={`选择${node.name}`} checked={selectedIDs.includes(node.node_id)} onChange={()=>toggleNode(node.node_id)} /><span aria-hidden="true">📄</span>{node.name}</label>}</td><td>{node.node_type==='folder'?'文件夹':'文件'}</td><td><div className="catalog-policy-cell"><span className={`scope-badge ${visibility}`}>{scope(visibility)}</span></div></td><td>{node.node_type==='folder'?`${node.subtree_file_count} 份`:'—'}</td><td><span>{progress(node)}</span>{node.active_count?<small>处理中 {node.active_count}</small>:null}{node.failed_count?<small className="problem-text">失败 {node.failed_count}</small>:null}</td><td>{size}</td><td>{node.modified_at?new Date(node.modified_at).toLocaleString('zh-CN',{hour12:false}):'—'}</td></tr>})}</tbody></table></div>:<div className="empty-state">当前目录为空。</div>}
|
||||
|
||||
@@ -218,7 +218,7 @@ export function WeKnoraMonitorView({
|
||||
{lane === 'removal' ? <section className="inbox-section" aria-label="需下架">
|
||||
<div className="section-head"><h2>需下架({laneCounts.removal})</h2><span className="tiny">来源目录里被改为“禁止导入”或撤销标注、但仍在知识库中可检索的文件</span></div>
|
||||
{(overview?.knowledge_bases || []).some((kb) => kb.needs_removal > 0) ? <ul className="dlq-list">{(overview?.knowledge_bases || []).filter((kb) => kb.needs_removal > 0).map((kb) => <li key={kb.id}><span className="monitor-status failed">需下架</span><b>{kb.name}</b><small>{kb.needs_removal} 份仍在检索中</small></li>)}</ul> : emptyLane('没有标注为禁止但仍留在知识库里的文件。')}
|
||||
<p className="tiny">下架在“知识清单”里操作(停用检索,可恢复);这里只负责把差异暴露出来。</p>
|
||||
<p className="tiny">这里只负责把差异暴露出来:来源项被判“禁止导入”后,仍存活在测试库里的知识必须移除。移除动作走 <code>test.remove</code> 工作流(会删除测试库里的知识条目,重新标注后可再次入库);该入口当前由变更集删除路径触发,页面尚未提供独立按钮。</p>
|
||||
</section> : null}
|
||||
{lane === 'inflight' ? <section className="inbox-section" aria-label="处理中">
|
||||
<div className="section-head"><h2>处理中({inflightItems.length})</h2><span className="tiny">无需操作,仅供查看</span></div>
|
||||
|
||||
Reference in New Issue
Block a user