Skip to content

fix(security): remove client-side UploadThing credentials - #300

Open
bobtista wants to merge 2 commits into
developmentfrom
fix/disable-uploadthing-uploads
Open

fix(security): remove client-side UploadThing credentials#300
bobtista wants to merge 2 commits into
developmentfrom
fix/disable-uploadthing-uploads

Conversation

@bobtista

@bobtista bobtista commented Jul 27, 2026

Copy link
Copy Markdown

Summary

Remove the legacy UploadThing credential flow and disable authenticated uploads and deletion. Existing public-link imports remain available.

Changes

  • Remove CI credential injection and client decoding.
  • Fail closed and disable map/replay upload controls.
  • Make history removal local-only.
  • Add regression tests and update developer documentation.

Testing

  • git diff --check origin/development
  • Workflow YAML and modified AXAML parsing
  • Documentation build reaches an unrelated existing error in docs/features/manifest.md:497
  • .NET unavailable locally; CI must validate Windows/Linux builds and tests

Risks and rollback

Cloud upload and deletion remain unavailable until secure authorization is implemented. Public-link imports are unaffected.

Related issues

Closes #298

Related: #233, #238

Greptile Summary

This follow-up completes the secure removal of the legacy UploadThing credential flow.

  • Disables authenticated cloud uploads and deletions while preserving public-link imports.
  • Removes credential injection from CI and release builds.
  • Makes upload-history removal local-only and migrates legacy pending-deletion records.
  • Disables map and replay upload controls and adds regression coverage and documentation.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
GenHub/GenHub/Features/Tools/Services/UploadHistoryService.cs Legacy pending-deletion records are now deserialized, filtered before history or quota projection, and removed from persisted history.
GenHub/GenHub.Core/Models/Tools/UploadRecord.cs Retains the legacy pending-deletion field for migration while omitting its default value from newly written records.
GenHub/GenHub/Features/Tools/Services/UploadThingService.cs Replaces credential-bearing upload and deletion operations with fail-closed implementations.
GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Tools/Services/UploadHistoryServiceTests.cs Adds regression coverage proving legacy pending-deletion records remain hidden and are removed from persisted history.
.github/workflows/ci.yml Removes UploadThing secret injection from Windows and Linux CI builds.
.github/workflows/release.yml Removes UploadThing secret injection from release artifacts.

Reviews (2): Last reviewed commit: "fix(tools): migrate upload history and r..." | Re-trigger Greptile

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Cloud UploadThing credential injection and client-side upload/delete flows were removed. Upload controls are disabled, upload history changes are local-only, public-link imports remain supported, and tests and documentation describe the fail-closed behavior.

Changes

UploadThing security shutdown

