Skip to content

refactor: internal OTLP types + remove ghost code - #2

Merged
ANcpLua merged 2 commits into
mainfrom
refactor/internal-otlp-types
Jan 23, 2026
Merged

refactor: internal OTLP types + remove ghost code#2
ANcpLua merged 2 commits into
mainfrom
refactor/internal-otlp-types

Conversation

@ANcpLua

@ANcpLua ANcpLua commented Jan 23, 2026

Copy link
Copy Markdown
Owner

Summary

  • Change all OTLP implementation types (DTOs, parsers, converters) to internal visibility
  • Remove obsolete generated files from core/ directory (ghost code)
  • Add InternalsVisibleTo for test project

Motivation

Enforces clean architecture boundaries - only qyl.protocol exposes public APIs. The OTLP ingestion layer is an implementation detail of qyl.collector.

Test Plan

  • All 153 tests pass
  • Build succeeds
  • Runtime verification with OTLP telemetry

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Restructured internal API visibility to reduce the public surface area and improve encapsulation.
    • Removed internal code generation artifacts previously used for schema and type definitions.
    • Updated project configuration to support internal testing infrastructure.

✏️ Tip: You can customize this high-level summary in your review settings.

ANcpLua and others added 2 commits January 23, 2026 21:14
Encapsulate OTLP implementation details within qyl.collector:

- OtlpGenAiAttributes, SchemaNormalizer → internal
- All OTLP DTOs (OtlpSpan, OtlpResource, etc.) → internal
- OtlpConverter, OtlpJsonSpanParser → internal
- QylSerializerContext → internal
- Well-known value classes → internal

Add InternalsVisibleTo for qyl.collector.tests to maintain test access.
Update test to use int instead of SpanKind enum in InlineData attributes.

This enforces clean architecture boundaries - only qyl.protocol
exposes public APIs for external consumption.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Delete obsolete generated files from core/collector/ and core/protocol/.
These files are duplicates - the generator now writes directly to src/.

Removed:
- core/collector/Storage/DuckDbSchema.g.cs
- core/protocol/Enums/Enums.g.cs
- core/protocol/Models/Types.g.cs
- core/protocol/Primitives/Scalars.g.cs

