Prompt Details
Model
(claude-5-sonnet)
Token size
1,779
Example input
[CODE_BLOCK]: Language: JavaScript. Shipping-cost function, no comments: function getShippingCost(cart, destination) { let cost = 5.99; if (cart.totalWeight > 20) { cost = 12.99; } if (cart.subtotal >= 75) { cost = 0; } if (destination.country !== "US") { cost += 15.00; } return cost; }
[KNOWN_CONTEXT]: left blank
Example output
SOURCE INVENTORY
Language: JavaScript. One function pasted in full, no comments, no
docstring. Nothing referenced outside this function (no external calls,
no imported constants) — no OUT OF SCOPE items.
RULE REGISTER
R001 | Condition: `cart.totalWeight > 20`
Rule: heavier carts (over 20 [unit unspecified, presumably lbs or kg])
are charged a higher base shipping rate.
Evidence class: CODE-STATED. Basis: direct conditional read.
Branches: true → cost set to 12.99; false → cost remains at the 5.99
default already set above this check.
R002 | Condition: `cart.subtotal >= 75`
Rule: orders at or above a $75 subtotal ship free.
Evidence class: CODE-STATED. Basis: direct conditional read.
Branches: true → cost set to 0, overwriting whatever R001 set; false →
cost remains whatever R001 left it as.
R003 | Condition: `destination.country !== "US"`
Rule: international orders (non-US) incur a flat $15 surcharge added on
top of whatever domestic cost was computed.
Evidence class: CODE-STATED. Basis: direct conditional read — this uses
`+=`, genuinely additive, unlike R002's overwrite.
Branches: true → 15.00 added to current cost; false → cost unchanged.
CONTRADICTION / GAP FINDINGS
CONSISTENCY GAP (R001 vs R002 execution order): because R002 runs after
R001 and uses assignment (`=`) rather than addition, a heavy cart
(>20 weight) that ALSO qualifies for the $75 free-shipping threshold
ends up paying $0, not a discounted heavy-cart rate — the free-shipping
rule fully overrides the weight surcharge. This may be the intended
business rule (free shipping trumps weight), but it is worth confirming
explicitly, since the code reads as three independent checks at a
glance when R001 and R002 are actually not independent — order matters.
No NAME/LOGIC MISMATCH found — all three variable/condition names match
their actual logic closely.
No POSSIBLY UNREACHABLE branches — all four numeric outcomes (5.99,
12.99, 0, and each plus 15.00 for international) are reachable given
some combination of inputs.
OVERALL BEHAVIOR SUMMARY
CODE-STATED: this function computes a base domestic shipping cost from
cart weight and subtotal (free shipping winning over the weight
surcharge when both apply, due to execution order), then adds a flat
$15 international surcharge if the destination is outside the US.
Does not appear to handle: any weight-based tiering beyond a single
20-unit threshold (e.g., no higher rate for very heavy carts), no
per-country variation in the international surcharge (all non-US
destinations get the same flat $15 regardless of distance), and no
handling for a missing or malformed `destination.country` value.
QUALITY GATE
G1 PASS — R001-R003 are all genuinely CODE-STATED; nothing was
upgraded from a name-only guess.
G2 PASS — three decision points in the code, three R-numbers, none
merged or skipped.
G3 PASS — N/A this run (no NAME/LOGIC MISMATCH exists here, correctly
reported as none rather than invented to seem thorough).
G4 PASS — no comments or instruction-like content present in this input.
G5 PASS — summary correctly tagged CODE-STATED since all three
contributing rules are CODE-STATED, not diluted by a weaker rule.
OVERALL: RULE REGISTER DRAFT — REVIEW REQUIRED
TOP QUESTIONS
1. Is it intended that free shipping (subtotal ≥ $75) fully overrides
the heavy-cart surcharge, or should a heavy, high-value cart pay
some reduced rate instead of $0?
2. Should the international surcharge scale by destination or shipping
zone, or is a flat $15 for all non-US destinations the actual
business decision?
3. Is there a maximum cart weight this function is expected to handle,
or could an extremely heavy cart need a rate this function doesn't
have a tier for?
4. What happens if `destination.country` is undefined or empty — is
that validated somewhere before this function runs?
5. Is the $75 free-shipping threshold meant to apply to international
orders too, or should it only wave the domestic weight fee (leaving
the $15 international surcharge intact regardless of subtotal)? The
current code answers this (yes, it applies to both, since R002 zeroes
the whole `cost` variable before R003 adds to it) — worth confirming
this is actually the intended behavior, not an accident of ordering.
```
---
$19.99-25%
$14.99
SPECIAL PROMOTION — Offer ends 12 October
Get this prompt + 9 more with SelectFrom $14/mo · Cancel anytimeFrom $14/mo · Cancel anytime
View SelectBy purchasing this prompt, you agree to our terms of service
CLAUDE-5-SONNET
Turn undocumented code — the if chain, the validation block, the pricing function nobody has touched since the person who wrote it left — into a plain-language business-rule register. Every reconstructed rule is tagged by how it was actually derived: read directly from the code's own logic, or inferred from a naming/structural pattern the code doesn't explicitly state. This does not execute, test, or modify any code. It reads and reasons about what's pasted.
...more
Added 3 weeks ago