Layer / File(s) Summary
Credential pipeline and contracts
.github/workflows/*, GenHub/GenHub.Core/Constants/*, docs/dev/*
CI token injection, client-side credential constants, obsolete messages, and active UploadThing documentation were removed or updated.
Disabled UploadThing service
GenHub/GenHub/Features/Tools/Services/UploadThingService.cs, GenHub/GenHub.Tests/.../UploadThingServiceTests.cs
Upload and delete now log warnings and return null or false without network requests; tests verify both outcomes.
Local-only upload history
GenHub/GenHub/Features/Tools/Services/UploadHistoryService.cs, GenHub/GenHub.Core/..., GenHub/GenHub.Tests/.../UploadHistoryServiceTests.cs
Pending deletion and remote deletion were removed; history removal and clearing now persist local changes only, with persistence tests.
Disabled UI actions and notifications
GenHub/GenHub/Features/Tools/MapManager/*, GenHub/GenHub/Features/Tools/ReplayManager/*
Map and replay cloud-upload buttons are disabled, and notifications state that hosted files are not deleted.

Estimated code review effort: 4 (Complex) | ~45 minutes

Poem

I’m a rabbit who guards every secret byte,
No cloud upload hops into flight tonight.
Local history clears with a soft little thump,
Public links remain for a curious jump.
Tests watch the gates, and the docs say why—
Safe little paws beneath the sky.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy #298 by removing credential injection, disabling upload/delete, preserving imports, localizing history removal, and adding tests/docs.
Out of Scope Changes check ✅ Passed The diff stays within the stated security cleanup and supporting tests/docs, with no obvious unrelated changes.
Docstring Coverage ✅ Passed Docstring coverage is 66.67% which is sufficient. The required threshold is 50.00%.
Title check ✅ Passed The title follows conventional commit format and accurately summarizes the removal of client-side UploadThing credentials.
Description check ✅ Passed The description is clearly related to the changeset and summarizes the credential removal, disabled uploads, tests, and docs updates.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/disable-uploadthing-uploads

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.

Comment thread GenHub/GenHub/Features/Tools/Services/UploadHistoryService.cs

/// <summary>
/// Removes a history item.
/// Removes an item from local history without deleting the hosted file.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

WARNING: Missing parameter validation

The RemoveHistoryItemAsync method accepts a string url parameter but doesn't validate that the URL is not null or empty. This could cause issues if called with invalid input.

Suggested change
/// Removes an item from local history without deleting the hosted file.
Task RemoveHistoryItemAsync(string url);

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Keeping this unchanged. The parameter is non-nullable, and the implementation’s equality check safely treats null or empty input as a no-op. The suggested interface change is identical and adds no runtime validation.

<StackPanel Orientation="Horizontal" Spacing="0">
<Button Command="{Binding UploadAndShareCommand}"
Classes="Primary" IsEnabled="{Binding SelectedMaps.Count}"
Classes="Primary" IsEnabled="False"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Consider binding IsEnabled to a property instead of hardcoded value

Hardcoding IsEnabled="False" bypasses MVVM command-binding patterns. Consider binding to a ViewModel property like IsUploadEnabled so the state can be managed centrally and the button can be re-enabled programmatically when short-lived credentials are implemented.

Suggested change
Classes="Primary" IsEnabled="False"
Classes="Primary" IsEnabled="{Binding IsUploadEnabled}"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Keeping the hardcoded disabled state intentionally. This is a fail-closed security switch; re-enabling uploads should require an explicit code change alongside the future authorization implementation, rather than a mutable ViewModel property.

<StackPanel Orientation="Horizontal" Spacing="0">
<Button Command="{Binding UploadAndShareCommand}"
Classes="Primary" IsEnabled="{Binding SelectedReplays.Count}"
Classes="Primary" IsEnabled="False"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

SUGGESTION: Consider binding IsEnabled to a property instead of hardcoded value

Hardcoding IsEnabled="False" bypasses MVVM command-binding patterns. Consider binding to a ViewModel property like IsUploadEnabled so the state can be managed centrally and the button can be re-enabled programmatically when short-lived credentials are implemented.

Suggested change
Classes="Primary" IsEnabled="False"
Classes="Primary" IsEnabled="{Binding IsUploadEnabled}"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Keeping the hardcoded disabled state intentionally. This is a fail-closed security switch; re-enabling uploads should require an explicit code change alongside the future authorization implementation, rather than a mutable ViewModel property.

@kilo-code-bot

kilo-code-bot Bot commented Jul 27, 2026

Copy link
Copy Markdown

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 1
Issue Details (click to expand)

WARNING

File Line Issue
GenHub/GenHub.Core/Interfaces/Common/IUploadHistoryService.cs 45 Missing parameter validation for URL parameter

SUGGESTION

File Line Issue
GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Tools/Services/UploadHistoryServiceTests.cs 68 Add coverage for partial removal and no-op edge cases
Resolved Issues (click to expand)

The following issues from the previous review have been resolved in this commit:

  • CRITICAL: Pending records reappear as uploads (UploadHistoryService.cs:106) - Migration logic now properly filters out legacy IsPendingDeletion records and saves cleaned history to disk.
  • SUGGESTION: Hardcoded IsEnabled should use MVVM binding pattern (MapManagerView.axaml:192) - Obsolete due to removal of "(max 10MB per file)" text.
  • SUGGESTION: Hardcoded IsEnabled should use MVVM binding pattern (ReplayManagerView.axaml:170) - Obsolete due to removal of "(max 10MB per file)" text.
Files Reviewed (18 files)
  • .github/scripts/inject-token.ps1 - DELETED (security improvement)
  • .github/workflows/ci.yml - Removed credential injection
  • .github/workflows/release.yml - Removed credential injection
  • GenHub/GenHub.Core/Constants/ApiConstants.cs - Removed UploadThing constants
  • GenHub/GenHub.Core/Constants/ErrorMessages.cs - Removed UploadThing errors
  • GenHub/GenHub.Core/Constants/LogMessages.cs - Removed UploadThing logs
  • GenHub/GenHub.Core/Interfaces/Common/IUploadHistoryService.cs - 1 issue
  • GenHub/GenHub.Core/Models/Tools/UploadRecord.cs - Added migration support for IsPendingDeletion
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Tools/Services/UploadHistoryServiceTests.cs - 1 issue + good migration test
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Tools/Services/UploadThingServiceTests.cs - Good fail-closed tests
  • GenHub/GenHub/Features/Tools/MapManager/ViewModels/MapManagerViewModel.cs - Updated user messages
  • GenHub/GenHub/Features/Tools/MapManager/Views/MapManagerView.axaml - Removed stale UI text
  • GenHub/GenHub/Features/Tools/ReplayManager/ViewModels/ReplayManagerViewModel.cs - Updated user messages
  • GenHub/GenHub/Features/Tools/ReplayManager/Views/ReplayManagerView.axaml - Removed stale UI text
  • GenHub/GenHub/Features/Tools/Services/UploadHistoryService.cs - Added proper migration logic
  • GenHub/GenHub/Features/Tools/Services/UploadThingService.cs - Fail-closed implementation
  • docs/dev/constants.md - Updated documentation
  • docs/dev/uploading-api.md - Updated documentation

Security Assessment

Overall: ✅ Good security improvements with migration fix

This PR effectively removes the reversible XOR obfuscation of UploadThing credentials from the build pipeline and desktop binaries. The fail-closed approach for UploadThingService is appropriate. The addition of regression tests is excellent.

Migration Fix: The pending deletion records issue has been properly resolved. Legacy isPendingDeletion records are now filtered out during migration and the cleaned history is persisted to disk, preventing old records from reappearing.

Note: Repository owners should revoke and rotate the exposed UploadThing token as mentioned in the documentation.

Positive Observations

  • Comprehensive removal of credential injection pipeline
  • Fail-closed service implementation pattern
  • Good test coverage for disabled functionality
  • Clear documentation of security status
  • Appropriate fail-closed UI behavior
  • Well-documented requirements for re-enabling uploads
  • Proper migration logic for legacy pending deletion records
  • Thread-safe migration implementation with file locking
  • Backward compatible migration using JsonIgnore attribute

Fix these issues in Kilo Cloud

Previous Review Summary (commit c69a6cc)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit c69a6cc)

Status: 3 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 2
Issue Details (click to expand)

WARNING

File Line Issue
GenHub/GenHub.Core/Interfaces/Common/IUploadHistoryService.cs 45 Missing parameter validation for URL parameter

SUGGESTION

File Line Issue
GenHub/GenHub/Features/Tools/MapManager/Views/MapManagerView.axaml 192 Hardcoded IsEnabled should use MVVM binding pattern
GenHub/GenHub/Features/Tools/ReplayManager/Views/ReplayManagerView.axaml 170 Hardcoded IsEnabled should use MVVM binding pattern
Files Reviewed (18 files)
  • .github/scripts/inject-token.ps1 - DELETED (security improvement)
  • .github/workflows/ci.yml - Removed credential injection
  • .github/workflows/release.yml - Removed credential injection
  • GenHub/GenHub.Core/Constants/ApiConstants.cs - Removed UploadThing constants
  • GenHub/GenHub.Core/Constants/ErrorMessages.cs - Removed UploadThing errors
  • GenHub/GenHub.Core/Constants/LogMessages.cs - Removed UploadThing logs
  • GenHub/GenHub.Core/Interfaces/Common/IUploadHistoryService.cs - 1 issue
  • GenHub/GenHub.Core/Models/Tools/UploadRecord.cs - Removed IsPendingDeletion property
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Tools/Services/UploadHistoryServiceTests.cs - NEW (good tests)
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Tools/Services/UploadThingServiceTests.cs - NEW (good tests)
  • GenHub/GenHub/Features/Tools/MapManager/ViewModels/MapManagerViewModel.cs - Updated user messages
  • GenHub/GenHub/Features/Tools/MapManager/Views/MapManagerView.axaml - 1 issue
  • GenHub/GenHub/Features/Tools/ReplayManager/ViewModels/ReplayManagerViewModel.cs - Updated user messages
  • GenHub/GenHub/Features/Tools/ReplayManager/Views/ReplayManagerView.axaml - 1 issue
  • GenHub/GenHub/Features/Tools/Services/UploadHistoryService.cs - Simplified to local-only
  • GenHub/GenHub/Features/Tools/Services/UploadThingService.cs - Fail-closed implementation
  • docs/dev/constants.md - Updated documentation
  • docs/dev/uploading-api.md - Updated documentation

Security Assessment

Overall: ✅ Good security improvements

This PR effectively removes the reversible XOR obfuscation of UploadThing credentials from the build pipeline and desktop binaries. The fail-closed approach for UploadThingService is appropriate. The addition of regression tests is excellent.

Note: Repository owners should revoke and rotate the exposed UploadThing token as mentioned in the documentation.

Positive Observations

  • Comprehensive removal of credential injection pipeline
  • Fail-closed service implementation pattern
  • Good test coverage for disabled functionality
  • Clear documentation of security status
  • Appropriate fail-closed UI behavior
  • Well-documented requirements for re-enabling uploads

Reply with @kilocode-bot fix it to have Kilo Code address these issues.


Reviewed by glm-4.7 · Input: 50.2K · Output: 8.6K · Cached: 252.4K

@coderabbitai coderabbitai 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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
GenHub/GenHub/Features/Tools/MapManager/Views/MapManagerView.axaml (2)

190-207: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Stale "(max 10MB per file)" hint left next to permanently disabled Upload buttons. Both views correctly hard-disable the Upload button and update its tooltip to explain the credential-shutdown, but the adjacent size-limit caption was left untouched, so it now advertises a limit for a feature users can't use at all.

  • GenHub/GenHub/Features/Tools/MapManager/Views/MapManagerView.axaml#L190-L207: remove the "(max 10MB per file)" TextBlock at Line 207 (or bind its IsVisible to false/an "uploads enabled" flag) since the Upload button is now permanently disabled.
  • GenHub/GenHub/Features/Tools/ReplayManager/Views/ReplayManagerView.axaml#L168-L185: remove the "(max 10MB per file)" TextBlock at Line 185 (or bind its IsVisible similarly) for the same reason.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@GenHub/GenHub/Features/Tools/MapManager/Views/MapManagerView.axaml` around
lines 190 - 207, Remove or hide the stale “(max 10MB per file)” caption beside
the disabled Upload controls in MapManagerView.axaml (lines 190-207) and
ReplayManagerView.axaml (lines 168-185), using the existing uploads-enabled
state if binding visibility instead of removing the TextBlock.

190-199: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Disabling looks correct; stale size hint next to disabled button.

The permanent IsEnabled="False" and updated tooltip correctly reflect that cloud uploads are disabled. However, the adjacent "(max 10MB per file)" hint at Line 207 still implies an active upload limit for a control that can never be used, which is confusing. This shares one root cause with the identical text in ReplayManagerView.axaml; see the consolidated comment.

Also applies to: 207-207

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@GenHub/GenHub/Features/Tools/MapManager/Views/MapManagerView.axaml` around
lines 190 - 199, The disabled upload controls should not display the stale “(max
10MB per file)” hint. Remove that hint from the upload section in MapManagerView
and the corresponding upload section in ReplayManagerView, while preserving the
disabled buttons and their existing tooltips.
GenHub/GenHub/Features/Tools/ReplayManager/Views/ReplayManagerView.axaml (1)

168-177: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Disabling looks correct; stale size hint next to disabled button.

Same pattern as MapManagerView.axaml: the disable + tooltip change is correct, but "(max 10MB per file)" at Line 185 is now stale next to a permanently disabled Upload button. See the consolidated comment.

Also applies to: 185-185

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@GenHub/GenHub/Features/Tools/ReplayManager/Views/ReplayManagerView.axaml`
around lines 168 - 177, Remove the stale “(max 10MB per file)” size hint
adjacent to the disabled Upload button in the ReplayManagerView upload controls.
Keep the existing UploadAndShareCommand button, disabled state, and tooltip
unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Tools/Services/UploadHistoryServiceTests.cs`:
- Around line 42-68: Extend the UploadHistoryService tests around
RemoveHistoryItemAsync and ClearHistoryAsync to cover partial removal and no-op
behavior. Add a case proving removing one URL preserves unrelated history
entries, plus cases confirming removing a non-matching URL and clearing an empty
history complete without throwing and leave history empty.

In `@GenHub/GenHub/Features/Tools/Services/UploadThingService.cs`:
- Around line 19-37: Move the two disabled-state warning strings used by
UploadFileAsync and DeleteFileAsync into named constants in LogMessages, then
update both logger.LogWarning calls to reference those constants. Preserve the
existing warning text and behavior while following the established LogMessages
convention.

---

Outside diff comments:
In `@GenHub/GenHub/Features/Tools/MapManager/Views/MapManagerView.axaml`:
- Around line 190-207: Remove or hide the stale “(max 10MB per file)” caption
beside the disabled Upload controls in MapManagerView.axaml (lines 190-207) and
ReplayManagerView.axaml (lines 168-185), using the existing uploads-enabled
state if binding visibility instead of removing the TextBlock.
- Around line 190-199: The disabled upload controls should not display the stale
“(max 10MB per file)” hint. Remove that hint from the upload section in
MapManagerView and the corresponding upload section in ReplayManagerView, while
preserving the disabled buttons and their existing tooltips.

In `@GenHub/GenHub/Features/Tools/ReplayManager/Views/ReplayManagerView.axaml`:
- Around line 168-177: Remove the stale “(max 10MB per file)” size hint adjacent
to the disabled Upload button in the ReplayManagerView upload controls. Keep the
existing UploadAndShareCommand button, disabled state, and tooltip unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 8c45dee5-4809-44f8-a149-21804c1932bd

📥 Commits

Reviewing files that changed from the base of the PR and between 5ba2a51 and c69a6cc.

📒 Files selected for processing (18)
  • .github/scripts/inject-token.ps1
  • .github/workflows/ci.yml
  • .github/workflows/release.yml
  • GenHub/GenHub.Core/Constants/ApiConstants.cs
  • GenHub/GenHub.Core/Constants/ErrorMessages.cs
  • GenHub/GenHub.Core/Constants/LogMessages.cs
  • GenHub/GenHub.Core/Interfaces/Common/IUploadHistoryService.cs
  • GenHub/GenHub.Core/Models/Tools/UploadRecord.cs
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Tools/Services/UploadHistoryServiceTests.cs
  • GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Tools/Services/UploadThingServiceTests.cs
  • GenHub/GenHub/Features/Tools/MapManager/ViewModels/MapManagerViewModel.cs
  • GenHub/GenHub/Features/Tools/MapManager/Views/MapManagerView.axaml
  • GenHub/GenHub/Features/Tools/ReplayManager/ViewModels/ReplayManagerViewModel.cs
  • GenHub/GenHub/Features/Tools/ReplayManager/Views/ReplayManagerView.axaml
  • GenHub/GenHub/Features/Tools/Services/UploadHistoryService.cs
  • GenHub/GenHub/Features/Tools/Services/UploadThingService.cs
  • docs/dev/constants.md
  • docs/dev/uploading-api.md
💤 Files with no reviewable changes (5)
  • GenHub/GenHub.Core/Constants/LogMessages.cs
  • GenHub/GenHub.Core/Constants/ErrorMessages.cs
  • .github/scripts/inject-token.ps1
  • .github/workflows/ci.yml
  • .github/workflows/release.yml

Comment on lines +42 to +68
public async Task RemoveHistoryItemAsync_WhenItemExists_RemovesLocalRecord()
{
var service = CreateService();
service.RecordUpload(1024, "https://utfs.io/f/example", "example.zip");

await service.RemoveHistoryItemAsync("https://utfs.io/f/example");

var reloadedService = CreateService();
Assert.Empty(await reloadedService.GetUploadHistoryAsync());
}

/// <summary>
/// Verifies that clearing history deletes every local record immediately.
/// </summary>
/// <returns>A task representing the asynchronous test operation.</returns>
[Fact]
public async Task ClearHistoryAsync_WhenItemsExist_RemovesAllLocalRecords()
{
var service = CreateService();
service.RecordUpload(1024, "https://utfs.io/f/first", "first.zip");
service.RecordUpload(2048, "https://utfs.io/f/second", "second.zip");

await service.ClearHistoryAsync();

var reloadedService = CreateService();
Assert.Empty(await reloadedService.GetUploadHistoryAsync());
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Add coverage for partial removal and no-op edge cases.

Current tests only cover "remove the only item" and "clear all items." Consider adding a case verifying that removing one URL leaves other unrelated history entries intact, and that calling RemoveHistoryItemAsync/ClearHistoryAsync on an empty/non-matching history doesn't throw.

✅ Example additional test
[Fact]
public async Task RemoveHistoryItemAsync_WhenOtherItemsExist_LeavesThemIntact()
{
    var service = CreateService();
    service.RecordUpload(1024, "https://utfs.io/f/first", "first.zip");
    service.RecordUpload(2048, "https://utfs.io/f/second", "second.zip");

    await service.RemoveHistoryItemAsync("https://utfs.io/f/first");

    var reloadedService = CreateService();
    var remaining = await reloadedService.GetUploadHistoryAsync();
    Assert.Single(remaining);
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@GenHub/GenHub.Tests/GenHub.Tests.Core/Features/Tools/Services/UploadHistoryServiceTests.cs`
around lines 42 - 68, Extend the UploadHistoryService tests around
RemoveHistoryItemAsync and ClearHistoryAsync to cover partial removal and no-op
behavior. Add a case proving removing one URL preserves unrelated history
entries, plus cases confirming removing a non-matching URL and clearing an empty
history complete without throwing and leave history empty.

Comment thread GenHub/GenHub/Features/Tools/Services/UploadThingService.cs
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.

1 participant