File size: 24,852 Bytes
253a5d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
{
  "generation": {
    "digest": "b81c9fbcb209faa406c35c41a5ddd5bd6f3293c56a763be8ea74648e104bc18f",
    "manifest": {
      "approvals": [
        {
          "authorization_ref": "local-web-delegation-v1:user-c3adb31fc78c4d59970af883326ccff5",
          "digest": "2baf0375ac3ec23a688c369099efa1daae564d987e188226d2f19b3e3814b678",
          "increment": true,
          "mechanism": "delegated_local_validation",
          "node": "design_confirm",
          "scope": "design",
          "user_id": "user-c3adb31fc78c4d59970af883326ccff5"
        },
        {
          "authorization_ref": "local-web-delegation-v1:user-c3adb31fc78c4d59970af883326ccff5",
          "digest": "964ffd41aee3977258d296edc9d70f84ad8ab0ea8daa32a680a16ddd8c880132",
          "increment": true,
          "mechanism": "delegated_local_validation",
          "node": "execution_confirm",
          "scope": "execution",
          "user_id": "user-c3adb31fc78c4d59970af883326ccff5"
        },
        {
          "authorization_ref": "local-web-delegation-v1:user-c3adb31fc78c4d59970af883326ccff5",
          "digest": "4a51c5cc046f2e3058e257667ad4d11dcabf72a98cfb942bb8f32c463f973daa",
          "increment": false,
          "mechanism": "delegated_local_validation",
          "node": "repair-execution",
          "scope": "execution",
          "user_id": "user-c3adb31fc78c4d59970af883326ccff5"
        }
      ],
      "candidate": {
        "classes_digest": "ba589b760a2583fe523da87f68e84a69e3914972b2cb6417c9a44f768ba604a1",
        "config_digest": "d223365fd05e5fe9d0e74ec5a440e3c878a1dbd0cb9726cf04be2d4575c7f603",
        "container": "zk-run-8f523ff16b6b4c95832e46b4b6110a8d",
        "execution_mode": "qemu",
        "image": "zkcoding-qemu@sha256:5c866338b848ec50afbbcb7f0827f562c2aced18638922dd72ae73eaa6bc15ec",
        "isolation": {
          "disposable": true,
          "host_mounts": [],
          "memory_mb": 1024,
          "network": "none",
          "vcpu": 1
        },
        "passed": true,
        "receipt_digest": "a210412abeeba14e1ed2bf41626eb8b8aad3ed81083a18fac6e4ee45fbc8599c",
        "receipt_ref": "run-8f523ff16b6b4c95832e46b4b6110a8d-3c06b2b5d67941f9ab16db94af4f52d4",
        "source_digest": "86f2fd3b99c6f8b21ceb2595171ed841194fcc7c791b60ea1a8cf0d90d6ba1be",
        "stage": "build",
        "suite_digest": "9c6339659e17af7ff3da41e664c930429ee4595b97bc1cd9af26dbbe018131ce",
        "tool_receipt": {
          "input_digest": "76be5f23a16ce24a6dff0c8db7acc50d8d50c07fb72144df41dcecc5ac6c6e8e",
          "operation": "AO08",
          "result_digest": "9201318e0f5248cb55ca32c40149334434a3345477535a39b3dc9d6a697820f6",
          "run_id": "run-8f523ff16b6b4c95832e46b4b6110a8d"
        }
      },
      "deployment": "not_performed",
      "development": {
        "design": {
          "summary": "Java17 HttpServer on 8080. GET /health returns {\"status\":\"ok\"}. GET /api/purchase/quote validates query params (quantity, unitPrice, department) strictly: no duplicates/extras, format checks (int 1-10000, decimal >0 <=1e6 with max 2 decimals, dept regex), returning 400 INVALID_INPUT on failure. Rejects non-GET with 405. Requires 'Authorization: Bearer demo-sales' header; missing/invalid gives 401 UNAUTHORIZED. If authenticated as sales but department param is not 'sales', returns 403 FORBIDDEN. Computes total using BigDecimal, sets scale to 2 HALF_UP. Approval level based on total: <10k SELF, >=10k & <100k MANAGER, >=100k DIRECTOR. Returns JSON {total, approval, department}. Unknown paths return 404 NOT_FOUND. No external deps."
        },
        "requirement": "# DEMO-BIZ-01:采购报价与审批工作台\n\n## 背景与用户\n某制造企业采购员需要在提交采购申请前核算采购金额,确定审批级别。财务要求金额精确到分;不同部门不能越权计算其他部门业务。当前交付为本地演示网站,演示用户对应sales部门,数据不接客户生产系统。\n\n## 用户流程和界面\n页面标题“采购报价与审批”,桌面使用左侧输入、右侧结果布局,窄屏改为上下排列。顶部只显示应用名称和可使用状态;说明当前账号所属部门及审批金额区间。\n输入区含采购数量、含税单价、部门(默认sales)及“计算报价”“恢复示例”按钮,默认数量3、单价125.50。显示金额单位和数量范围。提交时禁用按钮并显示简短处理状态,返回后恢复。支持Enter提交;错误在字段附近或结果区清晰展示,不用弹窗代替结果。\n结果区显示金额两位小数、部门和审批级别中文;修改输入后清除旧结果,失败时不把旧结果当新成功。应用不显示原始接口JSON、源码摘要、沙箱/测试步骤或制品下载;代码、差异与运行证据在工作台查看。点击预览由平台内部准备,独立端口展示完成应用。样式应简洁、键盘可访问,无横向溢出。\n\n## 编程需求与验收\n- BIZ-01:Java17标准库HttpServer,8080端口,GET /health返回status=ok。前端HTML/CSS/JS使用交付的受控页面,调用同一个沙箱Java服务,不在浏览器重复实现金额业务逻辑。\n- BIZ-02:GET /api/purchase/quote只接受quantity、unitPrice、department,禁止重复或未知参数。quantity为1–10000整数;unitPrice为大于0且不超过1000000、最多两位小数的十进制数字;department符合固定标识格式。错误统一400 INVALID_INPUT。\n- BIZ-03:使用BigDecimal,输出两位小数字符串。3×0.10必须为0.30,3×125.50为376.50。禁止浮点金额计算。\n- BIZ-04:总额<10000为SELF;10000至小于100000为MANAGER;≥100000为DIRECTOR。测试9999.99、10000、99999.99、100000及最大合法输入。\n- BIZ-05:公开演示凭据demo-sales只映射sales。无效身份401;合法请求试图访问finance返回403。不能信任查询参数宣称的身份。已知路径非GET先返回405;未知路径404。\n- BIZ-06:系统测试覆盖上述正常/边界/越权/重复参数,网页测试验证默认376.50、审批阈值、错误输入、键盘提交和窄屏布局。\n\n## 交付与完成条件\n输出src/main/java/demo/App.java,必要说明放docs;不新增框架或依赖,不修改保护测试。交付包含需求原文、技术设计、源码差异、HTML/CSS/JS网站文件、需求到系统测试对应表、实际编译/测试报告、制品清单与摘要。测试失败时使用真实诊断修复并重新执行;技术通过后给可点击的本地网页,人工验收保持待确认。\n\n\nHF验收批次 20261024T043443Z erp。完整实现上述需求;模型、框架和权限仍由服务端冻结契约决定。"
      },
      "human_acceptance": false,
      "model_calls": [
        {
          "charged": 4086,
          "id": 1,
          "metadata": {
            "finish_reason": "stop",
            "model": "qwen3.8-flash",
            "policy_version": "bailian-task-routing-v2",
            "request_id": "chatcmpl-e0a927f6-ec19-9010-b52d-08edc4361673",
            "requested_output_tokens": 2048,
            "retry_of": null,
            "route_reason": "technical-design",
            "stage": "design"
          },
          "prompt_digest": "000db0eae0ba1c5ba2e3fe30a3effedc72b74910294bb3128b3a7bf3c208a2ec",
          "provider": "bailian-qwen3.8-flash",
          "reservation": 16087,
          "run_id": "run-8f523ff16b6b4c95832e46b4b6110a8d",
          "state": "settled"
        },
        {
          "charged": 5533,
          "id": 2,
          "metadata": {
            "finish_reason": "stop",
            "model": "qwen3.8-max",
            "policy_version": "bailian-task-routing-v2",
            "request_id": "chatcmpl-5210c519-e295-932c-9baf-8d689177d3c3",
            "requested_output_tokens": 8192,
            "retry_of": null,
            "route_reason": "business-code",
            "stage": "code"
          },
          "prompt_digest": "4b488c9662257135d667d65af153280bb1837642bb0e9c9eb79ad2bd3541ab71",
          "provider": "bailian-qwen3.8-max",
          "reservation": 15627,
          "run_id": "run-8f523ff16b6b4c95832e46b4b6110a8d",
          "state": "settled"
        },
        {
          "charged": 6526,
          "id": 3,
          "metadata": {
            "finish_reason": "stop",
            "model": "qwen3.8-max",
            "policy_version": "bailian-task-routing-v2",
            "request_id": "chatcmpl-4c5fac7c-eced-9232-8974-4ae54865a978",
            "requested_output_tokens": 12288,
            "retry_of": null,
            "route_reason": "diagnostic-repair",
            "stage": "repair"
          },
          "prompt_digest": "93f9190dd32cf5bda3fa4debb71e644240a811e147e9480b9618426f37e9b4ac",
          "provider": "bailian-qwen3.8-max",
          "reservation": 28818,
          "run_id": "run-8f523ff16b6b4c95832e46b4b6110a8d",
          "state": "settled"
        }
      ],
      "preview": {
        "cases": 1,
        "classes_digest": "ba589b760a2583fe523da87f68e84a69e3914972b2cb6417c9a44f768ba604a1",
        "config_digest": "d223365fd05e5fe9d0e74ec5a440e3c878a1dbd0cb9726cf04be2d4575c7f603",
        "container": "zk-run-8f523ff16b6b4c95832e46b4b6110a8d",
        "execution_mode": "qemu",
        "image": "zkcoding-qemu@sha256:5c866338b848ec50afbbcb7f0827f562c2aced18638922dd72ae73eaa6bc15ec",
        "isolation": {
          "disposable": true,
          "host_mounts": [],
          "memory_mb": 1024,
          "network": "none",
          "vcpu": 1
        },
        "passed": true,
        "passed_cases": 1,
        "preview_scope": "disposable-vm-loopback-http",
        "receipt_digest": "a210412abeeba14e1ed2bf41626eb8b8aad3ed81083a18fac6e4ee45fbc8599c",
        "receipt_ref": "run-8f523ff16b6b4c95832e46b4b6110a8d-3c06b2b5d67941f9ab16db94af4f52d4",
        "source_digest": "86f2fd3b99c6f8b21ceb2595171ed841194fcc7c791b60ea1a8cf0d90d6ba1be",
        "stage": "preview",
        "suite_digest": "9c6339659e17af7ff3da41e664c930429ee4595b97bc1cd9af26dbbe018131ce",
        "tool_receipt": {
          "input_digest": "ee16016099b35922c870fdc1601d65e5fc0b144f3c28490b7066f918f1735ef2",
          "operation": "AO10",
          "result_digest": "296be25de7a105f0124ec41d761ebe1db2afdbf007d0f4730507f8478f093bf1",
          "run_id": "run-8f523ff16b6b4c95832e46b4b6110a8d"
        }
      },
      "repairs": 1,
      "run_id": "run-8f523ff16b6b4c95832e46b4b6110a8d",
      "sandbox_cleaned": true,
      "snapshot": {
        "budget": {
          "max_model_calls": 6,
          "max_repairs": 2,
          "max_seconds": 1800,
          "max_tokens": 120000
        },
        "execution_order": [
          "start",
          "requirements",
          "knowledge",
          "context",
          "design",
          "design_confirm",
          "execution_confirm",
          "code",
          "patch",
          "policy",
          "build",
          "test",
          "preview",
          "acceptance",
          "evidence",
          "end"
        ],
        "execution_status": "not_started",
        "framework": {
          "allowed_paths": [
            "src/main/",
            "src/test/",
            "docs/"
          ],
          "build_tool": "jdk",
          "dependencies": {},
          "evidence_refs": [
            "local-toolchain:zkcoding-qemu@sha256:5c866338b848ec50afbbcb7f0827f562c2aced18638922dd72ae73eaa6bc15ec",
            "user-authorized-local-validation"
          ],
          "frontend": [
            "html",
            "javascript",
            "css"
          ],
          "java_release": 17,
          "language": "java",
          "profile_id": "java17-standard-web",
          "state": "approved",
          "version": "0.1.0"
        },
        "knowledge": [
          {
            "collection_id": "java-basics",
            "digest": "6de6f354ff0e845da78ad210164775f51d9a4c5f01a1e5e355911423bd6a5b5c",
            "enterprise_approved": false,
            "quality_status": "imported_unreviewed",
            "revision": "corpus-6de6f354ff0e845da78ad210",
            "scope": "reference"
          },
          {
            "collection_id": "java-patterns",
            "digest": "803bd1aef5f0764242a56a8c85a3eca81b26cebbe4ec3e6b53d3c4da8864aa2d",
            "enterprise_approved": false,
            "quality_status": "imported_unreviewed",
            "revision": "corpus-803bd1aef5f0764242a56a8c",
            "scope": "reference"
          },
          {
            "collection_id": "erp",
            "digest": "12726dd26fa3208098be6048f2f1d7bea99a9a6954b825d93672daef85bcbafc",
            "enterprise_approved": false,
            "quality_status": "imported_unreviewed",
            "revision": "corpus-12726dd26fa3208098be6048",
            "scope": "reference"
          },
          {
            "collection_id": "java-frameworks",
            "digest": "28b65fe6ced6682555c8b32b676faf14020011ea525eeee57f17562acd17da4c",
            "enterprise_approved": false,
            "quality_status": "imported_unreviewed",
            "revision": "corpus-28b65fe6ced6682555c8b32b",
            "scope": "reference"
          },
          {
            "collection_id": "web-development",
            "digest": "84c82986259278c89a30d2660f66454f0a5bcb10f871c96c7ec4ea9ebb47e02a",
            "enterprise_approved": false,
            "quality_status": "imported_unreviewed",
            "revision": "corpus-84c82986259278c89a30d266",
            "scope": "reference"
          },
          {
            "collection_id": "java-persistence",
            "digest": "972ee7e1f0072e413bec262b67b8af46364ff8aac445a9faeeeb8c041eb07f92",
            "enterprise_approved": false,
            "quality_status": "imported_unreviewed",
            "revision": "corpus-972ee7e1f0072e413bec262b",
            "scope": "reference"
          },
          {
            "collection_id": "java-testing",
            "digest": "8af9017057c130eef9f9a1617a2654859ba80ed4f108b28054aecf14a3d39c45",
            "enterprise_approved": false,
            "quality_status": "imported_unreviewed",
            "revision": "corpus-8af9017057c130eef9f9a161",
            "scope": "reference"
          },
          {
            "collection_id": "java-integration",
            "digest": "befde1177fa13476703d89a8df3902d90ad01cb7d497d0583cfe15620348c7b1",
            "enterprise_approved": false,
            "quality_status": "imported_unreviewed",
            "revision": "corpus-befde1177fa13476703d89a8",
            "scope": "reference"
          }
        ],
        "operations_lock": {
          "AO01@0.1.0": "6f2a89d1624450c6e4afd8f776f23c7df4bf402976a82d0992dfd6cfdc643bf2",
          "AO02@0.1.0": "6a4491053f9a3f55d900f3f907f81a0cfc44f09a1e2f1e770248287bc0b8d7f6",
          "AO03@0.1.0": "8a1387e065674c2987930ad865a2bdb4ab7346cb589505c350c6bb1907a7eb6d",
          "AO04@0.1.0": "3ef3f1be1b0f9240f066fa6d0b3b1430026d55763d15b5fc584a801c64be688b",
          "AO05@0.2.0": "eeac70849a9d8bebd00b1d2111545f9376cc6901f6aa611412b1cb73238e47a7",
          "AO06@0.1.0": "2b369879ba0cd2847c173cfb7cb583c1dc051553d3d3ea80f954c81c21f1f233",
          "AO07@0.1.0": "69e1e824b4c5129f62595ac3df578eec7b083411cd391a72d47303eec3843baa",
          "AO08@0.1.0": "1d75566610ac000990fd15b9fd18a6518de8af12a329b3c56d51ff29c0c30623",
          "AO09@0.1.0": "2e4bf4b3fcdfce184b8dea9ffebd18ffe91af7320b0ef3ce430edb3b5cc15c52",
          "AO10@0.1.0": "d05863bea57e94ad860696bd6ac85e072034f89f6f038f132c65b854dd366e9f",
          "AO11@0.1.0": "43b910a51da7a58810d3890eb2305d80663db6a1c187b51466f8e396a94956f0"
        },
        "project_id": "erp-demo",
        "release_digest": "15ad0cfd9f30d9056932653f24bfc7d6d804c1ff586472c301be15f8bf589228",
        "release_ref": "erp-java-development@local-15ad0cfd9f30d905",
        "snapshot_digest": "eca22fd121931a44491cee768c9f2fa37a2a04f0b645ea0a0c52bbdf7d3a9265",
        "snapshot_id": "snapshot-fb1c13de6e4f43dfaef0f58b7db7b035",
        "source_digest": "44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a",
        "tenant_id": "demo-tenant",
        "user_id": "user-c3adb31fc78c4d59970af883326ccff5"
      },
      "source": {
        "files": {
          "src/main/java/demo/App.java": "package demo;\n\nimport com.sun.net.httpserver.HttpServer;\nimport com.sun.net.httpserver.HttpExchange;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.math.BigDecimal;\nimport java.math.RoundingMode;\nimport java.net.InetSocketAddress;\nimport java.net.URI;\nimport java.nio.charset.StandardCharsets;\nimport java.util.LinkedHashMap;\nimport java.util.Map;\nimport java.util.regex.Pattern;\n\npublic class App {\n    private static final Pattern DEPT_PATTERN = Pattern.compile(\"[A-Za-z][A-Za-z0-9_-]{0,31}\");\n    private static final Pattern QTY_PATTERN = Pattern.compile(\"[0-9]+\");\n    private static final Pattern PRICE_PATTERN = Pattern.compile(\"[0-9]+(\\\\.[0-9]{1,2})?\");\n\n    public static void main(String[] args) throws IOException {\n        HttpServer server = HttpServer.create(new InetSocketAddress(8080), 0);\n        server.createContext(\"/health\", App::handleHealth);\n        server.createContext(\"/api/purchase/quote\", App::handleQuote);\n        server.createContext(\"/\", App::handleNotFound);\n        server.setExecutor(null);\n        server.start();\n    }\n\n    private static void handleNotFound(HttpExchange exchange) throws IOException {\n        sendJson(exchange, 404, \"{\\\"error\\\":\\\"NOT_FOUND\\\"}\");\n    }\n\n    private static void handleHealth(HttpExchange exchange) throws IOException {\n        if (!\"GET\".equals(exchange.getRequestMethod())) {\n            sendJson(exchange, 405, \"{\\\"error\\\":\\\"METHOD_NOT_ALLOWED\\\"}\");\n            return;\n        }\n        sendJson(exchange, 200, \"{\\\"status\\\":\\\"ok\\\"}\");\n    }\n\n    private static void handleQuote(HttpExchange exchange) throws IOException {\n        if (!\"GET\".equals(exchange.getRequestMethod())) {\n            sendJson(exchange, 405, \"{\\\"error\\\":\\\"METHOD_NOT_ALLOWED\\\"}\");\n            return;\n        }\n        String auth = exchange.getRequestHeaders().getFirst(\"Authorization\");\n        if (!\"Bearer demo-sales\".equals(auth)) {\n            sendJson(exchange, 401, \"{\\\"error\\\":\\\"UNAUTHORIZED\\\"}\");\n            return;\n        }\n        URI uri = exchange.getRequestURI();\n        String query = uri.getRawQuery();\n        Map<String, String> params = new LinkedHashMap<>();\n        if (query != null && !query.isEmpty()) {\n            String[] pairs = query.split(\"&\");\n            for (String pair : pairs) {\n                int eq = pair.indexOf('=');\n                String key = eq >= 0 ? pair.substring(0, eq) : pair;\n                String val = eq >= 0 ? pair.substring(eq + 1) : \"\";\n                if (params.containsKey(key)) {\n                    sendJson(exchange, 400, \"{\\\"error\\\":\\\"INVALID_INPUT\\\"}\");\n                    return;\n                }\n                params.put(key, val);\n            }\n        }\n        if (params.size() != 3 || !params.containsKey(\"quantity\") || !params.containsKey(\"unitPrice\") || !params.containsKey(\"department\")) {\n            sendJson(exchange, 400, \"{\\\"error\\\":\\\"INVALID_INPUT\\\"}\");\n            return;\n        }\n        String qtyStr = params.get(\"quantity\");\n        String priceStr = params.get(\"unitPrice\");\n        String deptStr = params.get(\"department\");\n        if (!QTY_PATTERN.matcher(qtyStr).matches()) {\n            sendJson(exchange, 400, \"{\\\"error\\\":\\\"INVALID_INPUT\\\"}\");\n            return;\n        }\n        int quantity;\n        try {\n            quantity = Integer.parseInt(qtyStr);\n        } catch (NumberFormatException e) {\n            sendJson(exchange, 400, \"{\\\"error\\\":\\\"INVALID_INPUT\\\"}\");\n            return;\n        }\n        if (quantity < 1 || quantity > 10000) {\n            sendJson(exchange, 400, \"{\\\"error\\\":\\\"INVALID_INPUT\\\"}\");\n            return;\n        }\n        if (!PRICE_PATTERN.matcher(priceStr).matches()) {\n            sendJson(exchange, 400, \"{\\\"error\\\":\\\"INVALID_INPUT\\\"}\");\n            return;\n        }\n        BigDecimal unitPrice;\n        try {\n            unitPrice = new BigDecimal(priceStr);\n        } catch (NumberFormatException e) {\n            sendJson(exchange, 400, \"{\\\"error\\\":\\\"INVALID_INPUT\\\"}\");\n            return;\n        }\n        if (unitPrice.compareTo(BigDecimal.ZERO) <= 0 || unitPrice.compareTo(new BigDecimal(\"1000000\")) > 0) {\n            sendJson(exchange, 400, \"{\\\"error\\\":\\\"INVALID_INPUT\\\"}\");\n            return;\n        }\n        if (!DEPT_PATTERN.matcher(deptStr).matches()) {\n            sendJson(exchange, 400, \"{\\\"error\\\":\\\"INVALID_INPUT\\\"}\");\n            return;\n        }\n        if (!\"sales\".equals(deptStr)) {\n            sendJson(exchange, 403, \"{\\\"error\\\":\\\"FORBIDDEN\\\"}\");\n            return;\n        }\n        BigDecimal total = unitPrice.multiply(new BigDecimal(quantity)).setScale(2, RoundingMode.HALF_UP);\n        String approval;\n        if (total.compareTo(new BigDecimal(\"10000\")) < 0) {\n            approval = \"SELF\";\n        } else if (total.compareTo(new BigDecimal(\"100000\")) < 0) {\n            approval = \"MANAGER\";\n        } else {\n            approval = \"DIRECTOR\";\n        }\n        String json = \"{\\\"total\\\":\\\"\" + total.toPlainString() + \"\\\",\\\"approval\\\":\\\"\" + approval + \"\\\",\\\"department\\\":\\\"sales\\\"}\";\n        sendJson(exchange, 200, json);\n    }\n\n    private static void sendJson(HttpExchange exchange, int code, String json) throws IOException {\n        byte[] bytes = json.getBytes(StandardCharsets.UTF_8);\n        exchange.getResponseHeaders().set(\"Content-Type\", \"application/json; charset=UTF-8\");\n        exchange.sendResponseHeaders(code, bytes.length);\n        try (OutputStream os = exchange.getResponseBody()) {\n            os.write(bytes);\n        }\n    }\n}"
        },
        "source_digest": "86f2fd3b99c6f8b21ceb2595171ed841194fcc7c791b60ea1a8cf0d90d6ba1be"
      },
      "status": "verified_pending_user_acceptance",
      "test": {
        "cases": 25,
        "classes_digest": "ba589b760a2583fe523da87f68e84a69e3914972b2cb6417c9a44f768ba604a1",
        "config_digest": "d223365fd05e5fe9d0e74ec5a440e3c878a1dbd0cb9726cf04be2d4575c7f603",
        "container": "zk-run-8f523ff16b6b4c95832e46b4b6110a8d",
        "execution_mode": "qemu",
        "image": "zkcoding-qemu@sha256:5c866338b848ec50afbbcb7f0827f562c2aced18638922dd72ae73eaa6bc15ec",
        "isolation": {
          "disposable": true,
          "host_mounts": [],
          "memory_mb": 1024,
          "network": "none",
          "vcpu": 1
        },
        "passed": true,
        "passed_cases": 25,
        "preview_scope": "disposable-vm-loopback-http",
        "receipt_digest": "a210412abeeba14e1ed2bf41626eb8b8aad3ed81083a18fac6e4ee45fbc8599c",
        "receipt_ref": "run-8f523ff16b6b4c95832e46b4b6110a8d-3c06b2b5d67941f9ab16db94af4f52d4",
        "source_digest": "86f2fd3b99c6f8b21ceb2595171ed841194fcc7c791b60ea1a8cf0d90d6ba1be",
        "stage": "test",
        "suite_digest": "9c6339659e17af7ff3da41e664c930429ee4595b97bc1cd9af26dbbe018131ce",
        "tool_receipt": {
          "input_digest": "ee16016099b35922c870fdc1601d65e5fc0b144f3c28490b7066f918f1735ef2",
          "operation": "AO09",
          "result_digest": "57378dae1f0db78d0c0b53b47f8ea322951000c6d8aa1db2213fedb79c635405",
          "run_id": "run-8f523ff16b6b4c95832e46b4b6110a8d"
        }
      }
    }
  },
  "local_replay": {
    "generation_run": "run-8f523ff16b6b4c95832e46b4b6110a8d",
    "source_digest": "86f2fd3b99c6f8b21ceb2595171ed841194fcc7c791b60ea1a8cf0d90d6ba1be",
    "lease": "a36fe1894b964ecc9b5dd9be6900eda7",
    "receipt": {
      "source_digest": "86f2fd3b99c6f8b21ceb2595171ed841194fcc7c791b60ea1a8cf0d90d6ba1be",
      "image": "zkcoding-qemu@sha256:123b955068e212a3cb1cf6db348cc8efab24c44ca2b4fb67835100845a9e7ddf",
      "config_digest": "841129aac9dd785fe877d72002533547377a93994d0afb830dadb1273b51389a",
      "classes_digest": "ba589b760a2583fe523da87f68e84a69e3914972b2cb6417c9a44f768ba604a1",
      "tests": 25,
      "network": "none",
      "host_mounts": []
    }
  },
  "human_acceptance": false
}