Files

4.7 KiB

APOPHIS Task Breakdown

Completed (v1.1)

Phase 1: Core Extension Points

  • Add headers field to ApophisExtension interface
  • Implement getExtensionHeaders() in ExtensionRegistry
  • Update parser to accept extension headers
  • Verify evaluator supports extension predicates
  • Add 14 tests

Phase 2A: Multipart Uploads

  • Add MultipartFile and MultipartPayload types
  • Implement multipart schema-to-arbitrary handler
  • Update request builder for multipart payloads
  • Add multipart support to HTTP executor
  • Add request_files and request_fields parser operations
  • Add multipart operations to evaluator
  • File arrays: maxCount > 1 generates arrays of files
  • Add 9 tests

Phase 2B: Streaming / NDJSON

  • Add chunks and streamDurationMs to EvalContext.response
  • Add streaming config extraction from schema
  • Implement NDJSON parsing in HTTP executor
  • Add stream_chunks and stream_duration parser operations
  • Add streaming operations to evaluator
  • Integration tests with Fastify NDJSON routes
  • Add 7 tests

Phase 2C: Extension System Polish

  • Update contract-validation.ts with extension headers
  • Update substitutor.ts with extension header support
  • Add integration tests for extension registration
  • Add 5 tests

Phase 3A: SSE Extension

  • Create src/extensions/sse/ module
  • Implement SSE format parser
  • Implement sse_events predicate
  • Add response transformer hook
  • Integration tests with Fastify SSE routes
  • Add 7 tests

Phase 3B: Serializers Extension

  • Create src/extensions/serializers/ module
  • Implement SerializerRegistry
  • Implement request/response transformers
  • Create createSerializerExtension() factory
  • Integration tests for request body transformation
  • Add 4 tests

Phase 3C: WebSockets Extension

  • Create src/extensions/websocket/ module
  • Implement ws_message and ws_state predicates
  • Add onSuiteStart pre-validation hook
  • Implement runWebSocketTests() runner
  • State transition validation
  • Add 5 tests

Phase 4: TypeScript Strict Mode

  • Fix src/domain/request-builder.ts: multipart files type
  • Fix src/extension/registry.ts: type safety
  • Fix src/extensions/sse/transformer.ts: SSEEvent type
  • Fix src/extensions/sse/test.ts: predicate assertions
  • Fix src/extensions/websocket/test.ts: predicate assertions
  • Fix src/formula/evaluator.ts: accessor undefined checks, restore exports
  • Fix all extension tests: predicate return type narrowing
  • Fix all test helpers: HttpMethod casting
  • npx tsc --noEmit passes with zero errors
  • All 468 tests passing

Phase 5: Extension System Hardening

  • Dependency ordering: dependsOn with topological sort
  • Async boot: onSuiteStart hooks run in dependency order
  • Health checks: healthCheck field with runHealthChecks()
  • State isolation with Object.freeze()
  • Redaction of sensitive data before passing to extensions
  • Timeout guards on all hooks
  • Prototype pollution prevention in accessor resolution
  • validateFormula(): error messages with suggestions

Phase 7: Schema-to-Contract Inference

  • Create src/domain/schema-to-contract.ts module
  • Infer != null from required fields
  • Infer >= / <= from minimum / maximum bounds
  • Infer matches from pattern regexes
  • Infer == from const values
  • Infer == / || chains from small enum sets
  • Recurse into nested objects and arrays
  • Merge inferred + explicit contracts in extractContract()
  • Deduplicate inferred against explicit x-ensures
  • Add 15 tests for inference logic
  • Add integration tests for extractContract merging
  • Build passes with 0 TypeScript errors
  • 482 tests passing

Phase 6: Code Cleanup

  • Evaluator deduplication: operation lookup table, shared resolveAccessor()
  • Error suggestions: imperative if-chain to pattern matchers
  • Extension registry: handleHookError() utility
  • Shared test utilities: src/test/helpers.ts
  • Shared runner utilities: src/test/runner-utils.ts
  • Test deduplication: convert test files to shared helpers
  • Remove duplicate scope auto-discovery test
  • Shared security utilities: src/infrastructure/security.ts
  • Deduplicate error handling: getErrorMessage() replaces 19 instances
  • Deduplicate path param extraction: shared extractPathParams()

Release Criteria

  • TypeScript strict mode passes
  • All integration tests pass
  • Performance benchmarks within 5% of v1.0
  • Documentation complete
  • CHANGELOG.md updated
  • README.md updated
  • Version bumped in package.json