标准模式
Preset: 标准模式 · standard
deepseek-official / deepseek-v4-flash
Plugin identity not recorded · showing preset/sessionExecution: completed · Check: pass
Preset: 标准模式 · standard
deepseek-official / deepseek-v4-flash
Plugin identity not recorded · showing preset/sessionPreset: 专家模式 v0.9.2 · expert-mode
deepseek-official / deepseek-v4-flash
Preset registration · declared metadataToken totals include input, output, cache reads and cache writes. Token change is not a cost saving.
Privacy check required before sharing. Automatic redaction is best-effort, not a privacy clearance. Review prompts, paths, code, command output, account data, private URLs, and Session ids.
| Metric | A · Baseline | B · Candidate |
|---|---|---|
| Execution | completed | completed |
| Task outcome | pass | pass |
| Recorded tokens · including cache | 87,294 | 112,644 |
| Input tokens | 13,152 | 5,434 |
| Output tokens | 3,230 | 3,658 |
| Cache read tokens | 70,912 | 103,552 |
| Cache write tokens | 0 | 0 |
| Active time | 21.8 s | 25.0 s |
| Steps | 6 | 5 |
| Tool calls | 9 | 7 |
| Tool failures | 0 | 0 |
| Retries | 0 | 0 |
| Changed files | 1 | 1 |
One pair cannot estimate run-to-run uncertainty.
| Active time | mean paired Δ +3.2 s · 95% CI not estimable | |
|---|---|---|
| Tokens | mean paired Δ +25,350 · 95% CI not estimable | |
These checks verify their covered cases, not every possible requirement.
node --testExit code: 0 · 91 ms
✔ rejects negative subtotal (0.447125ms) ✔ SAVE10 applies a ten-percent discount (0.0605ms) ✔ VIP and coupon do not stack; the better discount wins (0.042667ms) ✔ small subtotals never become negative (0.045ms) ✔ rounds the final value to two decimals (0.043292ms) ℹ tests 5 ℹ suites 0 ℹ pass 5 ℹ fail 0 ℹ cancelled 0 ℹ skipped 0 ℹ todo 0 ℹ duration_ms 44.6455
node --testExit code: 0 · 89 ms
✔ rejects negative subtotal (0.416667ms) ✔ SAVE10 applies a ten-percent discount (0.0645ms) ✔ VIP and coupon do not stack; the better discount wins (0.048625ms) ✔ small subtotals never become negative (0.049208ms) ✔ rounds the final value to two decimals (0.042708ms) ℹ tests 5 ℹ suites 0 ℹ pass 5 ℹ fail 0 ℹ cancelled 0 ℹ skipped 0 ℹ todo 0 ℹ duration_ms 44.654208
Git snapshots show final workspace changes. Missing write/edit metadata does not mean no files were changed.
M src/checkout.mjsTracked diff
diff --git a/src/checkout.mjs b/src/checkout.mjs
index bc18238..5528d52 100644
--- a/src/checkout.mjs
+++ b/src/checkout.mjs
@@ -1,13 +1,23 @@
export function checkout(subtotal, options = {}) {
- let total = subtotal
+ if (typeof subtotal !== 'number' || !Number.isFinite(subtotal) || subtotal < 0) {
+ throw new RangeError('subtotal must be a finite, non-negative number')
+ }
+
+ // Coupon and VIP discounts do not stack; pick the better (larger) one.
+ const SAVE10_DISCOUNT = 0.1
+ const VIP_DISCOUNT = 0.15
+ let discount = 0
if (options.coupon === 'SAVE10') {
- total -= 10
+ discount = SAVE10_DISCOUNT
}
-
if (options.vip) {
- total *= 0.85
+ discount = Math.max(discount, VIP_DISCOUNT)
}
- return Math.round(total * 100) / 100
+ const total = subtotal * (1 - discount)
+
+ // Round to two decimal places; clamp so the result is never negative.
+ const rounded = Math.round(total * 100) / 100
+ return Math.max(0, rounded)
}
- export function checkout(subtotal, options = {}) {
let total = subtotal
if (options.coupon === 'SAVE10') {
total -= 10
}
if (options.vip) {
total *= 0.85
}
return Math.round(total * 100) / 100
}
+ export function checkout(subtotal, options = {}) {
if (typeof subtotal !== 'number' || !Number.isFinite(subtotal) || subtotal < 0) {
throw new RangeError('subtotal must be a finite, non-negative number')
}
// Coupon and VIP discounts do not stack; pick the better (larger) one.
const SAVE10_DISCOUNT = 0.1
const VIP_DISCOUNT = 0.15
let discount = 0
if (options.coupon === 'SAVE10') {
discount = SAVE10_DISCOUNT
}
if (options.vip) {
discount = Math.max(discount, VIP_DISCOUNT)
}
const total = subtotal * (1 - discount)
// Round to two decimal places; clamp so the result is never negative.
const rounded = Math.round(total * 100) / 100
return Math.max(0, rounded)
}M src/checkout.mjsTracked diff
diff --git a/src/checkout.mjs b/src/checkout.mjs
index bc18238..b24ec7f 100644
--- a/src/checkout.mjs
+++ b/src/checkout.mjs
@@ -1,13 +1,21 @@
export function checkout(subtotal, options = {}) {
- let total = subtotal
+ if (typeof subtotal !== 'number' || !Number.isFinite(subtotal) || subtotal < 0) {
+ throw new RangeError('subtotal must be a finite, non-negative number')
+ }
+ // Pick the single best discount: SAVE10 is 10%, VIP is 15%.
+ // Coupon and VIP discounts never stack — the larger one wins.
+ let discount = 0
if (options.coupon === 'SAVE10') {
- total -= 10
+ discount = 0.1
}
-
if (options.vip) {
- total *= 0.85
+ discount = 0.15
}
- return Math.round(total * 100) / 100
+ const total = subtotal * (1 - discount)
+
+ // Round to two decimal places. The result can never be negative
+ // because subtotal is non-negative and only proportional discounts apply.
+ return Math.round((total + Number.EPSILON) * 100) / 100
}
- export function checkout(subtotal, options = {}) {
let total = subtotal
if (options.coupon === 'SAVE10') {
total -= 10
}
if (options.vip) {
total *= 0.85
}
return Math.round(total * 100) / 100
}
+ export function checkout(subtotal, options = {}) {
if (typeof subtotal !== 'number' || !Number.isFinite(subtotal) || subtotal < 0) {
throw new RangeError('subtotal must be a finite, non-negative number')
}
// Pick the single best discount: SAVE10 is 10%, VIP is 15%.
// Coupon and VIP discounts never stack — the larger one wins.
let discount = 0
if (options.coupon === 'SAVE10') {
discount = 0.1
}
if (options.vip) {
discount = 0.15
}
const total = subtotal * (1 - discount)
// Round to two decimal places. The result can never be negative
// because subtotal is non-negative and only proportional discounts apply.
return Math.round((total + Number.EPSILON) * 100) / 100
}