feat(护栏三面): 鉴权盲区启动自检 + SQL 分层口径落码 + 六页等待循环合一

后端
- AdminApiGuardFilter 增 guardedPrefixes()/matchesPrefix() 公开入口(原 private,
  自检抄一份清单迟早与守卫脱钩);行为零变化
- 新增 ApiGuardCoverageAuditor:启动期把"已映射端点既不在守卫前缀名单、也不在
  公开/待收清单里"打成 API_GUARD_UNCOVERED 一行 WARN,供现网巡检 grep;
  PUBLIC_BY_DESIGN 与 PENDING_CONVERGENCE 两张清单逐条写理由(只读不拦)
- SQL 分层按新口径落码:AsinResultCacheMapper 的两条动态 SQL(<foreach> 批量 +
  ON DUPLICATE KEY UPDATE + 逐列 COALESCE)迁到 resources/mapper/asincache/,
  注解摘干净(注解+XML 同名会让启动期抛重复语句)
- 判据:SqlLayeringConventionTest(注解写 SQL 基线 16 接口/29 条只减不增、
  @Select 65 条/16 文件、wrapper 夹带函数级 SQL 4 文件/15 条,last("LIMIT n")
  205 处显式豁免并反向钉住豁免面)、ApiGuardCoverageAuditorTest(含清单腐烂与
  欠账/名单重叠两类反向失明)、AsinResultCacheMapperXmlTest(真解析 XML 向
  BoundSql 断言 28 个占位符与 5 个 COALESCE 列)

用户端 frontend-vue
- 终态集合合一:实测六页里 PriceTrack/ProductRisk 只认 SUCCESS|FAILED,
  而 COMPLETED≡SUCCESS 早有出处(task-status-text 两者都译「已完成」,
  后端 TaskCenterQueryMapper SUCCESS_STATUSES_ORDERED 也含 COMPLETED)
  ⇒ 窄集合页收到 COMPLETED 会空转到瞬断预算耗尽,PriceTrack 的轮询摘除路径
  同样窄 ⇒ 任务永不退出轮询、列表卡在"执行中"
- 新增 shared/utils/task-terminal.ts 循环骨架(disposed/瞬断预算/恢复提示/
  每轮 sleep/非瞬断上抛),六页全部接上;取数、文案、快照合并、DELETED 语义
  留在各页回调,没有顺手统一
- 判据两支:骨架 8 例契约 + 六页源码窄集合回归钉(含"判据自己先自证"一例,
  loop-run 的 STOPPED 词表不误报)
This commit is contained in:
2026-10-08 09:20:41 +08:00
parent 5b310986bb
commit 207225eb86
16 changed files with 1418 additions and 216 deletions
@@ -2,13 +2,15 @@ package com.nanri.aiimage.modules.asincache.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.nanri.aiimage.modules.asincache.model.entity.AsinResultCacheEntity;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* SQL 在 resources/mapper/asincache/AsinResultCacheMapper.xml:动态标签与列级继承
* 写在 Java 文本块里不可维护,复杂 SQL 一律走 XML(见 SqlLayeringConventionTest)。
*/
@Mapper
public interface AsinResultCacheMapper extends BaseMapper<AsinResultCacheEntity> {
@@ -19,17 +21,6 @@ public interface AsinResultCacheMapper extends BaseMapper<AsinResultCacheEntity>
* 「country = ? AND asin IN (...)」这种等值 + IN 的形状;把 country 放进 IN 里
* 成对匹配((country, asin) IN ((..),(..)))在 MySQL 上用不上索引。
*/
@Select("""
<script>
SELECT id, country, asin, availability, price, brand, delivery_method, seller_name,
seller_id, declared_members_json, source_chain, source_task_id,
observed_at, created_at, updated_at
FROM biz_asin_result_cache
WHERE country = #{country}
AND asin IN
<foreach collection="asins" item="asin" open="(" separator="," close=")">#{asin}</foreach>
</script>
""")
List<AsinResultCacheEntity> selectByCountryAndAsins(@Param("country") String country,
@Param("asins") List<String> asins);
@@ -44,30 +35,5 @@ public interface AsinResultCacheMapper extends BaseMapper<AsinResultCacheEntity>
* <p>price / availability / source_* / observed_at 不参与继承:它们是本行结论的主体,
* 404 就该把价格清空,"谁最后开的页"也必须如实反映最后一次开页。
*/
@Insert("""
<script>
INSERT INTO biz_asin_result_cache
(country, asin, availability, price, brand, delivery_method, seller_name, seller_id,
declared_members_json, source_chain, source_task_id, observed_at, created_at, updated_at)
VALUES
<foreach collection="rows" item="row" separator=",">
(#{row.country}, #{row.asin}, #{row.availability}, #{row.price}, #{row.brand},
#{row.deliveryMethod}, #{row.sellerName}, #{row.sellerId}, #{row.declaredMembersJson},
#{row.sourceChain}, #{row.sourceTaskId}, #{row.observedAt}, #{row.createdAt}, #{row.updatedAt})
</foreach>
ON DUPLICATE KEY UPDATE
availability = VALUES(availability),
price = VALUES(price),
brand = COALESCE(VALUES(brand), brand),
delivery_method = COALESCE(VALUES(delivery_method), delivery_method),
seller_name = COALESCE(VALUES(seller_name), seller_name),
seller_id = COALESCE(VALUES(seller_id), seller_id),
declared_members_json = COALESCE(VALUES(declared_members_json), declared_members_json),
source_chain = VALUES(source_chain),
source_task_id = VALUES(source_task_id),
observed_at = VALUES(observed_at),
updated_at = VALUES(updated_at)
</script>
""")
int upsertBatch(@Param("rows") List<AsinResultCacheEntity> rows);
}