Skip to content

Commit a430e53

Browse files
authored
Java: adr recording decision to keep everything in one module (#1588)
* Java: adr recording decision to keep everything in one module * ci: skip java-kotlin CodeQL for docs/txt/md-only changes * ci: skip sdk-consistency-review for java docs/txt/md-only changes
1 parent d3efcb0 commit a430e53

4 files changed

Lines changed: 57 additions & 13 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ jobs:
3232
filters: |
3333
java:
3434
- 'java/**'
35+
- '!java/docs/**'
36+
- '!java/*.txt'
37+
- '!java/*.md'
3538
js:
3639
- 'nodejs/**'
3740
- 'scripts/**'

.github/workflows/sdk-consistency-review.lock.yml

Lines changed: 16 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/sdk-consistency-review.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
- 'go/**'
1212
- 'dotnet/**'
1313
- 'java/**'
14+
- '!java/docs/**'
15+
- '!java/*.txt'
16+
- '!java/*.md'
1417
workflow_dispatch:
1518
inputs:
1619
pr_number:
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Sub-module for generated code
2+
3+
## Context and Problem Statement
4+
5+
Regarding the goal of more effectively passing on the stability and deprecation metadata from the `@github/copilot` Zod schema to end consumers of `copilot-sdk-java`, Partner Software Engineer Stephen Toub stated, "The ideal is to do the best each language has to offer."
6+
7+
## Considered Options
8+
9+
* Status quo: keep generated code in the same `copilot-sdk-java` module.
10+
11+
* Option 1: Move all generated code (both `com.github.copilot.generated` and `com.github.copilot.generated.rpc`) to a single internal Maven module (`copilot-sdk-generated`), bundled back into the published `copilot-sdk-java` artifact via `maven-dependency-plugin`.
12+
13+
* Option 2: Move generated code into two internal Maven modules (`copilot-sdk-events` for session-event types, `copilot-sdk-rpc-generated` for RPC types), bundled back into the published artifact.
14+
15+
### Analysis
16+
17+
The generated code is deeply embedded in the public API surface of `copilot-sdk-java`: `CopilotSession.getRpc()` returns `SessionRpc`, `CopilotClient.getRpc()` returns `ServerRpc`, `sendAndWait()` returns `AssistantMessageEvent`, and the event handler API accepts all generated event subclasses. Approximately 730 of 914 generated classes are part of the externally-visible API. Any module split is therefore a build-time concern only — it cannot reduce the consumer-facing footprint.
18+
19+
The dependency direction is clean (hand-written → generated, never reverse), making a split technically feasible without circular dependencies.
20+
21+
However, the specific goal of conveying stability/deprecation metadata requires a `@CopilotExperimental` annotation visible at compile time to both the generated and hand-written code. In the status quo, this annotation lives in `src/main/java/` and is freely importable by `src/generated/java/` since they compile together. In a split-module reactor, the generated module compiles *before* the hand-written module, so the annotation must either be emitted by the codegen script as another generated file, or extracted into a third annotations-only module. Both add complexity without advancing the stability-metadata goal.
22+
23+
Module separation is orthogonal to — and slightly complicates — the stability/deprecation work. The codegen script changes to read and propagate `stability`/`deprecated` from schema nodes are identical regardless of module structure.
24+
25+
## Decision Outcome
26+
27+
Keep the status quo: keep the generated code in the same `copilot-sdk-java` module.
28+
29+
The primary benefit of module separation (compile-time isolation, cleaner PR diffs) does not justify the added reactor complexity, `maven-dependency-plugin` configuration, and annotation-placement constraints — particularly given that the immediate priority is implementing stability/deprecation metadata propagation, which is simpler in a single-module build.
30+
31+
## Related work items
32+
33+
- https://devdiv.visualstudio.com/DevDiv/_workitems/edit/3013416
34+
35+
- https://github.com/github/copilot-sdk/issues/1573

0 commit comments

Comments
 (0)