From e359852ccf7fa64b3d492c868536819d539529fe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 15:47:13 +0000 Subject: [PATCH 2/7] Wrap SaveBuffs delete+replace in a transaction to prevent buff wipe on insert failure Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com> --- zone/zonedb.cpp | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 91c466d20..8ff5277b7 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2877,14 +2877,6 @@ void ZoneDatabase::UpdateAltCurrencyValue(uint32 char_id, uint32 currency_id, ui void ZoneDatabase::SaveBuffs(Client *client) { - CharacterBuffsRepository::DeleteWhere( - database, - fmt::format( - "`character_id` = {}", - client->CharacterID() - ) - ); - auto buffs = client->GetBuffs(); const int max_buff_slots = client->GetMaxBuffSlots(); @@ -2933,9 +2925,20 @@ void ZoneDatabase::SaveBuffs(Client *client) v.emplace_back(e); } + database.TransactionBegin(); + + CharacterBuffsRepository::DeleteWhere( + database, + fmt::format( + "`character_id` = {}", + client->CharacterID() + ) + ); + if (!v.empty()) { const auto saved_count = CharacterBuffsRepository::ReplaceMany(database, v); if (saved_count != static_cast(v.size())) { + database.TransactionRollback(); LogError( "Failed to save all buffs for character [{}] [{}]. Expected [{}] rows, saved [{}]. Verify the `character_buffs` schema is up to date.", client->GetCleanName(), @@ -2943,8 +2946,11 @@ void ZoneDatabase::SaveBuffs(Client *client) v.size(), saved_count ); + return; } } + + database.TransactionCommit(); } void ZoneDatabase::LoadBuffs(Client *client) From 6290ef42c6d0ef39158fc5526fae1f74ca3d8663 Mon Sep 17 00:00:00 2001 From: Vayle <76063792+Valorith@users.noreply.github.com> Date: Sun, 8 Mar 2026 12:22:30 -0400 Subject: [PATCH 3/7] Update zone/zonedb.cpp Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- zone/zonedb.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 8ff5277b7..40baef1c7 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2950,7 +2950,15 @@ void ZoneDatabase::SaveBuffs(Client *client) } } - database.TransactionCommit(); + const auto commit_result = database.TransactionCommit(); + if (!commit_result) { + database.TransactionRollback(); + LogError( + "Failed to commit buff save transaction for character [{}] [{}].", + client->GetCleanName(), + client->CharacterID() + ); + } } void ZoneDatabase::LoadBuffs(Client *client) From bd92f19869312cc4134a3c7d5eb8043671c53571 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 17:25:35 +0000 Subject: [PATCH 4/7] Fix build error: use fully-qualified EQ::versions::ClientVersion::RoF2; use < for REPLACE row count check Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com> --- zone/cli/tests/cli_zone_state.cpp | 2 +- zone/zonedb.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/zone/cli/tests/cli_zone_state.cpp b/zone/cli/tests/cli_zone_state.cpp index f3c0833e6..1eb391a81 100644 --- a/zone/cli/tests/cli_zone_state.cpp +++ b/zone/cli/tests/cli_zone_state.cpp @@ -895,7 +895,7 @@ inline void TestClientBuffPersistence() Client loader; loader.SetCharacterId(test_character_id); loader.SetName("buff-persistence-load"); - loader.SetClientVersion(ClientVersion::RoF2); + loader.SetClientVersion(EQ::versions::ClientVersion::RoF2); database.LoadBuffs(&loader); auto loaded_buffs = loader.GetBuffs(); diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 40baef1c7..5cac91b4c 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2937,7 +2937,7 @@ void ZoneDatabase::SaveBuffs(Client *client) if (!v.empty()) { const auto saved_count = CharacterBuffsRepository::ReplaceMany(database, v); - if (saved_count != static_cast(v.size())) { + if (saved_count < static_cast(v.size())) { database.TransactionRollback(); LogError( "Failed to save all buffs for character [{}] [{}]. Expected [{}] rows, saved [{}]. Verify the `character_buffs` schema is up to date.", From 2e62fb37bf4c7d489e7683372132424548a480f3 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 17:56:47 +0000 Subject: [PATCH 5/7] Fix zonedb.cpp: use commit_result.Success() instead of !commit_result for MySQLRequestResult Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com> --- zone/zonedb.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 5cac91b4c..9f0fa0033 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2951,12 +2951,13 @@ void ZoneDatabase::SaveBuffs(Client *client) } const auto commit_result = database.TransactionCommit(); - if (!commit_result) { + if (!commit_result.Success()) { database.TransactionRollback(); LogError( - "Failed to commit buff save transaction for character [{}] [{}].", + "Failed to commit buff save transaction for character [{}] [{}]: {}", client->GetCleanName(), - client->CharacterID() + client->CharacterID(), + commit_result.ErrorMessage() ); } } From fcd03df1f86ed5146c76737afdbc1d45cb5197a5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 18:50:43 +0000 Subject: [PATCH 6/7] Resolve conflicts: adopt base branch error message wording in SaveBuffs Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com> --- zone/zonedb.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zone/zonedb.cpp b/zone/zonedb.cpp index 9f0fa0033..61229916c 100644 --- a/zone/zonedb.cpp +++ b/zone/zonedb.cpp @@ -2940,7 +2940,7 @@ void ZoneDatabase::SaveBuffs(Client *client) if (saved_count < static_cast(v.size())) { database.TransactionRollback(); LogError( - "Failed to save all buffs for character [{}] [{}]. Expected [{}] rows, saved [{}]. Verify the `character_buffs` schema is up to date.", + "Failed to save all buffs for character [{}] [{}]. Expected at least [{}] rows saved, got [{}]. Verify the `character_buffs` schema is up to date.", client->GetCleanName(), client->CharacterID(), v.size(), From ad52a2f73956de965fa4d5b13a651b28d1863b87 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 8 Mar 2026 19:12:31 +0000 Subject: [PATCH 7/7] Merge base branch: resolve zone/zonedb.cpp conflict by keeping transaction rollback Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com> --- .github/workflows/build.yaml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7ad7003ef..bc5246131 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -52,6 +52,33 @@ jobs: - name: Mark workspace safe run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + - name: Cache vcpkg downloads + uses: actions/cache@v4 + with: + path: submodules/vcpkg/downloads + key: ${{ runner.os }}-vcpkg-downloads-${{ hashFiles('submodules/vcpkg/vcpkg.json', 'submodules/vcpkg/ports/**', 'submodules/vcpkg/versions/**') }} + restore-keys: | + ${{ runner.os }}-vcpkg-downloads- + + - name: vcpkg install (retry) + working-directory: ${{ github.workspace }} + run: | + set -e + cd submodules/vcpkg + ./bootstrap-vcpkg.sh -disableMetrics + + for i in 1 2 3 4 5; do + echo "vcpkg install attempt $i..." + if ./vcpkg install --triplet x64-linux; then + exit 0 + fi + echo "vcpkg install failed; sleeping before retry..." + sleep $((i * 10)) + done + + echo "vcpkg install failed after retries" + exit 1 + - name: Build working-directory: ${{ github.workspace }} run: |