@buaa_smat/hometrans 26.0.4 → 26.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/agents/code-reviewer.md +2 -0
  2. package/agents/model-render-worker.md +1 -1
  3. package/i18n/agents/code-reviewer.md +2 -0
  4. package/i18n/agents/model-render-worker.md +1 -1
  5. package/i18n/skills/a2h-app-migrate/SKILL.md +51 -3
  6. package/i18n/skills/a2h-app-migrate/references/workflow.yaml +140 -32
  7. package/i18n/skills/a2h-app-migrate/scripts/dag_graph.mjs +297 -0
  8. package/i18n/skills/a2h-app-migrate/scripts/validate_workflow.mjs +134 -21
  9. package/i18n/skills/a2h-app-migrate/test/test_finalize.mjs +21 -4
  10. package/i18n/skills/a2h-app-migrate/test/test_image_probe.mjs +3 -3
  11. package/i18n/skills/a2h-app-migrate/test/test_resume_plan.mjs +1 -1
  12. package/i18n/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +1 -1
  13. package/i18n/skills/a2h-app-migrate/test/test_utg_static_done.mjs +12 -5
  14. package/i18n/skills/a2h-arkts-logic-coder/SKILL.md +7 -8
  15. package/i18n/skills/a2h-arkts-logic-coder/references/ISSUES.md +1 -1
  16. package/i18n/skills/a2h-arkts-logic-coder/references/code-generation.md +27 -15
  17. package/i18n/skills/a2h-batch-ui-align/SKILL.md +1 -1
  18. package/i18n/skills/a2h-batch-ui-align/references/cards/widgets.md +4 -0
  19. package/i18n/skills/a2h-batch-ui-align/references/checker-rules.md +36 -0
  20. package/i18n/skills/a2h-batch-ui-align/references/conversion-procedure.md +4 -0
  21. package/i18n/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +4 -0
  22. package/i18n/skills/a2h-batch-ui-align/references/step5-convert.md +3 -3
  23. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/main.ts +8 -0
  24. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_in_linear.ts +164 -0
  25. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/self_drawn_sheet.ts +105 -0
  26. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/staggered_lanes.ts +127 -0
  27. package/i18n/skills/a2h-batch-ui-align/scripts/static_check/rules/window_size_constant.ts +114 -0
  28. package/i18n/skills/a2h-page-specgen/references/scenario-authoring.md +4 -1
  29. package/i18n/skills/a2h-page-specgen/references/spec-example.md +35 -5
  30. package/i18n/skills/a2h-page-specgen/references/spec-template.md +4 -4
  31. package/i18n/skills/a2h-spec-generate/SKILL.md +3 -1
  32. package/i18n/skills/a2h-spec-generate/references/fusion-task-contract.md +15 -3
  33. package/i18n/skills/a2h-spec-generate/references/review-checklist.md +1 -0
  34. package/i18n/skills/a2h-spec-generate/references/spec-sample-complex.md +16 -0
  35. package/i18n/skills/a2h-spec-generate/references/spec-sample-transfer.md +16 -0
  36. package/i18n/skills/a2h-spec-generate/references/spec-samples.md +5 -1
  37. package/i18n/skills/a2h-spec-generate/references/synthesis-rules.md +21 -1
  38. package/i18n/skills/a2h-spec-generate/references/worker-rules.md +25 -2
  39. package/i18n/skills/a2h-spec-generate/scripts/check_spec.ts +121 -6
  40. package/i18n/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +2 -1
  41. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +3 -0
  42. package/i18n/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +16 -2
  43. package/i18n/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +11 -2
  44. package/i18n/skills/a2h-spec-generate/test/check-spec.test.ts +35 -0
  45. package/package.json +1 -1
  46. package/skills/a2h-app-migrate/SKILL.md +53 -5
  47. package/skills/a2h-app-migrate/references/workflow.yaml +140 -32
  48. package/skills/a2h-app-migrate/scripts/assert_dag_complete.mjs +226 -0
  49. package/skills/a2h-app-migrate/scripts/dag_graph.mjs +297 -0
  50. package/skills/a2h-app-migrate/scripts/dag_process_executor.mjs +199 -0
  51. package/skills/a2h-app-migrate/scripts/dag_production_executor.mjs +897 -0
  52. package/skills/a2h-app-migrate/scripts/dag_runner.mjs +1767 -0
  53. package/skills/a2h-app-migrate/scripts/ledger.mjs +15 -2
  54. package/skills/a2h-app-migrate/scripts/lib-yaml-lite.mjs +8 -2
  55. package/skills/a2h-app-migrate/scripts/resume_plan.mjs +3 -8
  56. package/skills/a2h-app-migrate/scripts/validate_workflow.mjs +134 -21
  57. package/skills/a2h-app-migrate/test/test_dag_complete.mjs +222 -0
  58. package/skills/a2h-app-migrate/test/test_dag_production.mjs +670 -0
  59. package/skills/a2h-app-migrate/test/test_dag_runner.mjs +423 -0
  60. package/skills/a2h-app-migrate/test/test_finalize.mjs +21 -4
  61. package/skills/a2h-app-migrate/test/test_image_probe.mjs +1 -1
  62. package/skills/a2h-app-migrate/test/test_resume_plan.mjs +16 -1
  63. package/skills/a2h-app-migrate/test/test_reuse_static_utg.mjs +1 -1
  64. package/skills/a2h-app-migrate/test/test_utg_static_done.mjs +12 -5
  65. package/skills/a2h-arkts-logic-coder/SKILL.md +7 -8
  66. package/skills/a2h-arkts-logic-coder/references/ISSUES.md +1 -1
  67. package/skills/a2h-arkts-logic-coder/references/code-generation.md +27 -15
  68. package/skills/a2h-batch-ui-align/SKILL.md +1 -1
  69. package/skills/a2h-batch-ui-align/references/cards/widgets.md +4 -0
  70. package/skills/a2h-batch-ui-align/references/checker-rules.md +36 -0
  71. package/skills/a2h-batch-ui-align/references/conversion-procedure.md +4 -0
  72. package/skills/a2h-batch-ui-align/references/mappings/android-to-harmonyOS-ui-layout-mapping-reference.md +4 -0
  73. package/skills/a2h-batch-ui-align/references/step5-convert.md +3 -3
  74. package/skills/a2h-batch-ui-align/scripts/group_queue.mjs +49 -3
  75. package/skills/a2h-batch-ui-align/scripts/static_check/core/android.ts +36 -0
  76. package/skills/a2h-batch-ui-align/scripts/static_check/main.ts +8 -0
  77. package/skills/a2h-batch-ui-align/scripts/static_check/registry.ts +8 -0
  78. package/skills/a2h-batch-ui-align/scripts/static_check/rules/overlay_in_linear.ts +164 -0
  79. package/skills/a2h-batch-ui-align/scripts/static_check/rules/self_drawn_sheet.ts +105 -0
  80. package/skills/a2h-batch-ui-align/scripts/static_check/rules/staggered_lanes.ts +127 -0
  81. package/skills/a2h-batch-ui-align/scripts/static_check/rules/window_size_constant.ts +114 -0
  82. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_coolmall_ds1123.test.mjs +433 -0
  83. package/skills/a2h-batch-ui-align/scripts/tests/arkts_static_check_overlay_in_linear.test.mjs +288 -0
  84. package/skills/a2h-batch-ui-align/scripts/tests/group_queue.test.mjs +46 -0
  85. package/skills/a2h-page-specgen/references/scenario-authoring.md +4 -1
  86. package/skills/a2h-page-specgen/references/spec-example.md +35 -5
  87. package/skills/a2h-page-specgen/references/spec-template.md +4 -4
  88. package/skills/a2h-spec-generate/SKILL.md +3 -1
  89. package/skills/a2h-spec-generate/references/fusion-task-contract.md +15 -3
  90. package/skills/a2h-spec-generate/references/review-checklist.md +1 -0
  91. package/skills/a2h-spec-generate/references/spec-sample-complex.md +16 -0
  92. package/skills/a2h-spec-generate/references/spec-sample-transfer.md +16 -0
  93. package/skills/a2h-spec-generate/references/spec-samples.md +5 -1
  94. package/skills/a2h-spec-generate/references/synthesis-rules.md +21 -1
  95. package/skills/a2h-spec-generate/references/worker-rules.md +25 -2
  96. package/skills/a2h-spec-generate/scripts/check-fused-spec.mjs +3 -1
  97. package/skills/a2h-spec-generate/scripts/check_spec.ts +262 -6
  98. package/skills/a2h-spec-generate/scripts/reqgen/src/fusion/task-contract.ts +12 -2
  99. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-behavior-e2e.test.ts +3 -0
  100. package/skills/a2h-spec-generate/scripts/reqgen/test/fusion-spec.test.ts +16 -2
  101. package/skills/a2h-spec-generate/test/check-fused-spec.test.mjs +54 -3
  102. package/skills/a2h-spec-generate/test/check-spec.test.ts +247 -0
