openai / gpt-6-luna / max / max effort preferred over xai / grok-4.7-efficient / high / high effort · close win.
Primary judge: Sol 6.1, requested Low. Effective provider effort and internal attempts were not verified. A close win is still a scored preference; it does not establish a material defect.
Reviewed public evidence
Task goal
Design a pure utility converting nonnegative integer milliseconds into human-readable durations for a monitoring UI. Requirements: deterministic locale-neutral formatting, round-to-nearest-second ties upward, correct carries, day/hour/minute/second boundaries, maximum safe integer input, explicit invalid input handling, compact and expanded modes, and no calendar/timezone/date interpretation. Provide contracts and boundary examples.
Give one coherent design with explicit requirements, assumptions and alternatives, state/invariant/transaction details appropriate to the stated scope, and measurable pass/fail acceptance checks. Do not invent benchmark measurements, provider costs, source inspection, executed tests or objective passes. Every contributor must independently answer the complete identical question; there are no separate roles, files or tool evidence.
openai / gpt-6-luna / max / max effort answer
## Recommendation
Define a stateless `formatDuration(ms, mode = "compact")` with two fixed output modes:
- **Compact:** `1d 2h 3m 4s`
- **Expanded:** `1 day, 2 hours, 3 minutes, 4 seconds`
Use fixed English labels and ASCII abbreviations—not locale-aware formatting. Treat one day as exactly 86,400 seconds. This is elapsed-duration formatting only; it has no calendar, timezone, or date interpretation.
### Contract
- Accept only JavaScript numbers that are nonnegative safe integers, from `0` through `Number.MAX_SAFE_INTEGER` inclusive. Treat `-0` as zero.
- Accept only `"compact"` or `"expanded"` for `mode`; omitted mode means `"compact"`.
- Throw `TypeError` if `ms` is not a number or `mode` is unsupported. Throw `RangeError` if `ms` is negative, fractional, non-finite, or unsafe. Validate `ms` before `mode`.
- Round the **total** duration to the nearest second, with ties upward. Compute quotient and remainder exactly:
- `q = floor(ms / 1000)`, `r = ms mod 1000`
- rounded seconds = `q + (r >= 500 ? 1 : 0)`
- In JavaScript, use `BigInt(ms)` for quotient/remainder and decomposition after validating the number. This avoids precision errors near the maximum safe integer and avoids adding 500 to the input.
- Decompose rounded seconds into days, hours, minutes, and seconds. Omit zero-valued units; if the result is zero, emit `0s` or `0 seconds`. In expanded mode, use singular only for a value of one. List units largest to smallest, separated by spaces in compact mode and comma-space in expanded mode.
The decomposition invariant is `T = 86400d + 3600h + 60m + s`, with `0 ≤ h < 24`, `0 ≤ m < 60`, and `0 ≤ s < 60`. Rounding the total first ensures carries across second, minute, hour, and day boundaries.
### Boundary examples
| Input (ms) | Compact | Expanded |
|---:|---|---|
| `0` | `0s` | `0 seconds` |
| `499` | `0s` | `0 seconds` |
| `500` | `1s` | `1 second` |
| `59,499` | `59s` | `59 seconds` |
| `59,500` | `1m` | `1 minute` |
| `3,599,499` | `59m 59s` | `59 minutes, 59 seconds` |
| `3,599,500` | `1h` | `1 hour` |
| `86,399,499` | `23h 59m 59s` | `23 hours, 59 minutes, 59 seconds` |
| `86,399,500` | `1d` | `1 day` |
| `Number.MAX_SAFE_INTEGER` | `104249991d 8h 59m 1s` | `104249991 days, 8 hours, 59 minutes, 1 second` |
### State and failure behavior
The utility has no persistent state, I/O, or external effects. It either returns one complete string or throws during validation; it does not produce partial output or modify its input.
### Acceptance checks
These are proposed conformance checks, not tests claimed to have been run:
1. Exact outputs match the table in both modes.
2. Inputs `-1`, `1.5`, `NaN`, `Infinity`, and `Number.MAX_SAFE_INTEGER + 1` throw `RangeError`; a string input throws `TypeError`; an unsupported mode throws `TypeError`.
3. For inputs `1000q + r` within the valid range, test every `r` from `0` through `999` for selected `q` values around `59`, `60`, `3599`, `3600`, `86399`, `86400`, and the maximum input. The rounded result must be `q + 1` exactly when `r >= 500`.
4. For each valid result, decomposition reconstructs the rounded total and satisfies the stated component bounds; formatting omits zero units except for the all-zero result.
5. Repeated calls with the same arguments produce byte-identical output, independent of locale settings. The implementation must not use locale, date, timezone, or clock APIs.
**Alternatives:** A UI could prefer `HH:MM:SS` or a `Result` return value instead of exceptions, but those change the output or error contract. The fixed-unit strings and thrown validation errors above provide one unambiguous design.
**Evidence and dependencies:** This is based only on the supplied requirements; no source path or implementation was provided, and no tests were run. The contract is ready to implement; the next useful step is to add the acceptance checks for the chosen language.
xai / grok-4.7-efficient / high / high effort answer
## 1. Design
Pure, total function. No clock, locale, timezone, calendar, or mutable state. A day is exactly 86400 SI seconds. Round once to a whole second, then split. Do not format invalid input.
**Domain.** `ms` must be an exact integer in `0 … 9007199254740991` (`2^53−1`). `mode` must be exactly `compact` or `expanded` (case-sensitive; no locale casefold). `-0` is valid and identical to `0`. No coercion of strings, booleans, `null`, or non-integral numbers. Integers above the max are rejected even if the host can represent them exactly.
**Result (all-or-nothing).** Success is `{ ok: true, text }` with a canonical ASCII string. Failure is `{ ok: false, reason }` and has no renderable duration. Reasons, in this priority: `invalid_mode`, then `negative`, then `above_max_safe_integer`, then `not_integer`. One reason only. No throw on the documented invalid set.
**Rounding (ties upward).** Exact integer division, not float add:
- `q = ms div 1000`, `r = ms mod 1000`
- `totalSeconds = q + 1` if `r >= 500`, else `q`
That is round-half-up for nonnegative values: `…499 →` lower second, `…500 →` next second. Do not use `floor((ms+500)/1000)`: for `ms >= 9007199254740492`, `ms+500` is outside the safe-integer range. Do not use banker’s rounding. Do not round per unit.
**Split (fixed units, carries by construction).**
- `seconds = totalSeconds mod 60`
- `minutes = (totalSeconds div 60) mod 60`
- `hours = (totalSeconds div 3600) mod 24`
- `days = totalSeconds div 86400`
Postcondition: `totalSeconds = days*86400 + hours*3600 + minutes*60 + seconds`, with `seconds, minutes ∈ 0..59`, `hours ∈ 0..23`, `days >= 0`. A displayed field never holds 60 or 24. No weeks, months, years, leap seconds, or DST.
**Format (locale-neutral).** Digits are ungrouped ASCII. Tokens are `d` `h` `m` `s` only, order fixed, single spaces, no sign, no padding, no colon clock form.
- Compact: nonzero units only. All-zero is exactly `0s`. Never empty.
- Expanded: always four units, zeros kept (`0d 0h 0m 0s`).
Same `(days, hours, minutes, seconds)` in both modes. Strings match only when all four units are nonzero; mode is not string identity.
**Invariants.** Referentially transparent; no shared state; concurrent calls cannot interfere. Output ignores process locale and timezone. Sub-second residue affects output only through the one rounding step. Success text length is at least 2. Failure never produces a duration string. Rounded seconds are a non-decreasing step function of `ms`: `0` for `0..499`; for `n >= 1`, `n` for `ms` in `[1000*(n-1)+500, 1000*n+499]`, truncated at the max. Each full bucket has 1000 values; the zero bucket has 500 because negatives are rejected.
**Boundary examples (contract fixtures, not executed results).**
| ms | seconds | compact | expanded |
|---:|---:|---|---|
| 0, 499 | 0 | `0s` | `0d 0h 0m 0s` |
| 500, 999, 1000, 1499 | 1 | `1s` | `0d 0h 0m 1s` |
| 1500 | 2 | `2s` | `0d 0h 0m 2s` |
| 59499 | 59 | `59s` | `0d 0h 0m 59s` |
| 59500, 59999, 60000 | 60 | `1m` | `0d 0h 1m 0s` |
| 3599499 | 3599 | `59m 59s` | `0d 0h 59m 59s` |
| 3599500, 3600000 | 3600 | `1h` | `0d 1h 0m 0s` |
| 86399499 | 86399 | `23h 59m 59s` | `0d 23h 59m 59s` |
| 86399500, 86400000 | 86400 | `1d` | `1d 0h 0m 0s` |
| 172799499 | 172799 | `1d 23h 59m 59s` | `1d 23h 59m 59s` |
| 172799500 | 172800 | `2d` | `2d 0h 0m 0s` |
| 90061000 | 90061 | `1d 1h 1m 1s` | `1d 1h 1m 1s` |
| 9007199254740499 | 9007199254740 | `104249991d 8h 59m` | `104249991d 8h 59m 0s` |
| 9007199254740500 and 9007199254740991 | 9007199254741 | `104249991d 8h 59m 1s` | `104249991d 8h 59m 1s` |
Invalid: `-1` and `-500` → `negative` (no rounding); `1.5`, `NaN`, `Infinity`, `"1000"`, `null`, `true` → `not_integer`; `9007199254740992` → `above_max_safe_integer`; `Compact`, `""` → `invalid_mode`.
**Pass/fail checks (criteria only).** (1) Fixture table matches exactly, both modes. (2) Repeat call is deep-equal. (3) For `k ∈ {0, 59, 3599, 86399, 9007199254740}`, `1000*k+499 → k` and `1000*k+500 → k+1`, then the split bounds hold. (4) Reconstruction identity on every fixture. (5) Compact grammar `0s` or ordered nonzero tokens; expanded always four canonical tokens. (6) Invalid set returns the stated reason and no duration text. (7) Implementation does not read locale, TZ, or `Date`. (8) Top-domain pair above: tie neighbor and max share one string; `…499` differs by one second and shows `0s` only in expanded.
Confidence: high on rounding, carry, and the safe-integer bound; medium on symbolic rather than prose expanded text, because no UI copy spec was supplied.
## 2. Alternatives discarded
- Half-to-even, floor, or always-ceil: violate nearest-with-ties-upward.
- `ms+500` before divide: overflows the required domain.
- Per-unit rounding: can double-carry.
- Weeks/months, `Date`, or locale duration formatters: calendar or locale dependence.
- English plurals (`1 second` / `2 seconds`): deterministic if frozen, but not strictly locale-neutral. Acceptable only as a separate presentation adapter over the same numeric tuple, not as a second algorithm.
- Compact that keeps only the top two units, or `<1s` for sub-second: loses the rounded exact value.
- Clock padding or colons: look like civil time.
- Throw-by-default: can take down a monitoring render. A throwing wrapper may sit outside this contract.
- Jammed tokens (`1d2h`): legal alternate spelling; spaced tokens are the canonical form so parsers have one grammar.
## 3. Missing evidence
No host language, existing module, or UI copy guide was supplied. Consequence: the numeric contract can be implemented as specified; the symbolic expanded form is an assumption. If product chrome requires English words, that adapter must not change rounding or carries. IEEE `div 1000` is the required formula; this packet does not claim an exhaustive float proof or a test run.
## 4. Next useful action
Implement `round → split → render` against the fixture table and the eight checks above in the host language, using exact integer div/mod, and treat any mismatch as a contract failure rather than a display tweak.Primary judge's stated reason
B offers slightly more consistent invalid-input guidance, reducing the chance that implementations disagree over the documented error category. This is a forced, weak preference, not an established material quality gap; an independent review could reasonably favor A's boundary coverage instead.
This reason is the judge's assessment. No independent factual-defect finding is asserted by this record.
Battle wave: 585c0981-9fac-4115-8abf-75261811b5a0. Pair: brp1_468a95d7a497d7b336fca58d559c56eb6879410906e90a59b82246b488369ad1. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.