Subtract numbers #2

Closed
opened 2026-11-21 01:12:37 +00:00 by lab-admin · 15 comments
Owner

Add subtraction next to addition.

Requirements

  • API: op=subtract returns a - b.
  • UI: a − (minus) button that works like +. Pressing 7, −, 1, 0, = shows -3.
  • Addition keeps working; error handling stays the same (400 {"error"} for bad input).
  • Tests for the new operation in the module, API and page.

Acceptance criteria

  1. /api/calculate?a=2&b=5&op=subtract returns {"result":-3}.
  2. /api/calculate?a=0.5&b=0.25&op=subtract returns {"result":0.25}.
  3. op=add still works and an unknown op still returns 400.
  4. The page has a minus button and shows differences returned by the API.
Add subtraction next to addition. ## Requirements - API: `op=subtract` returns `a - b`. - UI: a `−` (minus) button that works like `+`. Pressing `7`, `−`, `1`, `0`, `=` shows `-3`. - Addition keeps working; error handling stays the same (`400 {"error"}` for bad input). - Tests for the new operation in the module, API and page. ## Acceptance criteria 1. `/api/calculate?a=2&b=5&op=subtract` returns `{"result":-3}`. 2. `/api/calculate?a=0.5&b=0.25&op=subtract` returns `{"result":0.25}`. 3. `op=add` still works and an unknown op still returns 400. 4. The page has a minus button and shows differences returned by the API.
Collaborator

Aira · queued

Aira picked up this task. Branch aira/2-subtract-numbers.

**Aira · queued** Aira picked up this task. Branch `aira/2-subtract-numbers`.
Collaborator

Aira · planning

Orchestrator thread started (composer-2.5). Planning on aira/2-subtract-numbers.

T3 thread: mcp:launch:8dfd463a24e85bb482777cedca23b43b29968115c174816b7672945382b2809d

**Aira · planning** Orchestrator thread started (composer-2.5). Planning on `aira/2-subtract-numbers`. T3 thread: `mcp:launch:8dfd463a24e85bb482777cedca23b43b29968115c174816b7672945382b2809d`
Collaborator

Aira · Plan (round 1) at 1cc4b924

Added docs/plans/issue-2.md (goal, ACs, design, files, test plan, risks); committed and pushed to aira/2-subtract-numbers.

docs/plans/issue-2.md

Issue #2: Subtract numbers

Goal

Add subtraction alongside addition: a pure subtract function in the library, op=subtract on GET /api/calculate, and a − (minus) button on the calculator UI that follows the same operand / equals flow as +. Preserve existing addition behaviour, error handling, /health, and / static serving.

Acceptance criteria

  1. /api/calculate?a=2&b=5&op=subtract returns {"result":-3}.
  2. /api/calculate?a=0.5&b=0.25&op=subtract returns {"result":0.25}.
  3. op=add still works and an unknown op still returns HTTP 400 with {"error": "<message>"}.
  4. The page has a minus (−) button and shows differences returned by the API (example flow: 7, −, 1, 0, = displays -3).

Design

Calculation module (lib/calculator.js)

  • Add subtract(a, b) — pure numeric subtraction (a - b); same IEEE double semantics as add.
  • Extend calculate(rawA, rawB, op):
    • Accept op === 'add' (existing) and op === 'subtract'.
    • Reject any other op with CalculatorError('Unknown operation') (unchanged message contract).
  • Export subtract alongside existing exports.
  • Reuse parseOperand and finite-result check for subtract results (including overflow edge cases analogous to add).

HTTP layer (server.js)

  • No structural changes: /api/calculate already delegates to calculate(). Subtraction is picked up automatically once the module supports op=subtract.
  • Confirm regression: invalid operands and unknown ops still map to 400 {"error": ...} via CalculatorError.

UI (public/index.html)

  • Add a − button on the keypad (Unicode minus U+2212), placed like the + button (same row pattern / grid).
  • Generalise operation handling:
    • On +: set pendingOp = 'add' and commit first operand (current behaviour, but not hard-coded only in evaluate).
    • On −: set pendingOp = 'subtract' and commit first operand the same way.
    • On =: require operandA, pendingOp, and current entry; fetch('/api/calculate?...') with op equal to pendingOp (add or subtract).
  • Display API result on success (including negative values such as -3); show error text on 400 as today.
  • Acceptance flow: 7 → − → 1 → 0 → = → display -3.

Test layout

File Purpose
test/calculator.test.js Unit tests for subtract, calculate with op=subtract, regressions for add and unknown op.
test/server.test.js HTTP tests for subtract success cases (AC1–2); keep add and unknown-op tests (AC3).
test/ui.test.js Assert minus button presence (data-key for −) and that client script can pass subtract via /api/calculate.

Files to change

File Action
lib/calculator.js Modify — add subtract, extend calculate dispatch.
server.js No change expected — verify via tests only.
public/index.html Modify — − button, generalise pendingOp / evaluate.
test/calculator.test.js Modify — subtract unit tests.
test/server.test.js Modify — subtract API acceptance cases.
test/ui.test.js Modify — minus button and subtract op in page script.
docs/plans/issue-2.md Create — this plan.

No changes to package.json, CI workflows, or dependencies (Node built-ins only).

Test plan

Unit (test/calculator.test.js)

Case Assert
AC1 (module) subtract(2, 5) === -3; calculate('2', '5', 'subtract') === -3.
AC2 (module) subtract(0.5, 0.25) === 0.25; calculate('0.5', '0.25', 'subtract') === 0.25.
AC3 Existing calculate(..., 'add') tests unchanged; unknown op still throws CalculatorError.
Edge Invalid operands with subtract mirror add; overflow if applicable (e.g. extreme magnitudes producing non-finite result).

HTTP (test/server.test.js)

Case Request Expect
AC1 a=2&b=5&op=subtract 200, { result: -3 }
AC2 a=0.5&b=0.25&op=subtract 200, { result: 0.25 }
AC3a a=2&b=3&op=add 200, { result: 5 } (existing)
AC3b a=1&b=2&op=pow 400, { error: string } (existing)

Re-run all existing health, index, 404, and add error tests unchanged.

UI / page (test/ui.test.js)

Case Assert
AC4 (controls) HTML includes data-key for − (minus button).
AC4 (integration) Inline script references /api/calculate and uses subtract (or pendingOp that includes subtract) so differences are fetched from the API.

Optional manual check: keypad 7, −, 1, 0, = shows -3 when the server is running.

Pre-push

  • Run npm test locally; all tests green before git push origin aira/2-subtract-numbers.

Risks

Risk Mitigation
Confusing − (U+2212) with ASCII - in data-key / click handling Use one consistent character in HTML data-key and JS switch; document in code only if needed; UI test matches the chosen key.
Hard-coded add in commitOperand / evaluate Refactor to pendingOp string used in API query; add tests for subtract in UI file.
Breaking addition flows Keep existing add HTTP and unit tests; no change to add branch logic beyond shared dispatch.
Float display for decimals (AC2) Show API result as returned (String(body.result)).
Grid layout with extra button Adjust keypad grid if needed so − fits without breaking digit/+/= layout.
Breaking /health or / Touch only calculator route path via module and HTML/JS; regression tests unchanged.

Attachment: plan-2-r1.md

