Grok 4.6 on Remove dead JavaScript exports
Passed in 28s. Attempt 2. Run 20260904T112747Z-grok-4-6-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
grok -m grok-4.6 --output-format plain --always-approve -p '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
I'll start by reading the task file and inspecting the project so I can remove only the unused exports.Six unused exports are unused everywhere; two same-file helpers stay because other live functions call them. I'll delete only the six.Removed six unused exports. Left the two helpers that only their own files call.
Tests passed: `node --test test/` — 3 pass, 0 fail.
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.