Converted refunds into charges; both checks failed.
A deliberately flawed submission tested during development. This is a bounded grading fixture, not a candidate session or hiring-validity study.
The task
solve receives an object with a rows list. Input is a list of rows with account and signed amount strings, with at most two decimal places. Sum amounts as supplied per account: refunds are already negative. Retain zero and negative account totals. Return a mapping from account to an exact two-decimal string. Empty input yields {}.
Submitted work solution.py
1from decimal import Decimal
2def solve(payload):
3 rows = payload["rows"]
4 totals = {}
5 for row in rows:
6 amount = abs(Decimal(row["amount"]))
7 account = row["account"]
8 totals[account] = totals.get(account, Decimal("0")) + amount
9 return {account: format(total, ".2f") for account, total in sorted(totals.items())}
Captured reviewer findings
The implementation computes the required result for all stated inputs.
Contradicted
abs() discards refund signs before accumulation. An account with amounts '10.00' and '-3.00' returns '13.00' rather than '7.00'. Line 6 ↗
No accounts are filtered out, but offsetting amounts '3.00' and '-3.00' produce '6.00' instead of the required retained zero total. Line 6 ↗
The implementation leaves caller-owned input lists, records and vectors unchanged.
Supported
The function only reads payload and row fields. Accumulation uses a new dictionary; sorted() operates on that dictionary's items. No caller-owned container is modified. Line 2 ↗
Review limit The reviewer inspected the source. It was not given execution records; the independent checks below were saved separately.
Independent execution checks
Saved Docker checks against the same constructed submission. These two cases describe their own scope.
holdout-data-faulty. Original task, code, checks and finding excerpts are preserved. The downloadable extract omits provider payloads and local environment details.