Skip to content

Conversation

@viksachdev
Copy link
Collaborator

@viksachdev viksachdev commented Sep 3, 2025

Implements #102 - File-based configuration system

This PR introduces the foundational configuration infrastructure required for the configuration-driven filter architecture. The implementation provides type-safe configuration structures with comprehensive validation and human-friendly error messages.

Typescript Calculator Server using official TS SDK + Gopher native filters

@viksachdev viksachdev requested a review from edfams September 3, 2025 11:36
@github-actions
Copy link

github-actions bot commented Sep 3, 2025

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

1 similar comment
@github-actions
Copy link

github-actions bot commented Sep 3, 2025

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

@gophergogo gophergogo requested review from gophergogo and removed request for edfams September 3, 2025 19:55
@github-actions
Copy link

github-actions bot commented Sep 4, 2025

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

1 similar comment
@github-actions
Copy link

github-actions bot commented Sep 5, 2025

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

@github-actions
Copy link

github-actions bot commented Sep 8, 2025

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

2 similar comments
@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

@viksachdev viksachdev force-pushed the feature/configuration-system branch from da8fbb3 to fdc7082 Compare September 11, 2025 10:24
@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

1 similar comment
@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

}

mcp_json_value_t createTypedConfigChain() {
// Create chain with typed_config style (Envoy-like)
Copy link
Collaborator

@gophergogo gophergogo Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never commit this type of key word, they should not be in our code history, please do these:

  • backup branch
  • hard reset the commit before this
  • remove keyword
  • cherry-pick later commits from backup branch.

#Find packages
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(yaml-cpp REQUIRED)
Copy link
Collaborator

@gophergogo gophergogo Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fallback to auto-install (e.g. refer to other FetchContent_Declare) if pre-installed is not available.

-- gopher-mcp: Building as standalone project
CMake Error at CMakeLists.txt:128 (find_package):
  By not providing "Findyaml-cpp.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "yaml-cpp",
  but CMake did not find one.

  Could not find a package configuration file provided by "yaml-cpp" with any
  of the following names:

    yaml-cppConfig.cmake
    yaml-cpp-config.cmake

  Add the installation prefix of "yaml-cpp" to CMAKE_PREFIX_PATH or set
  "yaml-cpp_DIR" to a directory containing one of the above files.  If
  "yaml-cpp" provides a separate development package or SDK, be sure it has
  been installed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am doing this

@viksachdev viksachdev force-pushed the feature/configuration-system branch from dab9e29 to 3f57e81 Compare September 12, 2025 07:22
@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

3 similar comments
@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

@github-actions
Copy link

github-actions bot commented Oct 6, 2025

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

- Check for duplicate filter chain names during validation
- Include precise array indices in error messages
- Improve transport reference error paths
- Cast chars to unsigned char for isalnum/isdigit
- Prevents UB with non-ASCII or negative char values
- Wrap all j.get<>() calls with try-catch blocks
- Provide precise field paths in error messages
- Handle nested object parsing errors properly
- Add error context for parseJsonSize and parseJsonDuration calls
Remove incorrect dereference operators when assigning to
BootstrapConfig's node and admin members which are values, not pointers
- Use WithValidation types to enforce unknown field policy
- Add validation context to parseConfiguration method
- Check for unknown fields at root level
- Report unknown fields based on STRICT/WARN/PERMISSIVE policy
- Copy listeners to local vector before invoking callbacks
- Release mutex before calling listener functions
- Prevents deadlocks and blocking on slow callbacks
Add fmt::fmt to mcp_example_client, mcp_example_server, and
mcp_config_example_server for circuit breaker filter logging.
Implement Koffi-based FFI bindings for circuit breaker callback registration.
Add CircuitBreakerCallbacks class with type-safe callback registration.
@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

Add setCircuitBreakerCallbacks, clearCircuitBreakerCallbacks, and
hasCircuitBreakerCallbacks methods to UnifiedFilterChain wrapper.
@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

Change MetricsFilter constructor to accept shared_ptr<MetricsCallbacks> instead of reference, add setCallbacks() method for runtime updates, implement automatic metrics reporting via maybeReportMetrics(), complete updateSendRate() implementation, and add NullMetricsCallbacks pattern for safe operation.
Update filter factories, application base, and server to use shared_ptr<MetricsCallbacks> API. Add debug logging to filter registry.
Fix const-correctness for string view parameters in JSON bridge implementation.
Update filter_configurations example and metrics filter unit tests to use shared_ptr<MetricsCallbacks> API.
Implement C API bridge for metrics filter callbacks with mcp_filter_chain_set_metrics_callbacks(), mcp_filter_chain_clear_metrics_callbacks(), and mcp_filter_chain_has_metrics_callbacks(). Add mcp_connection_metrics_t struct for FFI-safe metrics transfer and MetricsCallbackBridge for C-to-C++ callback translation.
Extend AdvancedFilterChain with metrics callback management:
- Add setMetricsCallbacks() to register callbacks
- Add clearMetricsCallbacks() to unregister callbacks
- Add hasMetricsCallbacks() to check registration status
- Add applyMetricsCallbacksToFilters() for runtime updates
- Ensure thread-safe dispatcher-based callback application
…102)

Update circuit breaker callback handling to use AdvancedFilterChain:
- Refactor to use consistent callback management pattern
- Ensure uniform approach across all filter callback types
- Improve code consistency and maintainability
Add TypeScript type definitions for metrics monitoring:
- Add MetricsSnapshot interface for metrics data
- Add MetricsThresholdEvent interface for threshold alerts
- Add MetricsCallbacks interface for callback bundle
- Export types from types/index.ts
Add Koffi bindings for metrics callback C API:
- Define mcp_connection_metrics_t struct with unique naming
- Add FFI function declarations for metrics callback API
- Implement BigInt to number conversion with safe clamping
- Support mcp_filter_chain_set/clear/has_metrics_callbacks
Implement metrics callback registration and lifecycle management:
- Add registerMetricsCallbacks() with Koffi callback wrapping
- Add unregisterMetricsCallbacks() with proper cleanup
- Add MetricsCallbackHandle for callback lifecycle management
- Implement error handling via onError callback
- Export functions from index.ts
Add getChainHandle() method to GopherFilteredTransport:
- Enable access to underlying filter chain for callback registration
- Support metrics callback registration on transport instances
- Maintain encapsulation while providing necessary access
Add metrics filter configuration to calculator-hybrid example:
- Configure metrics filter with 10 second reporting interval
- Enable metrics collection for example application
- Prepare configuration for metrics callback integration
Add metrics callback integration to calculator-hybrid server:
- Register metrics callbacks on transport instance
- Add formatted metrics output with timestamps
- Implement error handling for metrics events
- Demonstrate real-time metrics monitoring usage
@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

@github-actions
Copy link

❌ Code Formatting Check Failed

Some files in this PR are not properly formatted according to the project's clang-format rules.

To fix this issue:

make format

Then commit and push the changes.

@gophergogo gophergogo closed this pull request by merging all changes into main in 55d3040 Nov 11, 2025
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.

4 participants