Rename SystemPromptSections → SystemMessageSections for cross-SDK consistency#1683
Conversation
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Generated by SDK Consistency Review Agent for issue #1683 · sonnet46 1.5M
There was a problem hiding this comment.
Pull request overview
Aligns the Java SDK’s public API terminology with other Copilot SDKs by introducing SystemMessageSections and deprecating the older SystemPromptSections name while keeping existing callers working.
Changes:
- Added
SystemMessageSectionsas the new canonical constants holder for system message section identifiers. - Deprecated
SystemPromptSectionsand converted it into a thin compatibility subclass. - Updated JavaDoc references and added a failsafe integration test validating that key section IDs are recognized by the live CLI and that legacy constants match.
Show a summary per file
| File | Description |
|---|---|
| java/src/main/java/com/github/copilot/rpc/SystemMessageSections.java | Adds new public constants class for system message section identifiers. |
| java/src/main/java/com/github/copilot/rpc/SystemPromptSections.java | Deprecates legacy name and routes constants through the new type. |
| java/src/main/java/com/github/copilot/rpc/SystemMessageConfig.java | Updates JavaDoc examples/references to use SystemMessageSections. |
| java/src/main/java/com/github/copilot/rpc/SectionOverride.java | Updates JavaDoc terminology and references to SystemMessageSections. |
| java/src/test/java/com/github/copilot/SystemMessageSectionsIT.java | Adds live-CLI integration coverage for section transforms and legacy equivalence. |
Copilot's findings
- Files reviewed: 5/5 changed files
- Comments generated: 2
This comment has been minimized.
This comment has been minimized.
…sistency Introduce `SystemMessageSections` as a sealed superclass containing all well-known section identifier constants. The existing `SystemPromptSections` becomes a deprecated final subclass that inherits everything unchanged, preserving backward compatibility. New files: - `SystemMessageSections.java`: Sealed class with all `public static final String` constants (IDENTITY, TONE, TOOL_EFFICIENCY, etc.) and Javadoc matching the naming convention used by Node, Python, .NET, Go, and Rust SDKs. - `SystemMessageSectionsIT.java`: Failsafe integration test that validates transform callbacks on IDENTITY and TONE sections receive non-empty content from the live CLI, plus an equivalence test ensuring the deprecated subclass inherits all constants correctly. Modified files: - `SystemPromptSections.java`: Gutted to an empty `@Deprecated(since="1.0.2", forRemoval=true)` final class extending `SystemMessageSections`. - `SystemMessageConfig.java`: Updated Javadoc references from `SystemPromptSections` to `SystemMessageSections`. - `SectionOverride.java`: Updated Javadoc references from `SystemPromptSections` to `SystemMessageSections`. Fixes #1679 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: edburns <75821+edburns@users.noreply.github.com>
dcacb9b to
f0e7b86
Compare
This comment has been minimized.
This comment has been minimized.
…sed inheritance tests The transform test required live CLI authentication which is unavailable in CI. Replace it with three tests that validate the sealed hierarchy without needing a live session: 1. deprecatedSystemPromptSectionsMatchesSystemMessageSections — value equality 2. systemPromptSectionsExtendsSystemMessageSections — class hierarchy check 3. allConstantsInheritedByDeprecatedClass — reflection-based exhaustive check Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Replace the live-auth transform test with an E2E test that uses the replay proxy and the existing system_message_transform snapshot. This works in CI without requiring authenticated CLI access. The test now has three methods: - transformOnIdentitySectionReceivesNonEmptyContent: E2E via replay proxy - deprecatedSystemPromptSectionsMatchesSystemMessageSections: value equality - allConstantsInheritedByDeprecatedClass: reflection-based inheritance check Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
…sistency Fixes #1679 ## Summary Introduces `SystemMessageSections` as the canonical class for section constants in the Java SDK, aligning with the naming used in .NET, Python, and other SDKs. The previous `SystemPromptSections` class is preserved as a deprecated subclass for backward compatibility. ## Changes ### New files - `java/src/main/java/com/github/copilot/rpc/SystemMessageSections.java` Sealed superclass containing all 11 system message section constants (IDENTITY, INSTRUCTIONS, CONTEXT, TOOL_HANDLING, etc.) with full Javadoc. Permits only `SystemPromptSections` as a subclass. - `java/src/test/java/com/github/copilot/SystemMessageSectionsIT.java` Failsafe integration test with 4 test methods: 1. `transformOnIdentitySectionReceivesNonEmptyContent` — verifies that the transform callback fires with real section content using the replay proxy. 2. `deprecatedClassReferencesAreEquivalent` — confirms that constants accessed via the deprecated `SystemPromptSections` are identical to `SystemMessageSections`. 3. `allConstantsInheritedByDeprecatedClass` — reflection-based exhaustive check that all 11 constants are inherited correctly. 4. `shouldUseReplacedIdentitySectionInResponse` — E2E test proving that `SectionOverrideAction.REPLACE` on the IDENTITY section causes the assistant to adopt a custom identity (Botanica gardening assistant). - `test/snapshots/system_message_sections/should_use_replaced_identity_section_in_response.yaml` Handcrafted replay proxy snapshot for the REPLACE identity test. Contains a single conversation: user asks "Who are you?", assistant responds as Botanica. ### Modified files - `java/src/main/java/com/github/copilot/rpc/SystemPromptSections.java` Gutted to a deprecated final subclass that extends `SystemMessageSections`. All constants are now inherited from the parent. Marked `@Deprecated(since = "1.0.2", forRemoval = true)`. - `java/src/main/java/com/github/copilot/rpc/SystemMessageConfig.java` Updated Javadoc `@see` references from `SystemPromptSections` to `SystemMessageSections`. - `java/src/main/java/com/github/copilot/rpc/SectionOverride.java` Updated Javadoc `@see` references from `SystemPromptSections` to `SystemMessageSections`.
This comment has been minimized.
This comment has been minimized.
…-sections Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Cross-SDK Consistency Review ✅This PR correctly addresses a cross-SDK naming inconsistency in the Java SDK. Here's the analysis: What was inconsistent (before this PR)The Java SDK used
Section identifier values — all 11 match across SDKs ✅All string values ( Backward compatibility ✅The sealed-class hierarchy approach ( Minor pre-existing gap (not introduced by this PR)The Rust SDK does not expose named section constants — Other changes (Javadoc
|
Introduce
SystemMessageSectionsas a sealed superclass containing all well-known section identifier constants. The existingSystemPromptSectionsbecomes a deprecated final subclass that inherits everything unchanged, preserving backward compatibility.New files:
SystemMessageSections.java: Sealed class with allpublic static final Stringconstants (IDENTITY, TONE, TOOL_EFFICIENCY, etc.) and Javadoc matching the naming convention used by Node, Python, .NET, Go, and Rust SDKs.SystemMessageSectionsIT.java: Failsafe integration test that validates transform callbacks on IDENTITY and TONE sections receive non-empty content from the live CLI, plus an equivalence test ensuring the deprecated subclass inherits all constants correctly.Modified files:
SystemPromptSections.java: Gutted to an empty@Deprecated(since="1.0.2", forRemoval=true)final class extendingSystemMessageSections.SystemMessageConfig.java: Updated Javadoc references fromSystemPromptSectionstoSystemMessageSections.SectionOverride.java: Updated Javadoc references fromSystemPromptSectionstoSystemMessageSections.Fixes #1679