Skip to content

Conversation

@chris-freeman-glean
Copy link
Contributor

Summary

Fixes the daily CI Generate workflow failures that started after #66 was merged.

Problem

PR #66 added custom fields (excludeDeprecatedAfter, includeExperimental) to SDKConfiguration.java and Glean.java. However, these files are auto-generated by Speakeasy and marked "DO NOT EDIT". When the SDK regenerates, these custom fields are removed, but XGleanHeadersHook.java (in the preserved hooks/ package) still references them:

error: cannot find symbol - config.excludeDeprecatedAfter()
error: cannot find symbol - config.includeExperimental()

Solution

Move the custom configuration to a dedicated class in the preserved hooks/ package:

  • GleanCustomConfig.java - Thread-safe singleton storing custom config values
  • GleanBuilder.java - Builder wrapper that delegates to Glean.Builder but adds excludeDeprecatedAfter() and includeExperimental() methods that write to the singleton
  • XGleanHeadersHook.java - Updated to read from GleanCustomConfig instead of SDKConfiguration

Users now use GleanBuilder.create() instead of Glean.builder() when they need the custom options:

import com.glean.api_client.glean_api_client.hooks.GleanBuilder;

Glean glean = GleanBuilder.create()
        .apiToken("token")
        .instance("instance-name")
        .excludeDeprecatedAfter("2026-10-15")
        .includeExperimental(true)
        .build();

Environment variables continue to work unchanged.

Test plan

  • ./gradlew build passes
  • ./gradlew test --tests "XGleanHeadersHookTest" passes
  • Verified fix survives speakeasy run regeneration

The custom fields added to SDKConfiguration in #66 are removed when
Speakeasy regenerates the SDK, breaking the build. This moves the
configuration to a dedicated GleanCustomConfig singleton in the
preserved hooks/ package.

Changes:
- Add GleanCustomConfig singleton for custom configuration storage
- Add GleanBuilder wrapper with excludeDeprecatedAfter/includeExperimental methods
- Update XGleanHeadersHook to read from GleanCustomConfig instead of SDKConfiguration
- Update tests to use GleanCustomConfig
- Update README to document GleanBuilder usage
@chris-freeman-glean chris-freeman-glean marked this pull request as ready for review February 3, 2026 17:34
@chris-freeman-glean chris-freeman-glean requested a review from a team as a code owner February 3, 2026 17:34
Avoid global singleton state by mapping custom config to SDKConfiguration via a WeakHashMap registry, and restore compatibility by reading SDKConfiguration values via reflection when present.
@chris-freeman-glean chris-freeman-glean merged commit 8732446 into main Feb 3, 2026
@chris-freeman-glean chris-freeman-glean deleted the cfreeman/fix-ci-xglean-headers-regeneration branch February 3, 2026 17:58
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