Skip to content

Issue 001: Test and lint foundation#2

Merged
cody257 merged 3 commits into
mainfrom
agent/001-test-foundation
Apr 28, 2026
Merged

Issue 001: Test and lint foundation#2
cody257 merged 3 commits into
mainfrom
agent/001-test-foundation

Conversation

@cody257

@cody257 cody257 commented Apr 28, 2026

Copy link
Copy Markdown
Member

Closes #1.

What's in this PR

Two commits:

  1. Update HAGGLY_V2_AGENT_PLAN.md with v2 decisions — locks in decisions made during the planning conversation (Issue 005 status set, Issue 008 stack, Vite-stays, TS deferred, password-gated previews).
  2. Issue 001: add ESLint flat config, Vitest, and CI lint/test steps — the test/lint foundation itself.

Issue 001 changes

  • eslint.config.js: ESLint 10 flat config covering js.configs.recommended + react-hooks + react-refresh (the JSX-only block applies React rules just to .jsx). caughtErrors: 'none' keeps --max-warnings 0 viable against the existing untouched source.
  • package.json: drops the invalid --ext flag from the lint script (flat config infers from config) and adds test (vitest run).
  • vite.config.js: adds Vitest's test field (environment: 'node', src/**/*.test.{js,jsx} include).
  • src/utils/messageGenerator.test.js: 8 tests covering offer classification (lowball/counter/close/acceptable/accept) and counter-offer math (no-minimum vs. minimum-floor). Exercises the public generateMessages export with Math.random pinned via vi.spyOn for deterministic template selection.
  • .github/workflows/ci.yml: adds Lint and Test steps before Build.

Owned-files compliance

This PR only touched files declared as owned by Issue 001 plus the planning doc commit (which is documentation, not implementation). Source files (src/App.jsx, src/components/*, src/utils/messageGenerator.js) are untouched.

Local verification

Node 24.14.0, npm 11.9.0:

  • npm run lint — 0 errors, 0 warnings
  • npm test — 8/8 passed
  • npm run builddist/ produced (163 KB JS / 21 KB CSS)

Acceptance criteria

  • npm run lint passes
  • npm test passes
  • npm run build passes
  • GitHub Actions runs all three (this PR's CI run will confirm)

Follow-ups deferred to later issues

  • Wider unit coverage of messageGenerator internals (getOfferType, getCounterOffer exported and tested directly) → Issue 006.
  • React Testing Library + jsdom for component tests → not needed yet; revisit when a UI feature ticket calls for it.
  • .claude/ is untracked locally — leaving .gitignore alone here since it's not in Issue 001's owned files; can be a small follow-up.

cody257 and others added 2 commits April 28, 2026 07:32
Resolves the open stack/scope decisions from the planning conversation:

- Issue 005 status set: active | accepted | declined | expired
- Issue 008: stay on Vite, ship the AI route as a Vercel Function at /api/chat (no Next.js migration for v2)
- Stack Decision section rewritten to reflect the resolved direction
- Non-Goals: TypeScript migration explicitly deferred (revisit at Issue 006 if the negotiation context grows past ~5 fields)
- Deployment Plan: previews are password-gated; public-traffic hardening (rate limit, spend cap, abuse logging) is a separate post-launch issue before cutover

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Closes #1.

- eslint.config.js: ESLint 10 flat config (js.recommended + react-hooks + react-refresh on .jsx). caughtErrors: 'none' so the existing CopyButton catch param doesn't trip --max-warnings 0.
- package.json: drop the invalid --ext flag from the lint script (flat config infers files from config). Add `test` script (`vitest run`).
- vite.config.js: add `test` field for Vitest with environment: 'node' and src/**/*.test.{js,jsx} include glob.
- src/utils/messageGenerator.test.js: 8 tests covering offer classification (lowball/counter/close/acceptable/accept) and counter-offer math (no-minimum vs. minimum-floor), exercising the public generateMessages export with Math.random pinned for determinism.
- .github/workflows/ci.yml: add Lint and Test steps before Build.

Local verification on Node 24.14 / npm 11.9:
- npm run lint: 0 errors, 0 warnings
- npm test: 8/8 passed
- npm run build: dist/ produced

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@cody257 cody257 merged commit d4e3c04 into main Apr 28, 2026
1 check passed
@cody257 cody257 deleted the agent/001-test-foundation branch April 28, 2026 17:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue 001: Test and lint foundation

1 participant