**Aira · Plan (round 1) at `1cc4b924`** Added docs/plans/issue-2.md (goal, ACs, design, files, test plan, risks); committed and pushed to aira/2-subtract-numbers. <details><summary>docs/plans/issue-2.md</summary> # Issue #2: Subtract numbers ## Goal Add subtraction alongside addition: a pure `subtract` function in the library, `op=subtract` on `GET /api/calculate`, and a `−` (minus) button on the calculator UI that follows the same operand / equals flow as `+`. Preserve existing addition behaviour, error handling, `/health`, and `/` static serving. ## Acceptance criteria 1. `/api/calculate?a=2&b=5&op=subtract` returns `{"result":-3}`. 2. `/api/calculate?a=0.5&b=0.25&op=subtract` returns `{"result":0.25}`. 3. `op=add` still works and an unknown `op` still returns HTTP 400 with `{"error": "<message>"}`. 4. The page has a minus (`−`) button and shows differences returned by the API (example flow: `7`, `−`, `1`, `0`, `=` displays `-3`). ## Design ### Calculation module (`lib/calculator.js`) - Add `subtract(a, b)` — pure numeric subtraction (`a - b`); same IEEE double semantics as `add`. - Extend `calculate(rawA, rawB, op)`: - Accept `op === 'add'` (existing) and `op === 'subtract'`. - Reject any other `op` with `CalculatorError('Unknown operation')` (unchanged message contract). - Export `subtract` alongside existing exports. - Reuse `parseOperand` and finite-result check for subtract results (including overflow edge cases analogous to add). ### HTTP layer (`server.js`) - No structural changes: `/api/calculate` already delegates to `calculate()`. Subtraction is picked up automatically once the module supports `op=subtract`. - Confirm regression: invalid operands and unknown ops still map to `400 {"error": ...}` via `CalculatorError`. ### UI (`public/index.html`) - Add a `−` button on the keypad (Unicode minus U+2212), placed like the `+` button (same row pattern / grid). - Generalise operation handling: - On `+`: set `pendingOp = 'add'` and commit first operand (current behaviour, but not hard-coded only in `evaluate`). - On `−`: set `pendingOp = 'subtract'` and commit first operand the same way. - On `=`: require `operandA`, `pendingOp`, and current entry; `fetch('/api/calculate?...')` with `op` equal to `pendingOp` (`add` or `subtract`). - Display API `result` on success (including negative values such as `-3`); show error text on 400 as today. - Acceptance flow: `7` → `−` → `1` → `0` → `=` → display `-3`. ### Test layout | File | Purpose | |------|---------| | `test/calculator.test.js` | Unit tests for `subtract`, `calculate` with `op=subtract`, regressions for `add` and unknown `op`. | | `test/server.test.js` | HTTP tests for subtract success cases (AC1–2); keep add and unknown-op tests (AC3). | | `test/ui.test.js` | Assert minus button presence (`data-key` for `−`) and that client script can pass `subtract` via `/api/calculate`. | ## Files to change | File | Action | |------|--------| | `lib/calculator.js` | **Modify** — add `subtract`, extend `calculate` dispatch. | | `server.js` | **No change expected** — verify via tests only. | | `public/index.html` | **Modify** — `−` button, generalise `pendingOp` / `evaluate`. | | `test/calculator.test.js` | **Modify** — subtract unit tests. | | `test/server.test.js` | **Modify** — subtract API acceptance cases. | | `test/ui.test.js` | **Modify** — minus button and subtract op in page script. | | `docs/plans/issue-2.md` | **Create** — this plan. | No changes to `package.json`, CI workflows, or dependencies (Node built-ins only). ## Test plan ### Unit (`test/calculator.test.js`) | Case | Assert | |------|--------| | AC1 (module) | `subtract(2, 5) === -3`; `calculate('2', '5', 'subtract') === -3`. | | AC2 (module) | `subtract(0.5, 0.25) === 0.25`; `calculate('0.5', '0.25', 'subtract') === 0.25`. | | AC3 | Existing `calculate(..., 'add')` tests unchanged; unknown `op` still throws `CalculatorError`. | | Edge | Invalid operands with `subtract` mirror `add`; overflow if applicable (e.g. extreme magnitudes producing non-finite result). | ### HTTP (`test/server.test.js`) | Case | Request | Expect | |------|---------|--------| | AC1 | `a=2&b=5&op=subtract` | 200, `{ result: -3 }` | | AC2 | `a=0.5&b=0.25&op=subtract` | 200, `{ result: 0.25 }` | | AC3a | `a=2&b=3&op=add` | 200, `{ result: 5 }` (existing) | | AC3b | `a=1&b=2&op=pow` | 400, `{ error: string }` (existing) | Re-run all existing health, index, 404, and add error tests unchanged. ### UI / page (`test/ui.test.js`) | Case | Assert | |------|--------| | AC4 (controls) | HTML includes `data-key` for `−` (minus button). | | AC4 (integration) | Inline script references `/api/calculate` and uses `subtract` (or `pendingOp` that includes subtract) so differences are fetched from the API. | Optional manual check: keypad `7`, `−`, `1`, `0`, `=` shows `-3` when the server is running. ### Pre-push - Run `npm test` locally; all tests green before `git push origin aira/2-subtract-numbers`. ## Risks | Risk | Mitigation | |------|------------| | Confusing `−` (U+2212) with ASCII `-` in `data-key` / click handling | Use one consistent character in HTML `data-key` and JS `switch`; document in code only if needed; UI test matches the chosen key. | | Hard-coded `add` in `commitOperand` / `evaluate` | Refactor to `pendingOp` string used in API query; add tests for subtract in UI file. | | Breaking addition flows | Keep existing add HTTP and unit tests; no change to add branch logic beyond shared dispatch. | | Float display for decimals (AC2) | Show API `result` as returned (`String(body.result)`). | | Grid layout with extra button | Adjust keypad grid if needed so `−` fits without breaking digit/`+`/`=` layout. | | Breaking `/health` or `/` | Touch only calculator route path via module and HTML/JS; regression tests unchanged. | </details> Attachment: [plan-2-r1.md](https://aira-lab.cluster-dev.spkey.co/attachments/746304cc-27ae-41fe-bcb9-55cdaf988977)
Collaborator

