Skip to content

fix: Add path prefix presence flag and tests for AppFileInfo - #386

Merged
LossyDragon merged 3 commits into
Longi94:masterfrom
anxinxu:master
May 8, 2026
Merged

fix: Add path prefix presence flag and tests for AppFileInfo#386
LossyDragon merged 3 commits into
Longi94:masterfrom
anxinxu:master

Conversation

@anxinxu

@anxinxuanxinxu commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Description

This PR improves AppFileInfo handling for path_prefix_index presence semantics while preserving backward compatibility.

  • Added hasPathPrefixIndex to AppFileInfo so callers can explicitly distinguish whether path_prefix_index is present in the protobuf payload.
  • Kept pathPrefixIndex as Int to avoid breaking existing callers that rely on the previous API shape.
  • Added focused unit tests to cover both key cases:
    • path_prefix_index is absent -> hasPathPrefixIndex == false
    • path_prefix_index is present and equals 0 -> hasPathPrefixIndex == true and pathPrefixIndex == 0

Checklist

  • Code compiles correctly
  • All tests passing
  • Samples run successfully
  • Extended the README / documentation, if necessary

@anxinxu

Copy link
Copy Markdown
ContributorAuthor

@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!

@LossyDragonLossyDragon left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Mind changing the test class to Java? I try to keep the tests in Java (for now) to ensure Java/Kotlin compatibility.

packagein.dragonbra.javasteam.steam.handlers.steamcloud;
importin.dragonbra.javasteam.protobufs.steamclient.SteammessagesCloudSteamclient;
importorg.junit.jupiter.api.Assertions;
importorg.junit.jupiter.api.Test;
publicclassAppFileInfoTest {
@TestpublicvoidhasPathPrefixIndexIsFalseWhenFieldIsMissing() {
varresponse = SteammessagesCloudSteamclient.CCloud_AppFileInfo.newBuilder()
.setFileName("save.dat")
.build();
varinfo = newAppFileInfo(response);
Assertions.assertFalse(info.getHasPathPrefixIndex());
}
@TestpublicvoidhasPathPrefixIndexIsTrueWhenIndexIsZero() {
varresponse = SteammessagesCloudSteamclient.CCloud_AppFileInfo.newBuilder()
.setFileName("save.dat")
.setPathPrefixIndex(0)
.build();
varinfo = newAppFileInfo(response);
Assertions.assertTrue(info.getHasPathPrefixIndex());
Assertions.assertEquals(0, info.getPathPrefixIndex());
}
}

@anxinxuanxinxu closed this May 8, 2026
@anxinxuanxinxu reopened this May 8, 2026
@anxinxu

Copy link
Copy Markdown
ContributorAuthor

@LossyDragon Done

@LossyDragon
LossyDragon merged commit bc54e77 into Longi94:masterMay 8, 2026
2 checks passed
@LossyDragon

Copy link
Copy Markdown
Collaborator

Thanks!

Sign up for freeto 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

@anxinxu@LossyDragon