@@ -0,0 +1,288 @@
1
+ // arkts_static_check: overlay-component-in-linear-container (cross-file).
2
+ // Measured (ds-1123 Weather): the shell wrapped content + search overlay in ForEach { Column { ... } };
3
+ // the overlay landed below the 100%-high content page and never appeared.
4
+ // Run from scripts/: node --test tests/arkts_static_check_overlay_in_linear.test.mjs
5
+ import { test } from 'node:test';
6
+ import assert from 'node:assert/strict';
7
+ import { spawnSync } from 'node:child_process';
8
+ import * as fs from 'node:fs';
9
+ import * as os from 'node:os';
10
+ import * as path from 'node:path';
11
+ import { fileURLToPath } from 'node:url';
12
+
13
+ const CHECKER = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'arkts_static_check.ts');
14
+
15
+ /** files: { 'components/X.ets': src }, android: { 'app/src/.../X.kt': src } | null -> stdout */
16
+ function run(files, android = null) {
17
+ const proj = fs.mkdtempSync(path.join(os.tmpdir(), 'asc-overlay-linear-'));
18
+ const ets = path.join(proj, 'entry/src/main/ets');
19
+ const args = [CHECKER, '--ets', ets];
20
+ try {
21
+ for (const [rel, src] of Object.entries(files)) {
22
+ fs.mkdirSync(path.dirname(path.join(ets, rel)), { recursive: true });
23
+ fs.writeFileSync(path.join(ets, rel), src, 'utf8');
24
+ }
25
+ if (android !== null) {
26
+ const adir = path.join(proj, 'android');
27
+ for (const [rel, src] of Object.entries(android)) {
28
+ fs.mkdirSync(path.dirname(path.join(adir, rel)), { recursive: true });
29
+ fs.writeFileSync(path.join(adir, rel), src, 'utf8');
30
+ }
31
+ args.push('--android', adir);
32
+ }
33
+ return spawnSync(process.execPath, args, { encoding: 'utf8' }).stdout;
34
+ } finally {
35
+ fs.rmSync(proj, { recursive: true, force: true });
36
+ }
37
+ }
38
+
39
+ /** [file:line, ...] of one rule's hits within one section ('GATE' | 'CANDIDATES') */
40
+ function hits(out, rule, section = 'GATE') {
41
+ const gateAt = out.indexOf('[GATE]');
42
+ const candAt = out.indexOf('[CANDIDATES]');
43
+ const body = section === 'GATE' ? out.slice(gateAt, candAt) : out.slice(candAt);
44
+ return [...body.matchAll(new RegExp(`^ ${rule}\\s+(\\S+:\\d+)$`, 'gm'))].map((m) => m[1]);
45
+ }
46
+
47
+ const RULE = 'overlay-component-in-linear-container';
48
+
49
+ // Root shown on a flag, full size, slides in: the shape of SearchMenuFragmentDialog.
50
+ const overlay = (name = 'SearchSheet', root = `if (this.visible) {
51
+ Stack() {
52
+ Text('panel')
53
+ }
54
+ .width('100%')
55
+ .height('100%')
56
+ .transition(TransitionEffect.move(TransitionEdge.BOTTOM))
57
+ }`) => `@ComponentV2
58
+ export struct ${name} {
59
+ @Param visible: boolean = false;
60
+ build() {
61
+ ${root}
62
+ }
63
+ }
64
+ `;
65
+
66
+ const content = `@ComponentV2
67
+ export struct Home {
68
+ build() {
69
+ Stack() {
70
+ Text('home')
71
+ }
72
+ .width('100%')
73
+ .height('100%')
74
+ }
75
+ }
76
+ `;
77
+
78
+ const shell = (body) => `import { SearchSheet } from '../components/SearchSheet';
79
+ import { Home } from '../components/Home';
80
+ @Entry
81
+ @ComponentV2
82
+ struct Shell {
83
+ @Local show: boolean = false;
84
+ @Local rev: number = 0;
85
+ build() {
86
+ ${body}
87
+ }
88
+ }
89
+ `;
90
+
91
+ test('gates an overlay laid out after full-size content in a Column (Weather shell)', () => {
92
+ const out = run({
93
+ 'components/SearchSheet.ets': overlay(),
94
+ 'components/Home.ets': content,
95
+ 'pages/Shell.ets': shell(`Stack() {
96
+ ForEach([this.rev], (r: number) => {
97
+ Column() {
98
+ if (this.rev > 99) {
99
+ Text('settings')
100
+ } else {
101
+ Home()
102
+ }
103
+ SearchSheet({ visible: this.show })
104
+ }
105
+ .width('100%')
106
+ .height('100%')
107
+ }, (r: number) => \`\${r}\`)
108
+ }`),
109
+ });
110
+ assert.deepEqual(hits(out, RULE), ['pages/Shell.ets:17']);
111
+ assert.match(out, /below the viewport/);
112
+ });
113
+
114
+ test('skips the overlay once it is a Stack sibling of the content (the fix)', () => {
115
+ const out = run({
116
+ 'components/SearchSheet.ets': overlay(),
117
+ 'components/Home.ets': content,
118
+ 'pages/Shell.ets': shell(`Stack() {
119
+ ForEach([this.rev], (r: number) => {
120
+ Column() {
121
+ Home()
122
+ }
123
+ .width('100%')
124
+ .height('100%')
125
+ }, (r: number) => \`\${r}\`)
126
+ SearchSheet({ visible: this.show })
127
+ }`),
128
+ });
129
+ assert.deepEqual(hits(out, RULE), []);
130
+ assert.deepEqual(hits(out, RULE, 'CANDIDATES'), []);
131
+ });
132
+
133
+ test('ignores siblings in another branch of the same if / else chain', () => {
134
+ const out = run({
135
+ 'components/SearchSheet.ets': overlay(),
136
+ 'components/Home.ets': content,
137
+ 'pages/Shell.ets': shell(`Column() {
138
+ if (this.show) {
139
+ SearchSheet({ visible: true })
140
+ } else {
141
+ Home()
142
+ }
143
+ }`),
144
+ });
145
+ assert.deepEqual(hits(out, RULE), []);
146
+ });
147
+
148
+ test('gates an overlay placed before the content, reached through a wrapper component', () => {
149
+ const out = run({
150
+ 'components/SearchSheet.ets': overlay('Inner'),
151
+ 'components/Wrap.ets': `import { Inner } from './SearchSheet';
152
+ @ComponentV2
153
+ export struct SearchSheet {
154
+ @Param visible: boolean = false;
155
+ build() {
156
+ Inner({ visible: this.visible })
157
+ }
158
+ }
159
+ `,
160
+ 'components/Home.ets': content,
161
+ 'pages/Shell.ets': shell(`Column() {
162
+ SearchSheet({ visible: this.show })
163
+ Home()
164
+ }`).replace("'../components/SearchSheet'", "'../components/Wrap'"),
165
+ });
166
+ assert.deepEqual(hits(out, RULE), ['pages/Shell.ets:10']);
167
+ assert.match(out, /pushes the content out of view/);
168
+ assert.match(out, /through SearchSheet → Inner/);
169
+ });
170
+
171
+ test('OVERLAY-IN-FLOW marker downgrades to CAND; positioned call sites are skipped', () => {
172
+ const out = run({
173
+ 'components/SearchSheet.ets': overlay(),
174
+ 'components/Home.ets': content,
175
+ 'pages/Shell.ets': shell(`Column() {
176
+ Home()
177
+ // OVERLAY-IN-FLOW: inline expanding panel by design
178
+ SearchSheet({ visible: this.show })
179
+ SearchSheet({ visible: this.show }).position({ x: 0, y: 0 })
180
+ }`),
181
+ });
182
+ assert.deepEqual(hits(out, RULE), []);
183
+ assert.deepEqual(hits(out, RULE, 'CANDIDATES'), ['pages/Shell.ets:12']);
184
+ });
185
+
186
+ test('does not fire on an always-shown full-size component (a content page, not an overlay)', () => {
187
+ const out = run({
188
+ 'components/SearchSheet.ets': overlay(),
189
+ 'components/Home.ets': content,
190
+ 'pages/Shell.ets': shell(`Column() {
191
+ Text('title')
192
+ Home()
193
+ }`),
194
+ });
195
+ assert.deepEqual(hits(out, RULE), []);
196
+ assert.deepEqual(hits(out, RULE, 'CANDIDATES'), []);
197
+ });
198
+
199
+ // Review !217: an if / else state view (empty view ↔ list) always occupies its place; only its content switches.
200
+ const stateView = `@ComponentV2
201
+ export struct StateView {
202
+ @Param empty: boolean = false;
203
+ build() {
204
+ if (this.empty) {
205
+ Column() {
206
+ Text('empty')
207
+ }
208
+ .width('100%')
209
+ .height('100%')
210
+ } else {
211
+ List() {
212
+ }
213
+ .width('100%')
214
+ .height('100%')
215
+ }
216
+ }
217
+ }
218
+ `;
219
+
220
+ const orderPage = (call) => `import { StateView } from '../components/StateView';
221
+ @Entry
222
+ @ComponentV2
223
+ struct OrderPage {
224
+ @Local empty: boolean = true;
225
+ build() {
226
+ Column() {
227
+ Text('orders').height(56)
228
+ ${call}
229
+ }
230
+ .width('100%')
231
+ .height('100%')
232
+ }
233
+ }
234
+ `;
235
+
236
+ test('does not treat an if / else state-switch view as an overlay', () => {
237
+ for (const call of ['StateView({ empty: this.empty }).layoutWeight(1)', 'StateView({ empty: this.empty })']) {
238
+ const out = run({ 'components/StateView.ets': stateView, 'pages/OrderPage.ets': orderPage(call) });
239
+ assert.deepEqual(hits(out, RULE), [], call);
240
+ assert.deepEqual(hits(out, RULE, 'CANDIDATES'), [], call);
241
+ }
242
+ });
243
+
244
+ test('still gates an if with an empty else branch (shown on a flag)', () => {
245
+ const out = run({
246
+ 'components/SearchSheet.ets': overlay('SearchSheet', `if (this.visible) {
247
+ Stack() {
248
+ Text('panel')
249
+ }
250
+ .width('100%')
251
+ .height('100%')
252
+ } else {
253
+ }`),
254
+ 'components/Home.ets': content,
255
+ 'pages/Shell.ets': shell(`Column() {
256
+ Home()
257
+ SearchSheet({ visible: this.show })
258
+ }`),
259
+ });
260
+ assert.deepEqual(hits(out, RULE), ['pages/Shell.ets:11']);
261
+ });
262
+
263
+ test('skips a weighted call site: it takes only the space its siblings leave', () => {
264
+ for (const attr of ['.layoutWeight(1)', '.flexGrow(1)']) {
265
+ const out = run({
266
+ 'components/SearchSheet.ets': overlay(),
267
+ 'components/Home.ets': content,
268
+ 'pages/Shell.ets': shell(`Column() {
269
+ Text('title').height(56)
270
+ SearchSheet({ visible: this.show })${attr}
271
+ }`),
272
+ });
273
+ assert.deepEqual(hits(out, RULE), [], attr);
274
+ }
275
+ });
276
+
277
+ test('does not read containers out of string literals', () => {
278
+ const out = run({
279
+ 'components/SearchSheet.ets': overlay(),
280
+ 'components/Home.ets': content,
281
+ 'pages/Shell.ets': shell(`Stack() {
282
+ Text('Column() { Home() SearchSheet() }')
283
+ Home()
284
+ SearchSheet({ visible: this.show })
285
+ }`),
286
+ });
287
+ assert.deepEqual(hits(out, RULE), []);
288
+ });
@@ -1433,6 +1433,52 @@ describe('Queue', () => {
1433
1433
  gq.control(hp, { op: 'verified', group: 'G001' }); // idempotent
1434
1434
  });
