Skip to content

Preserve PascalCase comments when appending streamed review comments - #118

Merged
lovestaco merged 1 commit into
HexmosTech:mainfrom
sayedrisat:fix/preserve-streamed-comments
Jun 7, 2026
Merged

Preserve PascalCase comments when appending streamed review comments#118
lovestaco merged 1 commit into
HexmosTech:mainfrom
sayedrisat:fix/preserve-streamed-comments

Conversation

@sayedrisat

@sayedrisat sayedrisat commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Preserves existing PascalCase Comments entries when streamed review comments are appended to file payloads.

Why

Initial review payloads can use the API-style Comments field while streamed comments are appended into the UI's lowercase comments field. Without preserving both shapes, existing comments can disappear after a streamed update.

Validation

  • node --test internal/staticserve/static/components/review_stream_state.test.mjs
  • node --test internal/staticserve/static/components/*.test.mjs
  • git diff --check

Note: make test-js could not run locally because make is not installed in this PowerShell environment; the equivalent Node test command from the Makefile passed.

@lovestaco

lovestaco commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

What exactly was the issue, could you share a screenshot of before and after? @sayedrisat

@sayedrisat

sayedrisat commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for asking. This is not a visual/layout change, so I do not have a meaningful before/after screenshot for the root cause.

The issue is in the streamed review state helper. Initial review payloads can use the API-style PascalCase field Comments, but streamed updates append into the UI's lowercase comments field.

Before this PR, appendStreamedCommentsToFiles only preserved file.comments. So if the existing file payload looked like this:

{ FilePath: 'a.go', Comments: [{ Content: 'existing' }] }

and then a streamed comment arrived for a.go, the helper started from an empty lowercase comments array and the existing Comments entry could be dropped from the UI state.

Before:

['streamed'] // existing comment lost

After:

['existing', 'streamed'] // existing API comment is preserved, streamed comment is appended

I added a regression test for that exact payload shape:

appendStreamedCommentsToFiles preserves PascalCase comments from API payloads

Validation I ran:

  • node --test internal/staticserve/static/components/review_stream_state.test.mjs
  • node --test internal/staticserve/static/components/*.test.mjs
  • git diff --check

So the before/after is a state preservation issue rather than a visible styling change: the visible symptom would be comments disappearing after streamed updates, while the test captures the exact failing case.

@lovestaco

lovestaco commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Thanks for the clear repro and test @sayedrisat

https://github.com/HexmosTech/git-lrc/releases/tag/v0.4.8

@lovestaco
lovestaco merged commit 47fcdb3 into HexmosTech:main Jun 7, 2026
13 checks passed
@lovestaco lovestaco self-assigned this Jun 7, 2026
@lovestaco
lovestaco self-requested a review June 7, 2026 08:59
@lovestaco lovestaco assigned sayedrisat and unassigned lovestaco Jun 7, 2026
@lovestaco lovestaco added the bug Something isn't working label Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants