diff --git a/backend-java/src/test/java/com/nanri/aiimage/modules/jd/JdPublishContractPendingTest.java b/backend-java/src/test/java/com/nanri/aiimage/modules/jd/JdPublishContractPendingTest.java
new file mode 100644
index 000000000..70e8442c6
--- /dev/null
+++ b/backend-java/src/test/java/com/nanri/aiimage/modules/jd/JdPublishContractPendingTest.java
@@ -0,0 +1,158 @@
+package com.nanri.aiimage.modules.jd;
+
+import com.nanri.aiimage.modules.task.model.CollectChannel;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Stream;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+/**
+ * v1.5 京东商品上架到京麦(Phase 0 预置的验收契约,蓝图 docs/ITERATION_PLAN.md §1 AC / §4)。
+ *
+ *
Pending-to-Active 机制:标 {@code @Disabled("Pending Phase 2")} 的方法是 Phase 2
+ * (后端地基:V208+ 迁移 / JdPublishController / JdPublishTaskService / 派发三件套)落地后才
+ * 能跑绿的契约,实现合入的同一个 Phase 里必须移除注解跑绿——蓝图对应 Phase 的【待激活验收
+ * 测试】栏登记了这份清单。唯一不 skip 的方法 {@link #京东分类读取口全仓唯一_B11301绊线()} 是
+ * 立即生效的存量绊线:B113-01 拍板「分类选项唯一来源 GET /api/jd-collect/groups」,
+ * 任何面(含本迭代新增的发布面)都不许开第二个京东分类读取口。
+ *
+ *
Pending 方法全部写成源码绊线(读源文件断言关键形状),不 import 尚不存在的新类,
+ * Phase 0 落盘即可编译;判据形状照 {@code JdTaskPullSpiImplTest}(白名单段绊线)与
+ * {@code JdCollectGroupsEndpointTest}(controller 绊线)先例。
+ */
+class JdPublishContractPendingTest {
+
+ private static final Path MAIN_JAVA = Path.of("src/main/java");
+ private static final Path APP_YML = Path.of("src/main/resources/application.yml");
+ private static final Path DB_DIR = Path.of("src/main/resources/db");
+ private static final Path MODULE_REGISTRY =
+ MAIN_JAVA.resolve("com/nanri/aiimage/common/module/TaskModuleRegistry.java");
+ private static final Path PUBLISH_CONTROLLER =
+ MAIN_JAVA.resolve("com/nanri/aiimage/modules/jd/controller/JdPublishController.java");
+ private static final Path PUBLISH_SERVICE =
+ MAIN_JAVA.resolve("com/nanri/aiimage/modules/jd/service/JdPublishTaskService.java");
+ private static final Path PUBLISH_SPI =
+ MAIN_JAVA.resolve("com/nanri/aiimage/modules/jd/service/JdPublishTaskPullSpiImpl.java");
+
+ private static final String PUBLISH_MODULE = "JD_PUBLISH";
+ private static final String PUBLISH_QUEUE_TYPE = "jd-product-publish-run";
+
+ // ---------------------------------------------------------------- AC-9(立即生效)
+
+ /** AC-9 服务端半边(B113-01):京东分类读取口全仓唯一,就是 JdCollectController 的 /groups。 */
+ @Test
+ void 京东分类读取口全仓唯一_B11301绊线() throws IOException {
+ // 判据:同文件同时出现 jd-collect 前缀与 /groups 映射(类级 @RequestMapping 与
+ // 方法级 @GetMapping 分开写,拼接串搜不到——照 JdCollectGroupsEndpointTest 的断言口径)。
+ List hits = new ArrayList<>();
+ try (Stream files = Files.walk(MAIN_JAVA)) {
+ files.filter(p -> p.toString().endsWith(".java")).forEach(p -> {
+ try {
+ String source = Files.readString(p);
+ if (source.contains("jd-collect") && source.contains("@GetMapping(\"/groups\")")) {
+ hits.add(p.toString().replace('\\', '/'));
+ }
+ } catch (IOException e) {
+ throw new IllegalStateException("读源码失败: " + p, e);
+ }
+ });
+ }
+ assertEquals(List.of("src/main/java/com/nanri/aiimage/modules/jd/controller/JdCollectController.java"),
+ hits.stream().sorted().toList(),
+ "B113-01:/api/jd-collect/groups 是京东分类的唯一读取口,"
+ + "发布面(或任何新面)需要分类数据必须消费同一出口,不得自开第二份");
+ }
+
+ // ---------------------------------------------------------------- AC-2(Pending Phase 2:派发三件套)
+
+ @Test
+ @Disabled("Pending Phase 2: AC-2 派发三件套——client-task-pull 白名单加 JD_PUBLISH 后移除本注解")
+ void client_task_pull白名单默认值含JD_PUBLISH_源码绊线() throws IOException {
+ // 照 JdTaskPullSpiImplTest 同判据:白名单不含模块名时 SPI 装载了也不会被走到。
+ // 逐行定位 AIIMAGE_CLIENT_TASK_PULL_MODULE_TYPES 那一行再断言,比全文 contains 精确。
+ String whitelistLine = Files.readAllLines(APP_YML).stream()
+ .filter(line -> line.contains("AIIMAGE_CLIENT_TASK_PULL_MODULE_TYPES"))
+ .findFirst()
+ .orElseThrow(() -> new AssertionError("application.yml 缺 client-task-pull.module-types 白名单行"));
+ assertTrue(whitelistLine.contains(PUBLISH_MODULE),
+ "client-task-pull 白名单默认值必须含 JD_PUBLISH(铁律 32:漏加=任务永不执行)");
+ }
+
+ @Test
+ @Disabled("Pending Phase 2: AC-2 LOCAL_DEFAULT_MODULES——JD_PUBLISH 进清单后移除本注解")
+ void JD_PUBLISH默认通道必须是LOCAL_铁律19同形() {
+ // 京东发布必须由客户端已登录京麦的 Chrome 执行,Linux worker 永远跑不了:
+ // 不进 LOCAL_DEFAULT_MODULES 就会默认 ONLINE ⇒ 任务被推给无京麦登录态的机器(铁律 19)。
+ // 参数是字符串,编译期可引用;Phase 2 之前返回 ONLINE,由 @Disabled 保护。
+ assertEquals(CollectChannel.LOCAL, CollectChannel.defaultFor(PUBLISH_MODULE),
+ "JD_PUBLISH 必须进 CollectChannel.LOCAL_DEFAULT_MODULES(defaultFor 判据,照 JD_SHOP_COLLECT 同形)");
+ }
+
+ @Test
+ @Disabled("Pending Phase 2: AC-2 SPI 实现——JdPublishTaskPullSpiImpl 落地后移除本注解")
+ void 派发SPI实现存在且队列类型为jd_product_publish_run() throws IOException {
+ assertTrue(Files.exists(PUBLISH_SPI), "缺 ClientTaskPullSpi 实现:JdPublishTaskPullSpiImpl(铁律 32 第一件)");
+ assertTrue(Files.readString(PUBLISH_SPI).contains(PUBLISH_QUEUE_TYPE),
+ "SPI 的 QUEUE_TYPE 必须是 " + PUBLISH_QUEUE_TYPE + "(客户端按它分发,两处不同值任务永不执行)");
+ // 建单成功页面推送的载荷 type 与 SPI 同值(铁律 32 第三件:enqueue 页面推送)
+ assertTrue(Files.exists(PUBLISH_SERVICE), "缺 JdPublishTaskService(建单/生命周期/明细下发)");
+ assertTrue(Files.readString(PUBLISH_SERVICE).contains(PUBLISH_QUEUE_TYPE),
+ "JdPublishTaskService 建单成功推送的载荷 type 必须与 SPI QUEUE_TYPE 同值");
+ }
+
+ @Test
+ @Disabled("Pending Phase 2: AC-2 registry 登记——TaskModuleRegistry 加 JD_PUBLISH 后移除本注解")
+ void TaskModuleRegistry登记JD_PUBLISH模块_源码绊线() throws IOException {
+ assertTrue(Files.exists(MODULE_REGISTRY), "TaskModuleRegistry 缺失");
+ assertTrue(Files.readString(MODULE_REGISTRY).contains(PUBLISH_MODULE),
+ "TaskModuleRegistry 必须登记 JD_PUBLISH 条目(module_type 承载方)");
+ }
+
+ // ---------------------------------------------------------------- AC-1(Pending Phase 2:建单端点)
+
+ @Test
+ @Disabled("Pending Phase 2: AC-1 建单端点——JdPublishController 落地后移除本注解")
+ void 建单端点形状与归属校验_源码绊线() throws IOException {
+ assertTrue(Files.exists(PUBLISH_CONTROLLER), "缺 JdPublishController(蓝图 §3:POST /api/jd-publish/tasks)");
+ String source = Files.readString(PUBLISH_CONTROLLER);
+ assertTrue(source.contains("jd-publish/tasks"), "缺建单端点路径 /api/jd-publish/tasks");
+ assertTrue(source.contains("@PostMapping"), "建单必须是 POST 端点");
+ // AC-9 归属半边:选了他人商品要业务码拒绝(照 JdCollectController 的 fail-closed 鉴权形状)
+ assertTrue(source.contains("requireOwnershipUserId"),
+ "建单/items 下发必须走 adminAuthSupport.requireOwnershipUserId(选他人商品要业务码拒绝)");
+ }
+
+ @Test
+ @Disabled("Pending Phase 2: AC-1 发布明细表——V208+ 迁移落地后移除本注解")
+ void 发布明细表迁移存在且表名为biz_jd_publish_item() throws IOException {
+ // 蓝图 §3:V207 已被 users_jd_publish_quota 占用(5c7a310e),发布明细表从 V208 起号。
+ // 号段断言放宽到 V208~V229:开工时仍须按 MigrationInventoryTest 复核当窗可用号(铁律 33)。
+ assertTrue(Files.isDirectory(DB_DIR), "缺 db 迁移目录");
+ try (Stream files = Files.list(DB_DIR)) {
+ boolean hit = files.map(p -> p.getFileName().toString())
+ .anyMatch(name -> name.matches("V2(?:0[89]|[12][0-9])__.*jd_publish_item.*\\.sql"));
+ assertTrue(hit, "db/ 缺 biz_jd_publish_item 迁移(V208+ 号段,表名照蓝图 §3)");
+ }
+ }
+
+ // ---------------------------------------------------------------- AC-8(Pending Phase 2:配额闸)
+
+ @Test
+ @Disabled("Pending Phase 2: AC-8 配额闸——建单入口接 assertWithinQuota 后移除本注解")
+ void 建单入口必须接JdPublishQuotaService配额闸_源码绊线() throws IOException {
+ assertTrue(Files.exists(PUBLISH_SERVICE), "缺 JdPublishTaskService");
+ String source = Files.readString(PUBLISH_SERVICE);
+ assertTrue(source.contains("assertWithinQuota"),
+ "建单入口必须调 JdPublishQuotaService.assertWithinQuota(原语已预留,AC-8;"
+ + "超配额当场业务码拒绝,不得到执行侧静默降级)");
+ }
+}
diff --git a/frontend-vue/tests/jd-publish-tab.test.ts b/frontend-vue/tests/jd-publish-tab.test.ts
new file mode 100644
index 000000000..8af21fbc0
--- /dev/null
+++ b/frontend-vue/tests/jd-publish-tab.test.ts
@@ -0,0 +1,81 @@
+import assert from 'node:assert/strict'
+import test from 'node:test'
+import { existsSync, readFileSync, readdirSync } from 'node:fs'
+import { join } from 'node:path'
+
+/** v1.5 京东发布用户端契约(蓝图 docs/ITERATION_PLAN.md §1 AC-9 / §3 / §4 Phase 4)。
+ *
+ * 两组:
+ * 1. **立即生效**(AC-9 前端绊线,B113-01):`/api/jd-collect/groups` 是京东分类的
+ * 唯一读取口——全 src 不得出现第三个裸 URL 消费点;发布页要分类数据必须走
+ * endpoints.jdCollect.groups 的既有 fetch 函数(出现第二个分类口即红)。
+ * 2. **Pending Phase 4**(每支带 skip):JdPublishTab(分类→商品→改价→建单→实时面板)
+ * 落地后移除对应 skip 跑绿——蓝图 §4 Phase 4【待激活验收测试】登记的就是这份清单。
+ */
+
+const ROOT = process.cwd()
+
+function read(relativePath: string, what: string): string {
+ const path = join(ROOT, relativePath)
+ assert.ok(existsSync(path), `${what} 尚未落地(蓝图 §4 Phase 4):${path}`)
+ return readFileSync(path, 'utf8')
+}
+
+/** 递归收集 src 下 .ts/.vue 源文件 */
+function collectSourceFiles(dir: string, acc: string[] = []): string[] {
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
+ const full = join(dir, entry.name)
+ if (entry.isDirectory()) collectSourceFiles(full, acc)
+ else if (/\.(ts|vue)$/.test(entry.name)) acc.push(full)
+ }
+ return acc
+}
+
+// ---------------------------------------------------------- AC-9 前端绊线(立即生效)
+
+test('AC-9: 京东分类读取口全 src 唯一(B113-01 绊线)', () => {
+ const hits = collectSourceFiles(join(ROOT, 'src'))
+ .filter((f) => readFileSync(f, 'utf8').includes('jd-collect/groups'))
+ .map((f) => f.replace(/\\/g, '/').replace(ROOT.replace(/\\/g, '/') + '/', ''))
+ assert.deepEqual(hits.sort(), [
+ 'src/shared/api/endpoints.ts',
+ 'src/shared/api/types/modules/jd-collect.ts',
+ ], 'B113-01:/api/jd-collect/groups 是京东分类唯一读取口——发布页要分类必须消费 endpoints.jdCollect.groups 既有出口,不得新增裸 URL 消费点')
+})
+
+// ---------------------------------------------------------- Pending Phase 4
+
+test('AC-9: JdPublishTab 分类选择消费唯一 groups 出口', { skip: 'Pending Phase 4: JdPublishTab 落地后移除 skip' }, () => {
+ const tab = read('src/pages/jd/JdPublishTab.vue', '商品上架页')
+ assert.ok(tab.includes('jdCollect'), 'JdPublishTab 的分类数据必须走 endpoints.jdCollect/groups 既有 fetch(AC-9),不得自拼 URL')
+ assert.ok(!tab.includes('jd-collect/groups'), 'JdPublishTab 不得裸写分类 URL(B113-01 绊线)')
+})
+
+test('AC-9: 商品列表只拉归属当前用户的行(owner 过滤)', { skip: 'Pending Phase 4: JdPublishTab 落地后移除 skip' }, () => {
+ const tab = read('src/pages/jd/JdPublishTab.vue', '商品上架页')
+ assert.ok(tab.includes('productIds') || tab.includes('productId'),
+ 'JdPublishTab 建单提交必须携带勾选的商品 id 集合(服务端按 owner 校验,跨用户商品 0 返回)')
+})
+
+test('建单请求体形状:categoryId + productIds + priceRule{mode,value}', { skip: 'Pending Phase 4: JdPublishTab 落地后移除 skip' }, () => {
+ const tab = read('src/pages/jd/JdPublishTab.vue', '商品上架页')
+ // 蓝图 §3 死契约:POST /api/jd-publish/tasks 请求体 {categoryId, productIds[], priceRule:{mode,value?}}
+ assert.ok(tab.includes('categoryId'), '建单体缺 categoryId(所选自定义分类)')
+ assert.ok(tab.includes('priceRule'), '建单体缺 priceRule(统一改价规则;mode: none|percent|fixed)')
+ assert.ok(tab.includes("'percent'") && tab.includes("'fixed'") && tab.includes("'none'"),
+ 'priceRule.mode 三档(none/percent/fixed)必须与蓝图 §3 同值')
+})
+
+test('endpoints 注册 jdPublish 端点组(建单/items/chunk 三件)', { skip: 'Pending Phase 4: endpoints 扩组后移除 skip' }, () => {
+ const endpoints = read('src/shared/api/endpoints.ts', 'endpoints.ts')
+ assert.ok(endpoints.includes('jdPublish'), 'endpoints.ts 缺 jdPublish 端点组')
+ assert.ok(endpoints.includes('/api/jd-publish/tasks'), 'jdPublish 组缺建单端点 /api/jd-publish/tasks')
+})
+
+test('商品上架占位卡转正式:jd-publish 卡挂 /jd-publish 路由', { skip: 'Pending Phase 4: 占位卡转正式时移除 skip(须同步改 jd-console-tool-catalog.test.ts 的占位锁)' }, () => {
+ const catalog = read('src/pages/jd/tool-catalog.ts', 'jd/tool-catalog.ts')
+ const router = read('src/router/index.ts', 'router/index.ts')
+ assert.ok(/id:\s*'jd-publish'[\s\S]*?href:\s*'\/jd-publish'/.test(catalog),
+ 'jd-publish 卡须补 href 指向 /jd-publish(转正式)')
+ assert.ok(router.includes("path: '/jd-publish'"), 'router 缺 /jd-publish 路由')
+})