A small code repair with a repeatable test If you need a small, testable bug fixed, give the assistant a bounded bug, compare the focused diff, and keep the change only when the actual tests pass. Do not use this method for a large refactor, security-critical code, or a legacy system with no tests. The example is constructed, not a real ticket. Reference material only; no authenticated vendor test is claimed. THE HANDOFF BRIEF Fix one numeric total function. Preserve its public name, add no dependency, and leave null, missing input and invalid rows outside this ticket. Deliver the diff and an exact command that reproduces the result. INPUT — Constructed JavaScript bug — no coding assistant was run function totalCents(rows) { return rows.reduce((sum, row) => sum + row.amountCents); } // Required: [] -> 0 // [{amountCents: 200}, {amountCents: 300}] -> 500 // [{amountCents: 0}] -> 0 // [{amountCents: -50}, {amountCents: 50}] -> 0 INSTRUCTION Explain why the supplied function fails both an empty list and a normal two-row list. Propose the smallest repair to the function only. Preserve the name and signature; do not add dependencies, network calls or unrelated validation rules. Show the focused diff, then provide tests for empty, two-row, zero and offsetting amounts. List what this ticket does not establish about invalid input or production callers. REFERENCE HANDOFF — Reference patch — checked locally with Node on Oracle, not produced by a coding product Focused repair: return rows.reduce((sum, row) => sum + row.amountCents, 0); Reason: The explicit numeric initial accumulator makes an empty list return 0 and prevents the first row object from becoming the sum. Required evidence: The original fails the regression cases; the repaired function passes all four. Inspect the actual project caller before merging. Out of scope: No claim about null, missing fields, strings, fractional cents, overflow, or a production deployment. TAKEAWAY MATERIAL — Small-bug repair worksheet Work this material fits: Use AI help to fix one clearly stated numeric error, and judge whether the fix broke anything else. What you take away: A minimal patch (one-line diff) plus four regression checks with expected results, and a clear note on what this ticket does not prove. The bug, in one paragraph The function totalCents adds up the amountCents field of each row. Without an explicit starting value, the first row object itself becomes the running total, and an empty list has no first row at all. Both cases fail, while the intended behaviour is a plain numeric total. Minimal diff: before and after Change one line only. Keep the function name, signature and behaviour for every other input untouched. Before: return rows.reduce((sum, row) => sum + row.amountCents); After: return rows.reduce((sum, row) => sum + row.amountCents, 0); Repaired function The explicit numeric starting value of 0 makes an empty list return 0 and stops the first row object from becoming the sum. function totalCents(rows) { return rows.reduce((sum, row) => sum + row.amountCents, 0); } Four regression checks and expected results Run the same command against the original and the repaired function. The original fails; the repaired function must pass all four. Save the supplied reference test as total-cents-check.cjs, then run: node total-cents-check.cjs Input | Expected result [] | 0 [{amountCents: 200}, {amountCents: 300}] | 500 [{amountCents: 0}] | 0 [{amountCents: -50}, {amountCents: 50}] | 0 What this ticket does not establish - Nothing about null rows, missing fields, strings, fractional cents or overflow — those are outside this ticket; open a separate ticket for invalid input. - Nothing about production callers. Inspect the real caller and reproduce its input shape before merging; a synthetic unit example alone does not prove production readiness. - No new dependency, network call or unrelated validation rule. If a proposed patch adds any of those, revert those hunks and restate the agreed numeric-row contract. Honest scope note This is this site’s own workflow example. The reference patch was checked locally, not produced by a vendor coding product, and no vendor product was run for this example. That means this page makes no claim that any particular product won a test, and no per-ticket price or successful repair is guaranteed by any tool entry here. The code snippets on this page do not execute your code. Run the check yourself in your own checkout or reversible branch, keep a focused commit, and revert the patch if any check fails. No external model API is needed for this worksheet. What the download pack contains - Problem statement: fix one numeric total function, preserving its public name and adding no dependency. - Sample code: the original function, the minimal diff and the repaired function above. - Verification method: the four regression checks and the exact command node total-cents-check.cjs. - Source links: the official plan pages listed under Official sources and dates on this page. When this method fits, and its limits - Fits: one bounded numeric bug, existing regression cases that reproduce it, and a single-function scope. - Work on a clean branch or reversible checkpoint before inviting the assistant; never on uncommitted production code. - A failing test must exist first: if nothing reproduces the failure yet, write that test before the assistant touches code. - The patch can touch unrelated code: inspect the full diff and revert any hunk outside the agreed scope. - This is not a security review: the ticket acceptance checks numeric behavior only, not vulnerabilities. - This does not guarantee performance: no timing or load check is part of this ticket. Source page: https://bytaskai.com/task/code-assistance/ Material revised: 2026-10-25 No sign-up, link-back, subscription or login is required to use this download. REFERENCE CHECK Save the supplied reference test as total-cents-check.cjs, then run: node total-cents-check.cjs function totalCents(rows) { return rows.reduce((sum, row) => sum + row.amountCents, 0); } const cases = [[[], 0], [[{amountCents:200}, {amountCents:300}], 500], [[{amountCents:0}], 0], [[{amountCents:-50}, {amountCents:50}], 0]]; for (const [rows, expected] of cases) { if (totalCents(rows) !== expected) throw new Error('Regression failed'); } console.log('4 regression cases passed'); DO THE TASK 1. Create a clean branch or reversible checkpoint. Run the small regression before inviting an assistant to change the code. 2. Give the exact function, four expected values and the one-function scope; withhold credentials and private records. 3. Inspect the diff before running commands. Reject new dependencies, network calls, broad refactors and invented input policies. 4. Run the same four cases, relevant repository tests and a real caller. Keep a focused commit or revert the patch. ACCEPTANCE CHECKS 1. The original failure is reproduced by the same test command used to check the repair. 2. All four specified cases return the expected numeric value. 3. Only the intended function and its focused regression test changed. 4. No private data, new network path or package was introduced. 5. A reviewer checked the real caller; a synthetic unit example alone does not establish production readiness. TOOL DECISIONS Keep your current supported editor or GitHub workflow — github-copilot Use a small issue and a focused diff rather than handing over the whole repository. Budget and access: Free has limited chat and agent usage, plus 2,000 inline suggestions per month in the reviewed comparison. Agent and chat activity consume AI credits. Check first: Remaining allowance, model and feature affect usage. No per-ticket price or successful repair is guaranteed. You already have Cursor set up for this repository — cursor Use the existing workspace for the same small ticket, with command and diff review. Budget and access: The reviewed pricing page combines Cursor/Grok plans; this review has not confirmed a standalone IDE purchase or renewal amount. Third-party models are separately billed at API list price. Check first: Set and inspect spending caps before an agent session. Do not assume an old subscription price or unlimited agent work. FAILURE AND CORRECTION The assistant only adds an empty-array guard. Keep the two-row case in the ticket: the first accumulator is still an object without an explicit initial value. The repair changes input rules or edits unrelated modules. Revert those hunks and restate the agreed numeric-row contract. Open a separate ticket for invalid input. The test command passes locally but the application still fails. Inspect the actual caller and reproduce its input shape. Do not repeatedly rewrite the function without that example. An agent asks to deploy or access credentials. Stop at the reviewed patch. Deployment and credential access are separate actions with their own scope. CONTINUE Full small-bug workflow and prompt: https://bytaskai.com/guide/write-code/ Cursor vs GitHub Copilot: https://bytaskai.com/compare/cursor-vs-github-copilot/ Cursor vs Aider: subscription editor vs terminal pair programmer: https://bytaskai.com/compare/cursor-vs-aider/ When to switch from Cursor: https://bytaskai.com/alternatives/cursor/ OFFICIAL SOURCES GitHub Copilot plans https://github.com/features/copilot/plans Captured: 2026-10-19T14:15:03.892356+00:00 Reviewed: 2026-10-21T11:50:03.135135+00:00 Quote: Free $0 Get started Pro $10 per month Quote: Free plan Limited chat and agent usage Quote: Inline suggestions Free plan 2,000 per month Quote: Chat, agent mode,… Cursor plans and model billing https://cursor.com/pricing Captured: 2026-10-19T14:15:03.826521+00:00 Reviewed: 2026-10-21T11:50:03.135135+00:00 Quote: Third-party models remain available in Cursor at API list price. Quote: you can set spending caps to manage costs.