AtrisBench
Back to the leaderboard

Muse Spark 1.3 on Remove dead JavaScript exports

Passed in 27s. Attempt 2. Run 20260904T115815Z-muse-spark-1-3-dead-code-2.

Task

Remove dead exports

This small Node project has six exports under src/ that are unused everywhere. Remove the dead code without removing any export that the project uses.

Two exports are easy to misclassify because they are used only by another function in their own file. They are live and must stay. Every other live export is imported by another source or test file.

There is no report to write. The output is the cleaned src/ folder, and this command must stay green without installing anything:

node --test test/

Command

opencode run --dir /tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work --auto -m opencode/muse-spark-1.3-contributor-free 'You are working in the current folder. Do the task in TASK.md and write the outputs to the exact paths it names.
Do not ask questions. When done, stop.

# Remove dead exports

This small Node project has six exports under `src/` that are unused everywhere. Remove the dead
code without removing any export that the project uses.

Two exports are easy to misclassify because they are used only by another function in their own
file. They are live and must stay. Every other live export is imported by another source or test
file.

There is no report to write. The output is the cleaned `src/` folder, and this command must stay
green without installing anything:

` ` `sh
node --test test/
` ` `'

Output

Cutting the dead code — keeping what's live.
I've mapped every export — now removing the six dead ones.
Removals done — verifying the tests still pass.
Done. Removed 6 dead exports (`LEGACY_REGION`, `titleCase`, `debugLabel`, `legacyDivide`, `exportOldCsv`, `previewReport`) while keeping in-file helpers `normalizeWhitespace` and `roundTax`. Tests pass (3/3).


[stderr]

> build · muse-spark-1.3-contributor-free

→ Read .
→ Read TASK.md
→ Read package.json
→ Read src
→ Read test
→ Read src/constants.js
→ Read src/format.js
→ Read src/math.js
→ Read test/package.json
→ Read src/report.js
→ Read test/report.test.js

← Edit src/constants.js
Index: /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/constants.js
===================================================================
--- /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/constants.js
+++ /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/constants.js
@@ -1,3 +1,2 @@
 export const TAX_RATE = 0.0825;
 export const DEFAULT_CURRENCY = "USD";
-export const LEGACY_REGION = "us-west-1";


← Edit src/format.js
Index: /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/format.js
===================================================================
--- /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/format.js
+++ /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/format.js
@@ -13,12 +13,4 @@
     style: "currency",
     currency: DEFAULT_CURRENCY,
   }).format(value);
 }
-
-export function titleCase(value) {
-  return value.replace(/\b\w/g, (letter) => letter.toUpperCase());
-}
-
-export function debugLabel(name, value) {
-  return `${name}: ${JSON.stringify(value)}`;
-}


← Edit src/math.js
Index: /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/math.js
===================================================================
--- /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/math.js
+++ /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/math.js
@@ -14,8 +14,4 @@
 
 export function calculateTax(subtotal) {
   return roundTax(multiply(subtotal, TAX_RATE));
 }
-
-export function legacyDivide(total, pieces) {
-  return pieces === 0 ? 0 : total / pieces;
-}


← Edit src/report.js
Index: /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/report.js
===================================================================
--- /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/report.js
+++ /private/tmp/atris-bench/20260904T115815Z-muse-spark-1-3-dead-code-2/work/src/report.js
@@ -8,12 +8,4 @@
     tax: formatUsd(tax),
     total: formatUsd(add(subtotal, tax)),
   };
 }
-
-export function exportOldCsv(rows) {
-  return rows.map((row) => Object.values(row).join(",")).join("\n");
-}
-
-export function previewReport(report) {
-  return JSON.stringify(report).slice(0, 80);
-}


$ node --test test/
✔ buildInvoiceReport formats the expected total (15.898583ms)
✔ formatCustomerName uses its in-file whitespace helper (0.21525ms)
✔ multiply remains available (0.064125ms)
ℹ tests 3
ℹ suites 0
ℹ pass 3
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 88.156333


Files produced

src/constants.js

export const TAX_RATE = 0.0825;
export const DEFAULT_CURRENCY = "USD";

src/format.js

import { DEFAULT_CURRENCY } from "./constants.js";

export function normalizeWhitespace(value) {
  return value.trim().replace(/\s+/g, " ");
}

export function formatCustomerName(value) {
  return normalizeWhitespace(value);
}

export function formatUsd(value) {
  return new Intl.NumberFormat("en-US", {
    style: "currency",
    currency: DEFAULT_CURRENCY,
  }).format(value);
}

src/math.js

import { TAX_RATE } from "./constants.js";

export function add(left, right) {
  return left + right;
}

export function multiply(left, right) {
  return left * right;
}

export function roundTax(value) {
  return Math.round(value * 100) / 100;
}

export function calculateTax(subtotal) {
  return roundTax(multiply(subtotal, TAX_RATE));
}

src/report.js

import { add, calculateTax } from "./math.js";
import { formatUsd } from "./format.js";

export function buildInvoiceReport(subtotal) {
  const tax = calculateTax(subtotal);
  return {
    subtotal: formatUsd(subtotal),
    tax: formatUsd(tax),
    total: formatUsd(add(subtotal, tax)),
  };
}

Checker

{"passed": true, "score": 1.0, "notes": "6/6 dead symbols removed; 10/10 live symbols preserved; tests pass: True"}

Judge

Not used for this task.