Aira · plan review

Plan pushed at 1cc4b924; independent Dodik plan review started.

**Aira · plan review** Plan pushed at `1cc4b924`; independent Dodik plan review started.
Collaborator

Aira · dodik-plan PASS on 1cc4b924

The plan at 1cc4b924 maps each subtraction requirement to a numbered, testable acceptance criterion and matches the current code: calculate() only accepts op=add and rejects anything else with CalculatorError, server.js already delegates /api/calculate to calculate() and maps CalculatorError to 400, and the page hard-codes pendingOp and op to add in commitOperand and evaluate. The test plan proves AC1–AC2 at unit and HTTP level, AC3 by keeping the add and unknown-op tests, subtract invalid-operand and overflow edges in the module, and AC4 with a minus data-key check plus a script check that the page calls /api/calculate with subtract. Scope stays inside the calculator module, the page, and those tests.

Checks performed
  • Compared the plan file at commit 1cc4b92409 with the task requirements and acceptance criteria
  • Read lib/calculator.js: add-only dispatch, parseOperand, finite-result check, and exports
  • Read server.js: GET /api/calculate delegates to calculate() and returns 400 {error} on CalculatorError, with /health and / unchanged
  • Read public/index.html: 4-column keypad, data-key buttons, commitOperand and evaluate hard-coded to add, result shown via String(body.result)
  • Read test/calculator.test.js, test/server.test.js, and test/ui.test.js and checked that the new cases extend those files without new dependencies or server changes

Attachment: dodik-plan-1cc4b924.json

