Skip to content

Reliability & hardening from multi-agent review (v3.7.24) - #69

Merged
rolling-codes merged 2 commits into
masterfrom
fix/review-high-findings
Sep 26, 2026
Merged

rolling-codes merged 2 commits into
masterfrom
fix/review-high-findings

Conversation

@rolling-codes

Copy link
Copy Markdown
Owner

Summary

A full multi-agent code review of the codebase surfaced five HIGH findings and several MEDIUM ones. This PR fixes all of the HIGH findings plus the testable MEDIUM ones, and cuts release v3.7.24. No new features — reliability, data-integrity, security, and concurrency hardening only.

Tests: 1012 → 1021 passing (+9), 0 failures. Every change was validated with dotnet test before commit.

HIGH findings fixed

  • Install integrity (H1): OpenIvExecutor now writes each extracted file to a temp sibling and commits with an atomic File.Move. Previously an overwrite truncated the existing file in place before the new bytes landed, so a crash/power-loss mid-copy could destroy a valid game file. Adds an overwrite-failure regression test.
  • Silent data loss (H4/H5): ChangeHistoryService now persists via the atomic, logged JsonFileStore instead of a bare catch {} that discarded the audit trail; entry list is lock-guarded with a Lazy singleton.
  • Job queue race (H3): all JobEntry state access is serialized and /jobs/{id} readers get a detached snapshot, so they can never observe torn state (e.g. State=Completed before ResultJson is visible).
  • Info leak (H2): new ApiErrors.Problem helper; 21 handlers across 10 endpoint files no longer return ex.Message (absolute %APPDATA%/GTA paths). The exception is logged server-side with a correlation id; the client gets a generic message.
  • Profiles: corrupt profile files are logged and skipped instead of silently dropped, stock defaults are never seeded over unparseable user data, and writes are atomic.

MEDIUM findings fixed

  • Safe-mode restore containment: new PathContainment.IsWithin helper; restore verifies each manifest path resolves inside the GTA V root before moving it, so a tampered/corrupt manifest can't touch arbitrary locations. New PathContainmentTests.
  • OpenIvExecutor O(n²)→O(n): one-time key→entry archive lookup instead of re-enumerating per operation; also avoids re-opening entries out of order on non-seekable streams.
  • RestorePointService: Lazy singleton + lock-guarded snapshot reads/writes, closing a torn-read race.

Release v3.7.24

  • Bumped Version/AssemblyVersion/FileVersion in both csproj.
  • Updated version assertions (VersionAndBrowseGuardTests, SetupWizardTests).
  • Added RELEASE_v3.7.24.md and a new CHANGELOG.md.

Not in this PR (deliberately deferred)

BackupScheduler locking, god-method/file refactors (SetupDoctorService.RunAsync, InstallViewModel), install CancellationToken, and the DateTime.Now→UtcNow sweep. Real but each is its own change; bounded to what could be fully tested here.

Test plan

  • dotnet test — 1021/1021 pass
  • Clean build
  • Manual smoke of OIV install over an existing file (reviewer)

Multi-agent review surfaced five HIGH findings; this fixes all of them.
All 1013 tests pass.

- OpenIvExecutor (H1): write to a temp sibling then atomic File.Move on
  overwrite, so a failed or interrupted copy never truncates an existing
  game file in place. Adds an overwrite-failure regression test proving the
  original survives and no .tmp is left behind.
- ChangeHistoryService (H4/H5): persist via JsonFileStore (logged, atomic
  temp-write) instead of a bare catch{} that silently lost the audit trail;
  guard the entry list with a lock and a Lazy singleton; Entries now returns
  a snapshot. No more swallowed saves or torn cross-thread reads.
- ProfileManager: log skipped corrupt profiles instead of dropping them
  silently, never seed stock defaults over unparseable user data, and write
  profiles atomically through JsonFileStore.
- JobQueue (H3): serialize all job-state access under a lock and hand the
  /jobs/{id} poller a detached snapshot, so it can never observe torn state
  (e.g. State=Completed before ResultJson is visible).
- LocalApi (H2): add ApiErrors.Problem helper and route 21 catch handlers
  through it, so exception text (absolute file paths) is logged server-side
  with a correlation id rather than leaked to the client.
Second review pass: closes the remaining testable MEDIUM findings and cuts
release 3.7.24. All 1021 tests pass (+8 new).

- SafeModeEndpoints: contain restore to the GTA V root via new
  PathContainment.IsWithin helper, so a tampered/corrupt safe-mode manifest
  cannot move files to/from arbitrary locations. Adds PathContainmentTests
  (inside/sibling-prefix/traversal/null cases).
- OpenIvExecutor: build a one-time key->entry archive lookup instead of
  re-enumerating per operation (O(n^2) -> O(n)); also avoids re-opening
  entries out of order on non-seekable streams.
- RestorePointService: Lazy singleton + lock-guarded snapshot reads/writes,
  closing the torn-read race between UI and background saves.
- Release 3.7.24: bump Version/AssemblyVersion/FileVersion in both csproj,
  update version assertions (VersionAndBrowseGuardTests, SetupWizardTests),
  add RELEASE_v3.7.24.md and a new CHANGELOG.md.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Important

  • Pull request is closed - (🔄 Check again to try again)

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: dcbd5b74-1965-47d7-9c33-cc4d299899d1


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@rolling-codes
rolling-codes merged commit 449ef71 into master Sep 26, 2026
2 checks passed
@augmentcode

augmentcode Bot commented Sep 26, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This reliability release bumps the application and shared-library versions to v3.7.24.

Changes:

  • Introduces centralized API error responses that log exceptions with correlation IDs.
  • Updates affected API handlers to avoid returning exception messages directly.
  • Adds lexical GTA-root containment before safe-mode manifest restore moves.
  • Serializes job queue mutations and returns detached job snapshots to pollers.
  • Changes OIV extraction to build an archive-entry lookup and stage copies in sibling temp files.
  • Migrates change-history persistence to JsonFileStore with snapshot reads.
  • Adds locking and snapshot persistence around restore-point collection updates.
  • Logs corrupt profiles, avoids reseeding over existing invalid files, and uses atomic profile saves.
  • Adds regression coverage for failed OIV overwrites and path-containment behavior.
  • Adds release notes/changelog entries and updates version assertions.
Technical note: The PR focuses on reliability, persistence integrity, local API error handling, and safe-mode restore containment rather than new product features.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 5 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

Comment thread LSPDFRManager.Shared/Services/PathContainment.cs
Comment thread LSPDFRManager.Shared/Services/ChangeHistoryService.cs
Comment thread LSPDFRManager.Shared/Services/RestorePointService.cs
Comment thread LSPDFRManager.Tests/OpenIvExecutorIntegrationTests.cs
Comment thread CHANGELOG.md

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0440c19a1d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread LSPDFRManager.LocalApi/ApiErrors.cs
Comment thread LSPDFRManager.Shared/Services/ChangeHistoryService.cs
Comment thread LSPDFRManager.Shared/Services/RestorePointService.cs
@rolling-codes
rolling-codes deleted the fix/review-high-findings branch September 27, 2026 01:41
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.

2 participants