fix: Add path prefix presence flag and tests for AppFileInfo#386
Open
anxinxu wants to merge 2 commits intoLongi94:masterfrom
Open
fix: Add path prefix presence flag and tests for AppFileInfo#386anxinxu wants to merge 2 commits intoLongi94:masterfrom
anxinxu wants to merge 2 commits intoLongi94:masterfrom
Conversation
Contributor
Author
|
@LossyDragon Could you please review this PR? It adds a backward-compatible presence flag for pathPrefixIndex in AppFileInfo and includes tests for both missing and zero-index cases. Thanks! |
LossyDragon
requested changes
Apr 29, 2026
Collaborator
LossyDragon
left a comment
There was a problem hiding this comment.
Mind changing the test class to Java? I try to keep the tests in Java (for now) to ensure Java/Kotlin compatibility.
package in.dragonbra.javasteam.steam.handlers.steamcloud;
import in.dragonbra.javasteam.protobufs.steamclient.SteammessagesCloudSteamclient;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
public class AppFileInfoTest {
@Test
public void hasPathPrefixIndexIsFalseWhenFieldIsMissing() {
var response = SteammessagesCloudSteamclient.CCloud_AppFileInfo.newBuilder()
.setFileName("save.dat")
.build();
var info = new AppFileInfo(response);
Assertions.assertFalse(info.getHasPathPrefixIndex());
}
@Test
public void hasPathPrefixIndexIsTrueWhenIndexIsZero() {
var response = SteammessagesCloudSteamclient.CCloud_AppFileInfo.newBuilder()
.setFileName("save.dat")
.setPathPrefixIndex(0)
.build();
var info = new AppFileInfo(response);
Assertions.assertTrue(info.getHasPathPrefixIndex());
Assertions.assertEquals(0, info.getPathPrefixIndex());
}
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR improves
AppFileInfohandling forpath_prefix_indexpresence semantics while preserving backward compatibility.hasPathPrefixIndextoAppFileInfoso callers can explicitly distinguish whetherpath_prefix_indexis present in the protobuf payload.pathPrefixIndexasIntto avoid breaking existing callers that rely on the previous API shape.path_prefix_indexis absent ->hasPathPrefixIndex == falsepath_prefix_indexis present and equals0->hasPathPrefixIndex == trueandpathPrefixIndex == 0Checklist