Skip to content

Conversation

@Sceat
Copy link
Member

@Sceat Sceat commented Nov 6, 2025

Summary

Complete modernization of @hydre/graphql-http to 2025 standards with test-driven development, comprehensive coverage, and antcolony backend conventions.

Key Improvements

Testing Infrastructure

  • Migrated to Node.js built-in test runner (node:test)
  • Added comprehensive test suites for all 4 adapters (Koa, Fastify, Lambda, TinyHttp)
  • 28 tests passing with 85.56% code coverage
  • Error path and edge case coverage included
  • c8 coverage reporting with enforced thresholds (75% lines, 70% branches)

Dependencies Updated

  • graphql: 16.6.0 → 16.12.0
  • ESLint: 8.x → 9.17.0 (flat config)
  • Prettier: 2.8.8 → 3.6.2
  • Husky: 4.x → 9.1.7
  • Fastify: 4.17.0 → 5.2.0
  • All dev dependencies to latest stable versions
  • Removed Babel (no longer needed with modern Node.js)
  • Fixed security vulnerability (brace-expansion)

Code Quality & Standards

  • ESLint 9 flat config (eslint.config.js)
  • Pino structured logging added
  • TypeScript type checking enabled
  • Modern JavaScript patterns enforced
  • snake_case convention throughout (with backward compat)

Security

  • npm audit clean (0 vulnerabilities)
  • Removed deprecated dependencies
  • Updated packages with known CVEs

Breaking Changes

⚠️ API Parameter Naming (snake_case)

// Before (camelCase)
graphqlHTTP({ 
  buildContext: async () => ({}),
  formatError: error => error,
  rootValue: {}
})

// After (snake_case, but camelCase still supported for compat)
graphqlHTTP({
  build_context: async () => ({}),
  format_error: error => error,
  root_value: {}
})

Backward Compatibility: All adapters accept both camelCase and snake_case in request bodies (operationName / operation_name, variables works for both).

Test Coverage

File         | % Stmts | % Branch | % Funcs | % Lines
-------------|---------|----------|---------|--------
All files    |   85.56 |    91.17 |   78.57 |   85.56
 base.js     |   76.85 |       90 |      50 |   76.85
 fastify.js  |     100 |      100 |     100 |     100
 koa.js      |     100 |      100 |     100 |     100
 lambda.js   |     100 |      100 |     100 |     100
 tinyhttp.js |     100 |       75 |     100 |     100

Test Plan

  • All 28 tests passing
  • Coverage thresholds met (75%+ lines/statements)
  • Lint passing (ESLint + Prettier)
  • Security audit clean
  • Backward compatibility verified (camelCase still works)
  • All 4 adapters tested (Koa, Fastify, Lambda, TinyHttp)
  • Error paths covered (missing query, invalid syntax, validation errors)

🤖 Generated with Claude Code

…onventions

## Breaking Changes
- **BREAKING**: Convert all API parameters to snake_case (build_context, root_value, format_error, operation_name, variable_values)
- Adapters now accept both camelCase and snake_case for backward compatibility

## Dependencies
- Update graphql 16.6.0 → 16.12.0
- Update all dev dependencies to latest (ESLint 9, Prettier 3.6, Husky 9, etc.)
- Remove Babel dependencies (no longer needed with modern Node.js)
- Add Pino 10.1.0 for structured logging
- Add c8 10.1.3 for coverage reporting
- Add TypeScript 5.9.3 for type checking

## Testing Infrastructure
- Migrate to Node.js built-in test runner (from tap)
- Add comprehensive test suite for all adapters (Koa, Fastify, Lambda, TinyHttp)
- Add error path and edge case coverage
- Configure c8 with 75% line/statement, 70% branch/function thresholds
- 28 tests passing, 85.56% coverage achieved

## Code Quality
- Migrate to ESLint 9 flat config (eslint.config.js)
- Remove deprecated @babel/eslint-parser
- Enforce modern JavaScript patterns (no-var, prefer-const, prefer-spread)
- Add Pino logger configuration for structured logging
- Fix security vulnerability (brace-expansion)

## New Tests
- test/fastify.test.js - Fastify adapter tests (variables, errors, validation)
- test/lambda.test.js - Lambda adapter tests (including named operations)
- test/tinyhttp.test.js - TinyHttp adapter tests (complete coverage)
- Enhanced test/index.test.js - Koa tests with error paths

## Improvements
- Add typecheck script (tsc --noEmit)
- Update npm scripts (test:coverage, typecheck)
- Add coverage/ to .gitignore
- Fix getOperationAST destructuring bug (operation_ast.operation)
- Support both camelCase and snake_case in request bodies (backward compat)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Sceat Sceat requested a review from DeltaEvo as a code owner November 6, 2025 18:18
@Sceat Sceat merged commit 3e6627b into edge Nov 6, 2025
2 of 3 checks passed
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.

2 participants