Skip to content

feat: add PostFeedback API for user feedback submission#84

Merged
bobbyg603 merged 9 commits intomainfrom
feature/user-feedback
Mar 20, 2026
Merged

feat: add PostFeedback API for user feedback submission#84
bobbyg603 merged 9 commits intomainfrom
feature/user-feedback

Conversation

@bobbyg603
Copy link
Copy Markdown
Member

@bobbyg603 bobbyg603 commented Mar 10, 2026

Summary

  • Adds FeedbackPostOptions class with CrashTypeId = 36 (User.Feedback)
  • Adds PostFeedback method to CrashPostClient that creates feedback.json with {title, description} and delegates to existing presigned URL upload flow
  • Adds public PostFeedback(string title, string description, FeedbackPostOptions options) to BugSplat class

Test plan

  • Call PostFeedback("Test feedback title", "Test description") with test database/app/version
  • Verify the report appears in BugSplat dashboard with crash type "User.Feedback"
  • Verify feedback.json is accessible in the crash details
  • Verify user, email, description, attributes flow through correctly

🤖 Generated with Claude Code

Adds support for posting non-crashing user feedback via crash type ID 36
(User.Feedback) using the existing presigned URL upload flow. The feedback
zip contains feedback.json with title and description fields.

- Add FeedbackPostOptions class with CrashTypeId = 36
- Add PostFeedback to CrashPostClient (creates feedback.json, delegates to PostCrashFile)
- Add public PostFeedback method to BugSplat class

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@bobbyg603 bobbyg603 changed the title Add PostFeedback API for user feedback submission feat: add PostFeedback API for user feedback submission Mar 20, 2026
…ues, document surrogate pairs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 20, 2026 14:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a first-class “user feedback” submission API to the BugSplat .NET Standard client by introducing feedback-specific post options and wiring a new PostFeedback method through the existing presigned-URL upload flow (uploading a generated feedback.json attachment).

Changes:

  • Add FeedbackPostOptions with CrashTypeId = 36 for “User.Feedback”.
  • Add BugSplat.PostFeedback(...) and CrashPostClient.PostFeedback(...) to generate/upload feedback.json.
  • Enhance JsonSerializer to emit JSON null for null dictionary values and expose EscapeJsonString publicly (with added tests).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
BugSplatDotNetStandard/Http/JsonObject.cs Updates JSON serialization behavior and exposes escaping helper.
BugSplatDotNetStandard/BugSplatPostOptions.cs Introduces FeedbackPostOptions with feedback crash type id.
BugSplatDotNetStandard/BugSplat.cs Adds public PostFeedback entry point that delegates to CrashPostClient.
BugSplatDotNetStandard/Api/CrashPostClient.cs Implements feedback upload by generating feedback.json and posting it via existing flow.
BugSplatDotNetStandard.Test/JsonObject.cs Adds tests for null serialization + public escape helper + emoji escaping.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +104 to +123
var description = overridePostOptions?.Description ?? defaultPostOptions?.Description ?? string.Empty;
var feedbackJson = $"{{\"title\":{JsonEscape(title)},\"description\":{JsonEscape(description)}}}";
using (var feedbackTempFile = TempFileFactory.CreateFromBytes("feedback.json", Encoding.UTF8.GetBytes(feedbackJson)))
{
return await PostCrashFile(
database,
application,
version,
feedbackTempFile.File,
defaultPostOptions,
overridePostOptions
);
}
}

private static string JsonEscape(string value)
{
if (value == null) return "\"\"";
return "\"" + value.Replace("\\", "\\\\").Replace("\"", "\\\"").Replace("\n", "\\n").Replace("\r", "\\r").Replace("\t", "\\t") + "\"";
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

PostFeedback builds JSON via JsonEscape, which is a partial/duplicated JSON string escaper (doesn't handle all control characters or non-ASCII consistently, and now diverges from the existing JsonSerializer.EscapeJsonString). This can generate invalid feedback.json for some inputs. Consider removing JsonEscape and constructing feedbackJson using the existing JSON escaping/serialization utility (or a single shared helper) so escaping behavior is correct and consistent across the library.

Copilot uses AI. Check for mistakes.
bobbyg603 and others added 5 commits March 20, 2026 11:04
… PostFeedback

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…h type ID, and override options

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@bobbyg603 bobbyg603 merged commit 5f8f0c2 into main Mar 20, 2026
4 checks passed
@bobbyg603 bobbyg603 deleted the feature/user-feedback branch March 20, 2026 16:46
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.

4 participants