1435
1435
 
1436
+ // Parents verified and committed every group with its pages still `pending` and filled
1437
+ // batch_progress.json in at the end; an interrupted run then re-converted finished groups.
1438
+ test('3: verified marks the group\'s pages done in batch_progress.json', () => {
1439
+ const pf = path.join(hp, '.hometrans', 'batch_progress.json');
1440
+ fs.writeFileSync(pf, JSON.stringify({ ui_module: 'entry', pages: { p1: { status: 'failed', error: 'old', note: 'kept' } } }), 'utf8');
1441
+ groups[0].page_dirs = ['p1', 'p1b'];
1442
+ groups[0].tier = 'captured';
1443
+ writeCs();
1444
+ init();
1445
+ gq.lease(hp);
1446
+ gq.bind(hp, 'G001', 'ses_1');
1447
+ finish('G001');
1448
+ fs.mkdirSync(path.join(ets, 'components'), { recursive: true });
1449
+ fs.writeFileSync(path.join(ets, 'components', 'Bar.ets'), 'struct Bar {}');
1450
+ fs.appendFileSync(gq._reportPath(hp, 'G001'), 'also wrote components/Bar.ets\n');
1451
+ gq.release(hp, 'G001');
1452
+ assert.equal(JSON.parse(fs.readFileSync(pf, 'utf8')).pages.p1.status, 'failed'); // release alone does not
1453
+ const r = gq.control(hp, { op: 'verified', group: 'G001', summary: 'home page' });
1454
+ assert.deepEqual(r.progress.pages_done, ['p1', 'p1b']);
1455
+ const prog = JSON.parse(fs.readFileSync(pf, 'utf8'));
1456
+ for (const d of ['p1', 'p1b']) {
1457
+ const row = prog.pages[d];
1458
+ assert.equal(row.status, 'done');
1459
+ assert.equal(row.group, 'G001');
1460
+ assert.equal(row.tier, 'captured');
1461
+ assert.equal(row.summary, 'home page');
1462
+ assert.deepEqual(row.output, ['entry/src/main/ets/components/Bar.ets', 'entry/src/main/ets/pages/Home.ets']);
1463
+ }
1464
+ assert.equal(prog.pages.p1.error, undefined);
1465
+ assert.equal(prog.pages.p1.note, 'kept');
1466
+ assert.ok(prog.updated_at);
1467
+ // a resumed queue now skips it
1468
+ assert.equal(gq.initState(hp, prompts).groups.G001.state, 'skipped');
1469
+ });
1470
+
1471
+ test('3: verified refuses another run\'s batch_progress.json and leaves the group returned', () => {
1472
+ init();
1473
+ gq.lease(hp);
1474
+ gq.bind(hp, 'G001', 'ses_1');
1475
+ finish('G001');
1476
+ gq.release(hp, 'G001');
1477
+ fs.writeFileSync(csPath(), JSON.stringify({ plan: { groups, mode: 'incremental', scope_id: 'inc-1-aaaaaaaaaaaa' } }), 'utf8');
1478
+ assert.throws(() => gq.control(hp, { op: 'verified', group: 'G001' }), /belongs to another run/);
1479
+ assert.equal(load().groups.G001.state, 'returned');
1480
+ });
1481
+
1436
1482
  test('3: verified on a skipped group (done before the queue) is a no-op, not an error', () => {
1437
1483
  fs.writeFileSync(path.join(hp, '.hometrans', 'batch_progress.json'),
1438
1484
  JSON.stringify({ ui_module: 'entry', pages: { p1: { status: 'done' } } }), 'utf8');
@@ -21,6 +21,7 @@
21
21
  - 源码使用动态错误文案时,写明真实来源,例如:“展示服务端返回的错误文本。”
22
22
  - 失败时不显示文字提示也是合法行为。只写实际可观察的结果,例如加载结束、保留旧内容或其他真实结果;例如:“请求结束后停止加载并保留旧内容,不显示额外提示。”
23
23
  - 内部失败如果没有用户可感知的结果,就不应写成界面场景。不得为了覆盖某种失败类型而编造提示、跳转或状态变化。
24
+ - **「界面展示什么」的证据取自渲染分支,不取自状态赋值**。ViewModel 里给某个状态赋了值(如空列表时 `loadMoreState = PullToLoad`),只说明这个值存在,不说明它被画出来了。写「展示 / 显示 / 出现」这类步骤前,先找到该状态下实际渲染的界面代码(Compose 的 `when (state)` / `if` 分支、View 的 `visibility` 设置、Adapter 的 item 类型),确认那个分支读取了这个值并画出对应元素。分支里没有读取它,就不写成可见元素;需要记录时,写成不可见的状态事实(例如「加载更多状态重置为初始值」),不用「展示」。CoolMall 订单列表的实例:`BaseNetWorkListView` 的 `Empty` 分支只画 `EmptyData`,加载更多的底栏只在 `Success` 的列表内容里;SPEC 把空列表时的 `PullToLoad` 赋值写成「该页签底部展示可上拉加载更多的初始状态」,评审照此判 PARTIAL,修复后空页签底部多出「上拉加载更多」。
24
25
 
25
26
  ## 原子场景
26
27
 
@@ -167,6 +168,7 @@ lifecycle-signal 候选逐个复核后三选一:有用户可感知行为 →
167
168
  场景涉及网络请求时,请求体必须在 `contracts.endpoints` 中写到键一级,不能只写“调用接口”或只给 URL;返回结果也应尽量写到键一级。契约是事实底稿:请求方法、完整 URL、每个参数名和每个响应字段都要以自然语句合入消费它的请求步骤(见 `spec-template.md` 1.4)。
168
169
 
169
170
  - 请求体的每个键写明键名、类型、是否必填、默认值(缺省取值)、嵌套结构和取值来源(界面输入、本地存储、上一次响应或固定值);查询参数、路径参数和请求头同样逐项列出,并用 `in` 标明归属。
171
+ - **逐字段写明是否上线发送**:每个参数标明必传或非必传;非必传的在其 `note` 里写明发送规则——什么情况下不发送(未选择、为空、等于默认值、开关关闭等),或该字段始终发送(取默认值)。原平台序列化会省略默认值、空串或空数组时,写成“该字段等于默认值时请求体中不出现”;不得用“没有则为空”“缺省传空”概括,也不得把默认值当空值发出——接收端可能把出现的字段当作筛选条件;字段确实始终发送时写“始终发送(取默认值)”,不要为满足格式编造省略条件。鸿蒙侧沿用同一发送语义。
170
172
  - 只使用 `spec-template.md` 列出的键:默认值与取值来源写进该参数的 `default` 和 `source`,嵌套键写成路径(如 `data.list[].id`)填 `name`;其他额外键无法进入步骤,会被 G2 拒绝。
171
173
  - 请求体为对象或数组时写清层级与每个子键,不得写“其他字段”“等”或只给一个示例值。
172
174
  - 返回结果尽量在 `response_fields` 中逐个列出字段路径(如 `current_temperature`、`hourly.temperatures[]`),只写字段名或路径;外层封装(如 code/data/message)、类型、可空性以及字段缺失或为缺省值时的处理写进该接口的 `note` 并合入步骤,不要塞进 `response_fields` 的元素里——G2 要求元素与步骤逐字一致。
@@ -258,10 +260,11 @@ SPEC 是供再实现的契约:无法落成代码或测试断言的表述都是
258
260
  - 已按「生命周期与失效通知轴」对四类触发逐类对照源码检查,lifecycle-signal 候选都有终态处置。
259
261
  - 每条已发现的异常路径都有明确处置:独立场景、同一路径中的步骤,或确认它没有用户可感知行为。
260
262
  - 已检查列表和复杂展示区域的空数据与部分数据。
263
+ - 每个「展示 / 显示 / 出现」步骤都能对到该状态下实际渲染它的界面分支(`文件:行号`),不是只对到 ViewModel 的状态赋值;空态、错误态、加载态下尤其逐条核对,这些分支通常只画一个占位组件。
261
264
  - 已检查异步操作的进行中、成功以及源码实现的失败状态。
262
265
  - 已检查持久化操作的写入结果和回读行为。
263
266
  - 涉及增删改查、状态同步或数据同步的场景,已逐项列出所有受影响的数据及其变化,没有“相关数据同步变化”之类的笼统表述。
264
- - 涉及网络请求的场景已在 `contracts.endpoints` 写全请求体的每个键名、类型、必填、默认值与取值来源,并尽量写清返回结果的结构,且这些事实已合入请求步骤。
267
+ - 涉及网络请求的场景已在 `contracts.endpoints` 写全请求体的每个键名、类型、必传或非必传、默认值、取值来源与发送规则(非必传字段在什么情况下不出现,或始终按默认值发送),并尽量写清返回结果的结构,且这些事实已合入请求步骤。
265
268
  - 没有用“其他错误统一处理”之类的含糊措辞替代具体分支。
266
269
  - 每个场景都能独立阅读,没有跨场景省略引用,也没有为填补空白而增加无证据的文案、分支、阈值或结果。
267
270
  - 每个场景只对应一个正常用例或一个边界/异常用例,没有把成功与失败混在一起。
@@ -182,6 +182,35 @@
182
182
 
183
183
  ### 场景概述
184
184
 
185
+ 添加歌曲时客户端把本次添加提交到服务端,请求体只包含必传字段与本次生效的可选字段
186
+
187
+ ### 场景逻辑步骤
188
+
189
+ - 1. 用户通过任意入口把一首或多首歌曲添加到目标歌单,页面在刷新本地列表的同时发起提交
190
+ - 2. 页面发送 `POST https://api.example.com/v1/playlist/songs` 请求,请求头的内容类型为 application/json,字符集为 utf-8
191
+ - 3. 请求体的 `playlistId` 与 `songIds` 必传:`playlistId` 是目标歌单的编号,`songIds` 是本次添加的歌曲编号数组,两者每次请求都发送
192
+ - 4. `source` 非必传:从歌曲列表、专辑、艺术家或文件夹进入时分别发送 song_list、album、artist、folder,从歌单详情页进入时发送 playlist_detail;来源无法判断时不发送该字段,也不发送空串
193
+ - 5. `position` 非必传:用户没有指定插入位置时不发送该字段,由服务端按歌单当前排序规则追加;只有用户明确拖动排序并指定位置时才发送 `position`
194
+ - 6. 响应返回后 `code` 为 0,按 `data.addedCount` 刷新歌单歌曲数与封面,本次添加完成
195
+
196
+ ## 场景八
197
+
198
+ ### 场景概述
199
+
200
+ 服务端返回业务失败时撤销本地追加并展示失败提示
201
+
202
+ ### 场景逻辑步骤
203
+
204
+ - 1. 用户通过任意入口把一首或多首歌曲添加到目标歌单,页面在刷新本地列表的同时发起提交
205
+ - 2. 页面发送 `POST https://api.example.com/v1/playlist/songs` 请求,请求头的内容类型为 application/json,字符集为 utf-8
206
+ - 3. 请求体的 `playlistId` 与 `songIds` 必传;`source` 非必传,来源无法判断时不发送;`position` 非必传,未指定插入位置时不发送
207
+ - 4. 响应返回后 `code` 不为 0,撤销本地追加的歌曲,歌单歌曲数与封面恢复为提交前的值
208
+ - 5. 展示响应中的 `message`,已存在的歌单数据保持不变
209
+
210
+ ## 场景九
211
+
212
+ ### 场景概述
213
+
185
214
  用户进入歌单详情页,查看歌单名称及歌曲列表
186
215
 
187
216
  ### 场景逻辑步骤
@@ -191,7 +220,7 @@
191
220
  - 3. 页面下方展示歌单包含的歌曲列表,歌曲按照当前歌单配置的排序规则进行展示
192
221
  - 4. 新建歌单的默认排序规则为"按添加到歌单时间排序"(后添加到歌单的歌曲排在上面)
193
222
 
194
- ## 场景八
223
+ ## 场景十
195
224
 
196
225
  ### 场景概述
197
226
 
@@ -204,7 +233,7 @@
204
233
  - 3. 歌曲列表按所选规则重新排序并刷新展示
205
234
  - 4. 该排序规则在用户再次切换前保持生效,后续新添加的歌曲按该规则插入对应位置
206
235
 
207
- ## 场景九
236
+ ## 场景十一
208
237
 
209
238
  ### 场景概述
210
239
 
@@ -216,7 +245,7 @@
216
245
  - 2. 如果所选歌曲中存在已在目标歌单中的歌曲,该歌曲不会被重复添加,其原有的添加时间保持不变
217
246
  - 3. 对于本次操作中尚未在目标歌单中的歌曲,按对应排序规则正常添加
218
247
 
219
- ## 场景十
248
+ ## 场景十二
220
249
 
221
250
  ### 场景概述
222
251
 
@@ -228,7 +257,7 @@
228
257
  - 2. 用户通过点击弹窗外部区域关闭弹窗
229
258
  - 3. 歌单内容不发生任何变化,用户返回操作前的页面状态
230
259
 
231
- ## 场景十一
260
+ ## 场景十三
232
261
 
233
262
  ### 场景概述
234
263
 
@@ -239,7 +268,7 @@
239
268
  - 1. 用户通过添加到歌单操作触发歌单选择弹窗
240
269
  - 2. 歌单选择弹窗通过列表形式展示当前所有已经创建好的歌单,每个歌单对应的歌曲数目是准确的
241
270
 
242
- ## 场景十二
271
+ ## 场景十四
243
272
 
244
273
  ### 场景概述
245
274
 
@@ -258,6 +287,7 @@
258
287
  - app/src/main/java/com/melody/musicapp/ui/dialog/AddToPlaylistDialog.java:66
259
288
  - app/src/main/java/com/melody/musicapp/ui/fragment/PlaylistDetailFragment.java:51
260
289
  - app/src/main/java/com/melody/musicapp/ui/helper/PlaylistSortHelper.java:33
290
+ - app/src/main/java/com/melody/musicapp/network/PlaylistApi.java:31
261
291
  - app/src/main/java/com/melody/musicapp/data/repository/PlaylistRepository.java:39
262
292
  - app/src/main/java/com/melody/musicapp/data/repository/PlaylistRepository.java:58
263
293
  - app/src/main/java/com/melody/musicapp/data/db/dao/PlaylistSongDao.java:27
@@ -44,8 +44,8 @@ Percent encoding is **reversible** (`%` itself becomes `%25`, and the encoded re
44
44
  "url": "https://api.open-meteo.com/v1/forecast",
45
45
  "params": [
46
46
  {"in": "query", "name": "latitude", "type": "数值", "required": true, "note": "当前地点纬度"},
47
- {"in": "query", "name": "temperature_unit", "type": "文本", "required": false, "default": "celsius", "source": "本地存储"},
48
- {"in": "query", "name": "timezone", "type": "文本", "required": false, "default": "Asia/Shanghai", "source": "本地存储"}
47
+ {"in": "query", "name": "temperature_unit", "type": "文本", "required": false, "default": "celsius", "source": "本地存储", "note": "等于默认值 celsius 时请求中不出现"},
48
+ {"in": "query", "name": "timezone", "type": "文本", "required": false, "default": "Asia/Shanghai", "source": "本地存储", "note": "等于默认值 Asia/Shanghai 时请求中不出现"}
49
49
  ],
50
50
  "response_fields": ["current_temperature", "weather_code", "hourly.temperatures[]"],
51
51
  "note": "响应外层为 code/data/message:current_temperature 与 weather_code 不可空,weather_code 缺失按 0 处理;hourly.temperatures[] 可空,缺失不展示该时段",
@@ -105,12 +105,12 @@ Percent encoding is **reversible** (`%` itself becomes `%25`, and the encoded re
105
105
 
106
106
  | kind | Contents | Written into the steps as |
107
107
  |---|---|---|
108
- | `endpoints` | `operation_id` / `branch` / `state_version` (audit-only) / `name` / `method` / `url` / `params[]` (`in`∈`query`\|`path`\|`header`\|`body`, `name` / `type` / `required` / `default` / `source` / `note`) / `response_fields[]` / `timeouts[]` / `note` | The request step: method, complete URL, every parameter name with its type, required flag, default and value source, every response field, and timeouts; `operation_id`, `branch`, and `state_version` are not rendered |
108
+ | `endpoints` | `operation_id` / `branch` / `state_version` (audit-only) / `name` / `method` / `url` / `params[]` (`in`∈`query`\|`path`\|`header`\|`body`, `name` / `type` / `required` / `default` / `source` / `note`) / `response_fields[]` / `timeouts[]` / `note` | The request step: method, complete URL, every parameter name with its type, required flag, default and value source, and for a non-required parameter the condition under which it is not sent, every response field, and timeouts; `operation_id`, `branch`, and `state_version` are not rendered |
109
109
  | `stores` | `name` / `key` / `type` / `default` / `values[]` (strings or `{value, label}`) / `note` | The persistence step: key name, type, default, and every enum value — never "等" |
110
110
  | `entities` | `name` / `fields[]` (`name` / `type` / `nullable` / `unit` / `note`) / `note` | The display or computation step: the entity's business name and every field with its type, nullability, and unit |
111
111
  | `rules` | `name` / `statement` | The step that performs the conversion or applies the boundary: an instruction that can be followed verbatim |
112
112
 
113
- **Request and response keys are written key by key.** A parameter's default and value source belong in its `default` and `source` fields (`default: 0`, `source: 本地存储`) and are merged into the request step; a nested key keeps its path in `name` (`data.list[].id`); `response_fields[]` lists one field path per string (`current_temperature`, `hourly.temperatures[]`), while the envelope (code/data/message), types, nullability and missing-value handling go into the entry's `note` and the step text. An endpoint or parameter field outside the lists above, or a non-string `response_fields[]` item, is rejected by G2 because the fact base cannot carry it.
113
+ **Request and response keys are written key by key.** A parameter's default and value source belong in its `default` and `source` fields (`default: 0`, `source: 本地存储`) and are merged into the request step; a nested key keeps its path in `name` (`data.list[].id`); a non-required parameter also states in its `note` when it is absent from the wire (e.g. “equals its default, so the request body omits it”) or that it is always sent with its default (“always sent, uses the default value”), and the request step carries that rule too so the coder does not turn a default value into a sent key; `response_fields[]` lists one field path per string (`current_temperature`, `hourly.temperatures[]`), while the envelope (code/data/message), types, nullability and missing-value handling go into the entry's `note` and the step text. An endpoint or parameter field outside the lists above, or a non-string `response_fields[]` item, is rejected by G2 because the fact base cannot carry it.
114
114
 
115
115
  **The body language rules apply to the merged steps.** Contract-only syntax is no longer legal anywhere: no `dp`/`sp`/`px`/`dip` (with or without a number), no `#hex`, no `key=value` (write `字段 code 为 1001`), no framework type names, no `file:line`. Visual values are rewritten as business descriptions ("档位为大号"). Data values keep their source spelling (`maxRows`, `countryName`, `temperaturePrefs`, `kmh`) because the coder must use the same names. A value the body rules forbid verbatim (`600dp`, `#FF5733`, `timezone=auto`, a framework type) is therefore rewritten, and G2 does not require it token by token.
116
116
 
@@ -82,9 +82,11 @@ The supplied UTG workspace stays outside the run root and is always read-only; i
82
82
  **Key deliverables**:
83
83
 
84
84
  - `specs.json`: the published manifest of every SPEC in deterministic page-batch order — `<run-directory>/generation/specs/specs.json` (idx anchor root).
85
- - `N × <feature>-SPEC.md`: platform-neutral HarmonyOS implementation specifications — `<run-directory>/generation/specs/<idx>/<feature>-SPEC.md`, re-published page-grouped at `<run-directory>/generation/pages/<page>/<feature>-SPEC.md` by Step 5b.
85
+ - `N × <feature>-SPEC.md`: platform-neutral HarmonyOS implementation specifications — `<run-directory>/generation/specs/<idx>/<feature>-SPEC.md`, re-published page-grouped at `<run-directory>/generation/pages/<page>/<feature>-SPEC.md` by Step 5b. Every SPEC carries a `## 数据契约` section: one six-key block (`字段`/`类型`/`字节长度`/`取值域`/`样例`/`语义来源`) per external field, or the single line `不涉及外部数据`. `check_spec.ts` rejects the SPEC when the section is missing, misplaced, or incomplete.
86
86
  - `pages/`: the page-grouped re-publication of the same SPECs for page-oriented consumers (`a2h-spec-design-pipeline` groups by the spec file's parent directory) — `<run-directory>/generation/pages/<page>/<feature>-SPEC.md` plus its own `specs.json` (so-ids re-minted in page order — a fresh campaign key, never swapped in mid-pipeline).
87
87
 
88
+ **Migration for existing SPECs.** The data-contract section is a hard gate: a SPEC generated before it existed fails `check_spec.ts` when the run is resumed or re-published. That is intentional, not an accident. Before rerunning the gate, either regenerate the SPEC or add the single line `不涉及外部数据` when it reads no external data, or add its field blocks. New runs generate the section automatically.
89
+
88
90
  **Source provenance in every published SPEC.** `collect-specs` appends one `## 源码位置` section at
89
91
  the end of every SPEC. It is the only place a source path may appear: the body stays platform-neutral
90
92
  and carries no `file:line` (`check_spec`'s `code-anchor-leak` rule), so the section is the only
@@ -127,10 +127,13 @@ R4 以账本为准:缺项、重复项、指向不存在的 stem 都会失败
127
127
  折叠进同一 sidecar entry 后若两份 SPEC 同名,L2 保留先声明者、丢弃后声明者并记
128
128
  `INVALID_AGENT_OUTPUT` 诊断——需要给其中一份加后缀后重跑门禁与 `finalize`;
129
129
  - 在 `specs/<stem>-SPEC.md` 写出该 SPEC(H1 为 `# <stem>SPEC`,`## UI序列` 为 `title` 逐字,
130
- 正文按内联的常驻规则与门禁清单撰写);
130
+ `## 数据契约` 为每个外部字段写出 `字段`/`类型`/`字节长度`/`取值域`/`样例`/`语义来源`,无外部数据时写
131
+ `不涉及外部数据`,正文按内联的常驻规则与门禁清单撰写);
131
132
  - `owner` 是四变体联合:默认 `area`(页面 owner 的功能 SPEC,可多份);局部绑定时为
132
133
  `controlGroup`(按 `controlGroupKey`)、`discovery`(按 `discoveryKey`)或
133
- `agent-added`(自带 `identityAnchors`);`citations` ≥1 且行号可核对。
134
+ `agent-added`(自带 `identityAnchors`);`citations` ≥1 且行号可核对。SPEC 有 `## 数据契约`
135
+ 时,`citations` 必须包含契约定义文件(schema / proto / codec / parser / 日期格式表),发布后落在
136
+ `## 源码位置`,评审据此核对。
134
137
 
135
138
  常驻规则(`worker-rules.md` 正文)与门禁清单(必读 + 命中才读)由 prepare **内嵌**进 `task.md`;
136
139
  SPEC 的机械校验规则见 `check_spec.ts`。
@@ -165,7 +168,16 @@ SPEC 的机械校验规则见 `check_spec.ts`。
165
168
  **交互面为空时也不例外**。没有 citation 支撑的展示行为不得编造。R6 机器无法判定"是否漏"——
166
169
  漏了不报错,但任务未完成。
167
170
  - **R6a 展示值派生(必需)**:每个数值/文案字段写出来源字段、时间窗口、聚合、取整、符号、单位
168
- 换算;不允许只写“显示 N”或“差值整数”。一个流程内的共享派生规则写一次,后续字段引用。
171
+ 换算;不允许只写“显示 N”或“差值整数”。规则必须唯一确定一个结果:运算顺序(先取整再相减 / 先
172
+ 相减再取整)、取整方式(四舍五入、截断、负半值)、时间基准(最近槽位还是向下取整、哪个时区)
173
+ 会给出不同数字的,必须写出该选择;每个派生数值字段给一个算式示例(具体输入 → 具体输出),
174
+ 写不出示例或示例与规则不符,回源码重写。字段逐个列出,不得用“每条记录/每个值”概括。
175
+ 一个流程内的共享派生规则写一次,后续字段引用。
176
+ - **R6b 状态空间(必需)**:页面流程 SPEC 在 `## UI序列` 之后、第一个场景之前写 `## 状态清单`,
177
+ 逐行 `- <情况>:<用户看到什么>`。八种情况每种一行,一个不能少:首帧、加载中、成功、数据为空、
178
+ 数据不足、失败、非默认语言、离开后重新进入;本页面到不了的情况写 `- 加载中:不适用(理由)`,
179
+ 理由不能空。值写该状态下用户看到的结果,或“保持上一次成功数据的显示”,不许写“否则不发生更新”。
180
+ 首帧与非默认语言写资源/布局里的实际字面量。
169
181
  - **R7 SPEC 唯一性(`check-fusion` 机械校验)**:`owner.kind:"area"` 可以有**多份**(页面 owner
170
182
  按用户可见流程拆分,如 eco 一个页批次写多份 SPEC);每个 `controlGroup`/`discovery` **至多一条**
171
183
  `specRecord`(重复失败);`agent-added` 数量不限(`stem` 仍须唯一)。`specs/` 目录下未声明的
@@ -18,5 +18,6 @@ Read this file at Step 2.4 and run every check below against the evidence collec
18
18
  12. **Transfer-contract completeness** — every contract 2.5 will state has anchored evidence (direction, endpoint or frame, field order, encoding, branch value, timeout/retry, callback payload, repeat, unregister behavior) collected under the transfer-side literals. 2.2's collection step, not `interaction`/`data_flow`, is the source of truth. Carrier details stay distinguishable from business protocol so synthesis cannot copy Binder/Parcel/Bundle mechanics as product protocol. An unanchored contract field fails.
19
19
  13. **No view description in synthesis-bound evidence** — layout and visual attributes are collected as raw evidence, but a displayed value whose meaning rests on a size, position or color (「该栏在右侧」 as a value's derivation) is not evidence of what the user sees: re-derive it as a source or condition claim, or drop it. Since 2.5 emits none of these values, a claim only a layout attribute supports has no spec-side form and fails here rather than leaking downstream (Principle 10).
20
20
  14. **Motion timing is captured** — for every transition the source implements (a page or panel entering/leaving, expand/collapse, slide-out), the evidence carries the duration the source actually fixes and the order in which concurrent animations start. A spring- or velocity-driven animation carries its feel plus the fact that it has no fixed duration — never an invented number. A duration that is only a platform default (`@android:integer/config_mediumAnimTime`, a `windowAnimationStyle` tier) is not a project fact: resolve it through `references/library-evidence.md` and mark it platform-derived, or record that the source leaves the timing to the platform and give no number. Also record whether the source pins an interpolator; a spring is an interpolator too, so 「源码未指定插值器」 is itself a fact worth writing down. This evidence is published in the spec (the Principle 10 exception in `references/synthesis-rules.md`) as duration and ordering — an easing description is optional, and its absence is not a failure — so a transition whose timing was never collected cannot be filled in at synthesis and fails here.
21
+ 15. **Data contract completeness** — every external field the SPEC reads has a `## 数据契约` block with all six keys (`字段`/`类型`/`字节长度`/`取值域`/`样例`/`语义来源`), and each value is source-backed rather than guessed. The SPEC's `citations` must include the file that **defines** that contract (schema, proto, codec, parser or date-format table) — it is published under `## 源码位置`, and must point at the definition, not only at the widget that consumes it. The `样例` value must be one the scenario branch actually consumes. A SPEC that reads no external data carries the single line `不涉及外部数据`. Missing block, missing contract-file citation, a sample that does not match the branch, or a guessed width/format fails here.
21
22
 
22
23
  If evidence is insufficient, query again or weaken/remove the unsupported claim. Do not create a placeholder value.
@@ -13,6 +13,22 @@ The trigger is one click; the substance is what the card shows and where each va
13
13
 
14
14
  详情-详情页-详情卡片
15
15
 
16
+ ## 数据契约
17
+
18
+ - 字段:title
19
+ - 类型:string
20
+ - 字节长度:变长
21
+ - 取值域:非空文本;缺失时由本地原始标题回填
22
+ - 样例:夜曲
23
+ - 语义来源:对象标题字段定义
24
+
25
+ - 字段:coverUrl
26
+ - 类型:string
27
+ - 字节长度:变长
28
+ - 取值域:绝对地址;缺失时为空
29
+ - 样例:https://cdn.example.com/cover/42.jpg
30
+ - 语义来源:对象封面字段定义
31
+
16
32
  ## 场景一
17
33
 
18
34
  ### 场景概述
@@ -10,6 +10,22 @@
10
10
 
11
11
  设置-同步-立即同步
12
12
 
13
+ ## 数据契约
14
+
15
+ - 字段:code
16
+ - 类型:int32
17
+ - 字节长度:4
18
+ - 取值域:0 表示成功;1001 表示业务失败
19
+ - 样例:0
20
+ - 语义来源:同步接口响应字段定义
21
+
22
+ - 字段:data.syncId
23
+ - 类型:string
24
+ - 字节长度:变长
25
+ - 取值域:非空同步标识
26
+ - 样例:sync-20261112-0001
27
+ - 语义来源:同步接口响应字段定义
28
+
13
29
  ## 场景一
14
30
 
15
31
  ### 场景概述
@@ -1,6 +1,6 @@
1
1
  # Spec few-shot samples
2
2
 
3
- Read this file at Step 2.5 after `references/synthesis-rules.md`. The samples illustrate **scenario decomposition granularity and wording**, and show where `## UI序列` sits: one line, directly under the requirement description and above `## 场景一`. They are truncated for brevity — a real spec ends with its last scenario and carries no footer.
3
+ Read this file at Step 2.5 after `references/synthesis-rules.md`. The samples illustrate **scenario decomposition granularity and wording**, and show where `## UI序列` and `## 数据契约` sit: `## UI序列` is one line directly under the requirement description, `## 数据契约` follows it and precedes `## 场景一`. They are truncated for brevity — a real spec ends with its last scenario and carries no footer.
4
4
 
5
5
  Every value below is concrete. `<...>` placeholders never appear in an emitted spec: a value that has no source evidence becomes weakened spec wording, never a bracketed stub (see the No-Vagueness Rules in `references/synthesis-rules.md`).
6
6
 
@@ -14,6 +14,10 @@ Every value below is concrete. `<...>` placeholders never appear in an emitted s
14
14
 
15
15
  歌单-歌单页面-新建歌单
16
16
 
17
+ ## 数据契约
18
+
19
+ 不涉及外部数据
20
+
17
21
  ## 场景一
18
22
 
19
23
  ### 场景概述