Skip to content

Implement config validation tests with comprehensive flag combination checks - #7

Draft
thesprockee with Copilot wants to merge 38 commits into
mainfrom
copilot/implement-test-prompts-validation
Draft

Implement config validation tests with comprehensive flag combination checks#7
thesprockee with Copilot wants to merge 38 commits into
mainfrom
copilot/implement-test-prompts-validation

Conversation

Copilot AI commented Feb 10, 2026

Copy link
Copy Markdown
Contributor

Implements test coverage specified in .prompts/test-config-validation.md. Refactors validation logic from command execution to config layer and adds 52 test cases achieving 100% coverage on critical validation functions.

Changes

Validation Refactoring

  • Moved flag combination validation from converter.go to ValidateConverterConfig()
  • Added 5 validation helpers: required fields, format normalization, flag combinations, filesystem checks, glob syntax
  • Prevents invalid combinations like --validate + --recursive, --recursive without --output-dir

Environment Variables

  • Added support for 10 converter config env vars (EVR_CONVERTER_*, NEVR_CONVERTER_*)
  • Implemented parseBool() helper accepting "true/1/yes/on"

Test Coverage

  • Created internal/config/converter_validation_test.go with 52 tests
  • Coverage: ValidateConverterConfig 100%, validateRequiredFields 100%, validateFormat 100%, validateFlagCombinations 86.7%, validateFileSystem 79.2%
  • Scaffolded 45 additional converter function tests in cmd/agent/converter_test.go (blocked by pre-existing build issues)

Example

Before:

// Validation scattered in runConverter()
if cfg.Converter.Validate && cfg.Converter.ExcludeBones {
    return fmt.Errorf("--validate cannot be used with --exclude-bones")
}
// Basic validation in config
if cfg.Converter.InputFile == "" {
    return fmt.Errorf("input file must be specified")
}

After:

// All validation centralized in config layer
func (c *Config) ValidateConverterConfig() error {
    // 35+ validation rules across 5 categories
    if err := validateRequiredFields(cfg); err != nil { return err }
    if err := validateFormat(cfg); err != nil { return err }
    if err := validateFlagCombinations(cfg); err != nil { return err }
    if err := validateFileSystem(cfg); err != nil { return err }
    if err := validateGlobPattern(cfg); err != nil { return err }
    return nil
}

Notes

Pre-existing build failures prevent testing cmd/agent functions (missing nevr-common/v4/gen/go/apigame/v1, undefined events.NewWithDefaultSensors). Config tests verified working.

Original prompt

implement the test.. .prompts/test-config-validation.md .prompts/test-converter-tier1-critical.md .prompts/test-converter-tier2-high.md .prompts/test-converter-tier3-medium.md


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

thesprockee and others added 30 commits September 14, 2025 18:24
* Update deps

* Add build tools and instructions

* Add script used to supervise EchoVRCE competitive servers

* Update Go version to 1.25 in workflows for benchmarks, release, and build binaries