**Aira · dodik-plan PASS on `1cc4b924`** The plan at 1cc4b924 maps each subtraction requirement to a numbered, testable acceptance criterion and matches the current code: calculate() only accepts op=add and rejects anything else with CalculatorError, server.js already delegates /api/calculate to calculate() and maps CalculatorError to 400, and the page hard-codes pendingOp and op to add in commitOperand and evaluate. The test plan proves AC1–AC2 at unit and HTTP level, AC3 by keeping the add and unknown-op tests, subtract invalid-operand and overflow edges in the module, and AC4 with a minus data-key check plus a script check that the page calls /api/calculate with subtract. Scope stays inside the calculator module, the page, and those tests. <details><summary>Checks performed</summary> - Compared the plan file at commit 1cc4b92409441be6ba25c758c7c7ccfb56361c24 with the task requirements and acceptance criteria - Read lib/calculator.js: add-only dispatch, parseOperand, finite-result check, and exports - Read server.js: GET /api/calculate delegates to calculate() and returns 400 {error} on CalculatorError, with /health and / unchanged - Read public/index.html: 4-column keypad, data-key buttons, commitOperand and evaluate hard-coded to add, result shown via String(body.result) - Read test/calculator.test.js, test/server.test.js, and test/ui.test.js and checked that the new cases extend those files without new dependencies or server changes </details> Attachment: [dodik-plan-1cc4b924.json](https://aira-lab.cluster-dev.spkey.co/attachments/f5866b89-ba66-462d-869c-08169972a75b)
Collaborator

Aira · implementing

Plan approved by Dodik at 1cc4b924. Implementation started.

**Aira · implementing** Plan approved by Dodik at `1cc4b924`. Implementation started.
Collaborator

Aira · ci

Ready for review at a2d47366 (PR #6). Waiting for CI.

Implemented op=subtract in lib/calculator.js, minus button and pendingOp UI in public/index.html, and tests in calculator/server/ui suites; npm test 27/27 pass; pushed feat commit.

**Aira · ci** Ready for review at `a2d47366` (PR #6). Waiting for CI. Implemented op=subtract in lib/calculator.js, minus button and pendingOp UI in public/index.html, and tests in calculator/server/ui suites; npm test 27/27 pass; pushed feat commit.
Collaborator

Aira · CI passed on a2d47366

  • ci / test (pull_request): success
**Aira · CI passed on `a2d47366`** - ci / test (pull_request): success
Collaborator

Aira · review

CI is green on a2d47366. Independent Dodik and code review started.

**Aira · review** CI is green on `a2d47366`. Independent Dodik and code review started.
Collaborator

Aira · dodik PASS on a2d47366

Subtraction is implemented as specified: op=subtract returns a-b (including 2-5=-3 and 0.5-0.25=0.25), addition and unknown-op 400 handling are unchanged, and the page minus button displays API differences. All 27 tests passed, the new tests fail on origin/main, and the diff matches the approved plan with no unrelated or weakened tests.

Checks performed
  • Compared git diff origin/main...HEAD (a2d4736) with docs/plans/issue-2.md; only the planned calculator, page, tests, and plan file changed, and server.js was untouched.
  • Confirmed module, HTTP, and page tests assert subtract, add regression, and unknown op, and that those six new assertions fail when run against origin/main code.
  • Ran npm test: 27 passed, 0 failed, 0 skipped, 0 todo.
  • Curled the working-copy server: AC1 {"result":-3}, AC2 {"result":0.25}, add {"result":5}, op=pow 400 {"error":"Unknown operation"}, empty operand on subtract 400.
  • Checked the page uses U+2212 for data-key and the click handler, and replayed 7, minus, 1, 0, = to display -3 and 2, +, 3, = to display 5.
  • Scanned for skipped tests, debug leftovers, and README drift; README and AGENTS.md stay generic and do not contradict the new operation.

Attachment: dodik-a2d47366.json

**Aira · dodik PASS on `a2d47366`** Subtraction is implemented as specified: op=subtract returns a-b (including 2-5=-3 and 0.5-0.25=0.25), addition and unknown-op 400 handling are unchanged, and the page minus button displays API differences. All 27 tests passed, the new tests fail on origin/main, and the diff matches the approved plan with no unrelated or weakened tests. <details><summary>Checks performed</summary> - Compared git diff origin/main...HEAD (a2d4736) with docs/plans/issue-2.md; only the planned calculator, page, tests, and plan file changed, and server.js was untouched. - Confirmed module, HTTP, and page tests assert subtract, add regression, and unknown op, and that those six new assertions fail when run against origin/main code. - Ran npm test: 27 passed, 0 failed, 0 skipped, 0 todo. - Curled the working-copy server: AC1 {"result":-3}, AC2 {"result":0.25}, add {"result":5}, op=pow 400 {"error":"Unknown operation"}, empty operand on subtract 400. - Checked the page uses U+2212 for data-key and the click handler, and replayed 7, minus, 1, 0, = to display -3 and 2, +, 3, = to display 5. - Scanned for skipped tests, debug leftovers, and README drift; README and AGENTS.md stay generic and do not contradict the new operation. </details> Attachment: [dodik-a2d47366.json](https://aira-lab.cluster-dev.spkey.co/attachments/7dc64b68-702c-440e-8bd8-10125debd137)
Collaborator

Aira · reviewer PASS on a2d47366

The change cleanly adds subtract to the calculator module via shared dispatch in calculate(), relies on the unchanged server handler for op=subtract, and generalizes the UI with a Unicode minus key and pendingOp-driven API calls. All 27 tests pass, acceptance cases for subtract (including negatives and decimals) are covered at unit and HTTP layers, and existing add, health, index, and error paths regress correctly with no security or contract issues identified.

Checks performed
  • git diff origin/main...HEAD at a2d473669d
  • npm test (27 passing)
  • lib/calculator.js subtract dispatch, operand parsing, and overflow guard
  • server.js unchanged delegation to calculate()
  • public/index.html minus button, pendingOp, and evaluate flow
  • Manual verify calculate('7','10','subtract') and overflow subtract

Attachment: reviewer-a2d47366.json

**Aira · reviewer PASS on `a2d47366`** The change cleanly adds subtract to the calculator module via shared dispatch in calculate(), relies on the unchanged server handler for op=subtract, and generalizes the UI with a Unicode minus key and pendingOp-driven API calls. All 27 tests pass, acceptance cases for subtract (including negatives and decimals) are covered at unit and HTTP layers, and existing add, health, index, and error paths regress correctly with no security or contract issues identified. <details><summary>Checks performed</summary> - git diff origin/main...HEAD at a2d473669dd9f8be888db47242dfd51794bb77e2 - npm test (27 passing) - lib/calculator.js subtract dispatch, operand parsing, and overflow guard - server.js unchanged delegation to calculate() - public/index.html minus button, pendingOp, and evaluate flow - Manual verify calculate('7','10','subtract') and overflow subtract </details> Attachment: [reviewer-a2d47366.json](https://aira-lab.cluster-dev.spkey.co/attachments/baef61b4-7ffb-4827-932a-7f427a0d1132)
Collaborator

Aira · qa

Dodik and the reviewer passed on a2d47366. Preview deployed at http://127.0.0.1:44177; QA started.

**Aira · qa** Dodik and the reviewer passed on `a2d47366`. Preview deployed at http://127.0.0.1:44177; QA started.
Collaborator

Aira · qa PASS on a2d47366

Preview commit a2d473669d serves subtraction correctly. GET /health reports that sha. op=subtract returns a-b for 2-5 (-3) and 0.5-0.25 (0.25); op=add still returns a sum; missing, empty, non-numeric, and unknown operations return 400 with an error object. The page includes a − button wired to op=subtract and displays the API result. npm test passed 27/27, including subtract cases for the module, API, and page.

Checks performed

Attachment: qa-a2d47366.json

**Aira · qa PASS on `a2d47366`** Preview commit a2d473669dd9f8be888db47242dfd51794bb77e2 serves subtraction correctly. GET /health reports that sha. op=subtract returns a-b for 2-5 (-3) and 0.5-0.25 (0.25); op=add still returns a sum; missing, empty, non-numeric, and unknown operations return 400 with an error object. The page includes a − button wired to op=subtract and displays the API result. npm test passed 27/27, including subtract cases for the module, API, and page. <details><summary>Checks performed</summary> - GET http://127.0.0.1:44177/health -> 200 {"ok":true,"sha":"a2d473669dd9f8be888db47242dfd51794bb77e2"} - GET http://127.0.0.1:44177/api/calculate?a=2&b=5&op=subtract -> 200 {"result":-3} - GET http://127.0.0.1:44177/api/calculate?a=0.5&b=0.25&op=subtract -> 200 {"result":0.25} - GET http://127.0.0.1:44177/api/calculate?a=2&b=5&op=add -> 200 {"result":7} - GET http://127.0.0.1:44177/api/calculate?a=2&b=5&op=unknown -> 400 {"error":"Unknown operation"} - GET http://127.0.0.1:44177/api/calculate?b=5&op=subtract -> 400 {"error":"Invalid operand"} - GET http://127.0.0.1:44177/api/calculate?a=&b=5&op=subtract -> 400 {"error":"Invalid operand"} - GET http://127.0.0.1:44177/api/calculate?a=foo&b=5&op=subtract -> 400 {"error":"Invalid operand"} - GET http://127.0.0.1:44177/api/calculate?a=2&b=bar&op=subtract -> 400 {"error":"Invalid operand"} - GET http://127.0.0.1:44177/api/calculate?a=2&b=5 -> 400 {"error":"Unknown operation"} - GET http://127.0.0.1:44177/api/calculate?a=2&b=5&op= -> 400 {"error":"Unknown operation"} - GET http://127.0.0.1:44177/api/calculate?a=2&op=subtract -> 400 {"error":"Invalid operand"} - GET http://127.0.0.1:44177/api/calculate?a=7&b=10&op=subtract -> 200 {"result":-3} - GET http://127.0.0.1:44177/api/calculate?a=-4&b=-1.5&op=subtract -> 200 {"result":-2.5} - GET http://127.0.0.1:44177/api/calculate?a=0.1&b=0.2&op=add -> 200 {"result":0.30000000000000004} - GET http://127.0.0.1:44177/api/calculate?a=2&b=5&op=- -> 400 {"error":"Unknown operation"} - GET http://127.0.0.1:44177/ -> 200 text/html with one button data-key="−" and script branch key === "−" calling commitOperand('subtract'), then fetch /api/calculate and display body.result - npm test -> 27 pass, 0 fail, including subtract returns difference, calculate subtract returns difference, calculate subtract handles decimals, and index page supports subtract via pending operation </details> Attachment: [qa-a2d47366.json](https://aira-lab.cluster-dev.spkey.co/attachments/eafec0c2-ff3e-4f58-b75b-0daa6340deed)
Collaborator

Aira · merging

QA passed on a2d47366. Merging.

**Aira · merging** QA passed on `a2d47366`. Merging.
Collaborator

Aira · Merged PR #6

Merge commit f215b5f209ae6c6b2bc2071a4c7fee8ba49f3f3c from reviewed head a2d473669dd9f8be888db47242dfd51794bb77e2.

Gate Verdict Summary
ci pass ci / test (pull_request)
dodik pass Subtraction is implemented as specified: op=subtract returns a-b (including 2-5=-3 and 0.5-0.25=0.25), addition and unknown-op 400 handling are unchanged, and t
reviewer pass The change cleanly adds subtract to the calculator module via shared dispatch in calculate(), relies on the unchanged server handler for op=subtract, and genera
qa pass Preview commit a2d473669d serves subtraction correctly. GET /health reports that sha. op=subtract returns a-b for 2-5 (-3) and 0.5
**Aira · Merged PR #6** Merge commit `f215b5f209ae6c6b2bc2071a4c7fee8ba49f3f3c` from reviewed head `a2d473669dd9f8be888db47242dfd51794bb77e2`. | Gate | Verdict | Summary | |---|---|---| | ci | pass | ci / test (pull_request) | | dodik | pass | Subtraction is implemented as specified: op=subtract returns a-b (including 2-5=-3 and 0.5-0.25=0.25), addition and unknown-op 400 handling are unchanged, and t | | reviewer | pass | The change cleanly adds subtract to the calculator module via shared dispatch in calculate(), relies on the unchanged server handler for op=subtract, and genera | | qa | pass | Preview commit a2d473669dd9f8be888db47242dfd51794bb77e2 serves subtraction correctly. GET /health reports that sha. op=subtract returns a-b for 2-5 (-3) and 0.5 |
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
lab/web-calculator#2
No description provided.