Skip to content

Rename SystemPromptSections → SystemMessageSections for cross-SDK consistency#1683

Open
edburns wants to merge 3 commits into
mainfrom
edburns/1679-java-consistency-system-message-sections
Open

Rename SystemPromptSections → SystemMessageSections for cross-SDK consistency#1683
edburns wants to merge 3 commits into
mainfrom
edburns/1679-java-consistency-system-message-sections

Conversation

@edburns

@edburns edburns commented Jun 15, 2026

Copy link
Copy Markdown
Collaborator

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

@edburns edburns self-assigned this Jun 15, 2026
@edburns edburns marked this pull request as ready for review June 15, 2026 23:04
@edburns edburns requested a review from a team as a code owner June 15, 2026 23:04
Copilot AI review requested due to automatic review settings June 15, 2026 23:04
@github-actions

This comment has been minimized.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Generated by SDK Consistency Review Agent for issue #1683 · sonnet46 1.5M

* @deprecated Use {@link SystemMessageSections} — this class will be removed in
* a future major version.
* @see SystemMessageSections
* @since 1.2.0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Version annotation inconsistency — the @since 1.2.0 Javadoc tag (kept from the pre-PR class) conflicts with @Deprecated(since = "1.0.2", ...) on line 18. In semver, 1.0.2 < 1.2.0, so the class would appear to be deprecated before it was introduced.

The current Maven version is 1.0.2-SNAPSHOT, and SystemMessageSections is correctly tagged @since 1.0.2, so the @Deprecated(since = "1.0.2") is right. The @since 1.2.0 here was likely a typo in the original SystemPromptSections; it should probably read @since 1.0.2 (or whichever version SystemPromptSections was actually first shipped in).

Suggested fix:

 * `@since` 1.0.2

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 SystemMessageSections as the new canonical constants holder for system message section identifiers.
  • Deprecated SystemPromptSections and 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

Comment thread java/src/main/java/com/github/copilot/rpc/SystemPromptSections.java Outdated
Comment thread java/src/main/java/com/github/copilot/rpc/SystemMessageSections.java Outdated
@github-actions

This comment has been minimized.

edburns and others added 2 commits June 15, 2026 19:43
…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>
@edburns edburns force-pushed the edburns/1679-java-consistency-system-message-sections branch from dcacb9b to f0e7b86 Compare June 15, 2026 23:44
@github-actions

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>
@github-actions

Copy link
Copy Markdown
Contributor

Cross-SDK Consistency Review ✅

This PR correctly aligns the Java SDK naming with the convention used across all other SDK implementations. Here is the cross-SDK comparison:

SDK Section identifier API
Node.js/TypeScript SYSTEM_MESSAGE_SECTIONS constant record + SystemMessageSection type
Python SYSTEM_MESSAGE_SECTIONS dict constant + SystemMessageSection Literal type
Go Package-level Section* constants (SectionIdentity, SectionTone, ...)
.NET SystemMessageSection struct with static properties (SystemMessageSection.Identity, ...)
Java (before PR) SystemPromptSections class — diverged from the SDK naming convention
Java (after PR) SystemMessageSections — now aligned ✅
Rust Raw string literals (pre-existing pattern, no named constants)

All 11 section constants (identity, tone, tool_efficiency, environment_context, code_change_rules, guidelines, safety, tool_instructions, custom_instructions, runtime_instructions, last_instructions) match in value across every SDK.

Findings

  • The rename is correct. Every other SDK uses the "SystemMessage" prefix — the Java SystemPromptSections was the sole outlier.
  • Backward compatibility is handled well via the sealed-class hierarchy and @Deprecated(since="1.0.2", forRemoval=true).
  • Javadoc is consistently updated across SectionOverride.java and SystemMessageConfig.java.
  • The integration test (SystemMessageSectionsIT) provides solid coverage for the constant-inheritance contract.

Optional follow-up (out of scope for this PR)

The Rust SDK uses raw string literals throughout (e.g., "environment_context".to_string()) rather than named constants. Adding a pub mod sections with pub const IDENTITY: &str = "identity"; etc. would give Rust callers the same IDE autocompletion and typo-safety that all other SDKs provide. Not a blocker, just worth tracking.

No cross-SDK inconsistencies introduced by this PR. 🎉

Generated by SDK Consistency Review Agent for issue #1683 · sonnet46 1.5M ·

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.

Java: Consistency: SystemPromptSections → SystemMessageSections

3 participants