* Update .github/workflows/benchmarks.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update .github/workflows/build-release-binaries.yml

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…JWT auth (#5)

Features:
- Unified CLI using Cobra/Viper replacing individual command binaries
- GraphQL API for session events with pagination
- Real-time WebSocket streaming for match frames
- Prometheus metrics endpoint for monitoring
- Player lookup service with caching and rate limiting
- StorageManager for nevrcap files with retention policies
- AMQP publishing support for event distribution

Infrastructure:
- Docker Compose setup with MongoDB integration
- GitHub Actions workflow for release binaries
- GitHub Container Registry (ghcr.io) publishing

Security:
- JWT middleware for API authentication
- Fixed SQL injection vulnerability (code scanning alert #6)

Dependencies:
- Updated to nevr-capture v3.2.0
- Removed viper dependency and replaced it with direct flag variable assignments for better clarity and control.
- Updated the agent, API server, converter, replayer, and send events commands to use local variables for flags instead of viper.
- Enhanced configuration loading to prioritize command-line flags over config files and environment variables.
- Improved JWT token handling in the agent command, ensuring CLI flags take precedence.
- Added detailed logging for JWT token status in the agent command.
- Updated the configuration struct to remove unnecessary mapstructure tags and ensure YAML compatibility.
- Implemented environment variable overrides for configuration settings, supporting both NEVR_ and EVR_ prefixes for backward compatibility.
- Cleaned up the go.mod file by removing unused dependencies related to viper.
- Removed Events field from StreamConfig and related flags in agent command.
- Updated event streaming URL to use WebSocket protocol.
- Deleted the send events command and associated logic.
- Simplified event handling in the agent by removing EventsAPIWriter.
- Adjusted API server routes to focus on WebSocket streaming.
- Updated documentation to reflect changes in event handling and API usage.
- Cleaned up unused code and configurations related to events API.
- Introduce new API endpoints for listing matches and retrieving match details.
- Update capture size and retention configuration to accept human-readable formats.
- Implement storage manager for handling match data with active and completed states.
- Add tests for parsing and formatting byte sizes.
thesprockee and others added 4 commits February 9, 2026 23:25
- Add --recursive flag to recursively search directories
- Add --glob flag for pattern matching (e.g., '*.echoreplay')
- Add --validate flag for round-trip data integrity validation
- Validation uses raw JSON comparison to ensure ALL fields preserved
- Fix import paths for apigame/v1 migration in replayer and validator
- Prevent --output with --recursive/--glob (auto-generated outputs)
- Prevent --validate with --exclude-bones (validation would fail)
* fix/optimize-streams:
  feat(converter): add recursive/glob search and round-trip validation
  Add node ID configuration for agent instances
  Enhance match retrieval and storage management
  Add StreamHub integration and endpoint for listing active streams
  Add .gitignore and project configuration file for language server setup
  Skip storing session frames without events in StoreSessionFrame function
  Implement disk buffering for WebSocketWriter to handle frame storage during disconnections
  Update sessionEventDatabaseName to use 'nevr_telemetry' in resolvers and types
  Implement automatic reconnection for WebSocketWriter with exponential backoff
  Add frame counting and logging for WebSocket message processing
  Make the JWT secret optional, update WebSocket endpoint, and improve related documentation
  Update output format to 'nevrcap' and improve logging message for nevrcap file writing
  Fix event processor
  Refactor agent to remove events API and streamline event streaming
  Add 'bin/' to .gitignore to exclude binary output from version control
  Refactor configuration files and Docker setup for improved clarity and functionality
  Refactor command-line flag handling and configuration loading
- Add tier 1 (critical) test prompt: 285 test cases for core converter functions
- Add tier 2 (high) test prompt: 160 test cases for JSON comparison and path handling
- Add tier 3 (medium) test prompt: 72 test cases for utility functions
- Add config validation test prompt: 150 test cases with refactoring guidance
- Total 667 planned test cases targeting 80%+ coverage
- Includes test fixtures, helper functions, and acceptance criteria
- Ready for implementation by test agents
Copilot AI and others added 4 commits February 10, 2026 09:01
- Expanded ValidateConverterConfig() with 5 validation categories
- Moved validation logic from converter.go to config layer
- Added converter env var support to applyEnvOverrides()
- Created 52 comprehensive test cases in converter_validation_test.go
- All tests passing

Co-authored-by: thesprockee <962164+thesprockee@users.noreply.github.com>
- Created converter_test.go with 45+ test cases for utility functions
- Tests cover: command structure, format detection, path logic, file discovery
- Note: cmd/agent tests blocked by pre-existing build issues in replayer.go
- All config validation tests passing with 100% coverage on critical functions

Co-authored-by: thesprockee <962164+thesprockee@users.noreply.github.com>
- Documented Phase 1 completion with 52 tests and excellent coverage
- Explained build issues blocking Phases 2-4 implementation
- Provided examples of validation improvements and benefits
- Added instructions for running tests and next steps

Co-authored-by: thesprockee <962164+thesprockee@users.noreply.github.com>
- Fixed line count in TEST_IMPLEMENTATION_SUMMARY.md (889 vs 1,142)
- Added clarifying comment about env var prefix handling (getEnv checks both NEVR_ and EVR_ prefixes)
- No functional changes needed

Co-authored-by: thesprockee <962164+thesprockee@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement test for configuration validation and converters Implement config validation tests with comprehensive flag combination checks Feb 10, 2026
Copilot AI requested a review from thesprockee February 10, 2026 09:09
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