The authoritative generated files remain in:
- src/qyl.collector/Storage/DuckDbSchema.g.cs
- src/qyl.protocol/*/

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 23, 2026 20:15
@coderabbitai

coderabbitai Bot commented Jan 23, 2026

Copy link
Copy Markdown

Walkthrough

This change removes four auto-generated files containing public types, enums, and scalars (DuckDB schema, protocol enums, data models, and primitive scalars), while converting remaining OTLP-related types and serialization classes from public to internal visibility. A test project is granted internal type access via InternalsVisibleTo declaration, and a test method signature is updated to accommodate the visibility changes.

Changes

Cohort / File(s) Summary
Auto-generated file deletions
core/collector/Storage/DuckDbSchema.g.cs, core/protocol/Enums/Enums.g.cs, core/protocol/Models/Types.g.cs, core/protocol/Primitives/Scalars.g.cs
Removed entire auto-generated files: DuckDB DDL schema helper (5 constants), 40+ protocol enums with JsonConverter attributes, 80+ immutable data model records (OpenTelemetry-inspired types), and 16 strongly-typed scalar record structs with JSON converters. Total: ~3,764 lines deleted.
OTLP ingestion visibility reduction
src/qyl.collector/Ingestion/OtlpAttributes.cs
Changed 10+ type declarations from public to internal: OtlpGenAiAttributes, GenAiOperationName, GenAiOutputType, GenAiToolType, GenAiTokenType, ErrorType, GenAiEventNames, GenAiMetricNames, OtlpGenAiProviders, SchemaNormalizer, and OTLP DTO classes. Added new internal constants: GenerateContent, Embeddings, CreateAgent, InvokeAgent, ExecuteTool (operations); Image, Speech (outputs); Datastore (tool type); EvaluationResult (events); OperationDuration, ServerTimePerOutputToken, ServerTimeToFirstToken (metrics); UTF8 span properties for providers.
Converter & parser visibility reduction
src/qyl.collector/Ingestion/OtlpConverter.cs, src/qyl.collector/Ingestion/OtlpJsonSpanParser.cs
Changed class visibility from public to internal: OtlpConverter and OtlpJsonSpanParser (ref struct). No functional changes.
Serializer context visibility reduction
src/qyl.collector/Program.cs
Changed QylSerializerContext from public partial class to internal partial class. All existing usages remain within the assembly.
Project configuration update
src/qyl.collector/qyl.collector.csproj
Updated NoWarn configuration to remove VSTHRD111 and clarify NU1510/CA2007 warnings. Added InternalsVisibleTo declaration for qyl.collector.tests to expose internal types to test project.
Test method signature update
tests/qyl.collector.tests/Ingestion/OtlpJsonSpanParserTests.cs
Updated Parse_SpanKind_MapsCorrectly method parameter from SpanKind expected to int expectedKindValue and adjusted assertion to cast result to SpanKind enum. Test data attributes paired with clarifying comments.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main changes: converting OTLP-related types to internal visibility and removing obsolete generated files ('ghost code').

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @ANcpLua, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on improving the internal architecture and maintainability of the qyl.collector project. By restricting the visibility of OTLP-related types, it clarifies the public API surface and encapsulates implementation details. Concurrently, it cleans up the codebase by removing outdated generated files, streamlining the project structure and reducing potential confusion. The changes reinforce modularity and prepare the project for future development with a more robust design.

Highlights

  • Visibility Change for OTLP Types: All OpenTelemetry Protocol (OTLP) implementation types, including Data Transfer Objects (DTOs), parsers, and converters, have been changed to internal visibility. This enforces clean architectural boundaries, ensuring that only qyl.protocol exposes public APIs, while the OTLP ingestion layer remains an internal detail of qyl.collector.
  • Removal of Obsolete Generated Files: Several auto-generated files related to DuckDB schema, enumerations, models, and scalar primitives from the core/ directory have been removed. These files were identified as 'ghost code' and are no longer needed.
  • InternalsVisibleTo for Testing: The qyl.collector.csproj file has been updated to include an InternalsVisibleTo attribute, granting the qyl.collector.tests project access to the newly internalized types. This ensures that internal components can still be thoroughly tested.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

The pull request successfully refactors internal OTLP types to internal visibility and removes obsolete generated files, aligning with the goal of enforcing clean architecture boundaries. The changes to the test project (qyl.collector.csproj and OtlpJsonSpanParserTests.cs) correctly adapt to the visibility changes, ensuring tests continue to function as expected. This is a positive change for code organization and maintainability.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the OTLP ingestion layer to enforce clean architecture boundaries by making all OTLP implementation types internal to qyl.collector, and removes obsolete auto-generated files from the core/ directory that are now replaced by files in src/qyl.protocol/.

Changes:

  • Changed OTLP DTOs, parsers, converters, and enums from public to internal visibility
  • Added InternalsVisibleTo for test project to access internal types
  • Removed obsolete auto-generated files from core/protocol/ (moved to src/qyl.protocol/)
  • Updated test to use integer comparisons instead of enum direct comparisons for SpanKind
  • Improved code comments in project file for clarity

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/qyl.collector.tests/Ingestion/OtlpJsonSpanParserTests.cs Updated test to use integer-based comparison for SpanKind values instead of direct enum references
src/qyl.collector/qyl.collector.csproj Added InternalsVisibleTo for test project, improved comments for NoWarn suppressions, removed unused VSTHRD111 suppression
src/qyl.collector/Program.cs Changed QylSerializerContext from public to internal
src/qyl.collector/Ingestion/OtlpJsonSpanParser.cs Changed from public to internal ref struct
src/qyl.collector/Ingestion/OtlpConverter.cs Changed from public to internal static class
src/qyl.collector/Ingestion/OtlpAttributes.cs Changed all OTLP-related classes and enums from public to internal (8 classes/enums total)
core/protocol/Primitives/Scalars.g.cs Deleted obsolete generated file (now in src/qyl.protocol/)
core/protocol/Models/Types.g.cs Deleted obsolete generated file (now in src/qyl.protocol/)
core/protocol/Enums/Enums.g.cs Deleted obsolete generated file (now in src/qyl.protocol/)
core/collector/Storage/DuckDbSchema.g.cs Deleted obsolete generated file

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@claude

claude Bot commented Jan 23, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@ANcpLua
ANcpLua merged commit 1068334 into main Jan 23, 2026
14 checks passed
@ANcpLua
ANcpLua deleted the refactor/internal-otlp-types branch January 23, 2026 20:28
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