Skip to content

Match GitHub and GitLab descriptions with line breaks after a sync - #52

Merged
slominskir merged 1 commit into
mainfrom
fix-gitlab-description-newlines
Nov 9, 2026
Merged

slominskir merged 1 commit into
mainfrom
fix-gitlab-description-newlines

Conversation

@slominskir-coding-agent

Copy link
Copy Markdown
Contributor

Fixes #31

Cause

GitLab returns a project description entered in its web form with CRLF line endings. The Sync page writes the remote description into the row's data-description attribute, and sync.js posts that attribute's value when you click Update or Add. The browser's HTML parser reads CRLF (and a lone CR) in the page as LF, so sim saves the description with LF. The next sync compares GitLab's CRLF with the saved LF, so the software is listed for update again however often you apply it.

Change

SyncService now reads GitHub and GitLab descriptions with LF line endings (normalizeLineEndings), the same text the browser would send. The saved description then matches in Software.syncEquals, and the Sync page's description comparison agrees too. The other repositories (CSUE, Certified) take descriptions from jsoup's text(), which already joins lines with spaces, and LLAPP has no descriptions.

Descriptions you've already synced need no upgrade: they were saved with LF, so they match on the next sync. You can put back the multi-line GitLab descriptions removed as the issue's workaround.

No deployment steps, schema change or settings.

Checks

  • Cause, GitLab side: in a sample of 100 recently active projects from gitlab.com's public API, 6 of the 7 multi-line descriptions used CRLF. None of the public projects in code.jlab.org's acc group currently have multi-line descriptions (the issue's workaround removed them), so I couldn't sample one there.
  • Cause, browser side: headless Chromium (156) reads an attribute written as a\r\nb\rc as "a\nb\nc".
  • Regression test: SyncServiceParseTest.multiLineDescriptionMatchesWhatSimSaved parses a GitLab project whose description has CRLF, CR and LF line endings and diffs it against the software as sim saved it (LF). It fails without the fix (the parsed description keeps its CRs) and passes with it.
  • ./gradlew build (Spotless, PMD, SpotBugs, unit tests): passes.
  • ./gradlew integrationTest against this branch's rebuilt app: 51 tests, all pass. The Sync pages call GitHub, GitLab and JLab's internal pages, which have no stand-in, so no integration test can cover this change.
  • App log: only the errors the integration tests cause on purpose (a duplicate name and the edits refused to read-only and anonymous users).
  • Not checked: a real sync against code.jlab.org; the stack's GitLab token is a placeholder. There is no page change to look at in a browser.

Decisions

  • Normalize on the server, not in the page. Writing CR into the attribute as 
 would keep GitLab's CRLF through the browser, but descriptions edited in the software dialog are saved with LF (a textarea's value always has LF), so sim would hold a mix of the two. Normalizing when reading the remote description keeps everything sim saves with LF and also fixes the Sync page's own description comparison.
  • GitHub too. GitHub and GitLab descriptions share one parser, and the Sync page sends a GitHub description through the same attribute, so a line break there would have the same problem.
  • No label. The repository has no source::ai label, and creating one changes the repository's settings, so I left it to you.

Prepared-by: Anthropic Claude Code:claude-opus-5-5

🤖 Generated with Claude Code

GitLab returns a project description entered in its web form with CRLF
line endings. The Sync page passes the remote description to the save
request through an HTML data attribute, and the browser's HTML parser
reads CRLF (and a lone CR) there as LF, so sim saves LF. The next sync
compared GitLab's CRLF with the saved LF and listed the software for
update again, however often the update was applied.

Read GitHub and GitLab descriptions with LF line endings, as the
browser would, so the saved description matches and the Sync page's
description comparison agrees.

Fixes #31

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@slominskir
slominskir merged commit c1106bd into main Nov 9, 2026
5 checks passed
@slominskir
slominskir deleted the fix-gitlab-description-newlines branch November 9, 2026 20:20
@slominskir-coding-agent slominskir-coding-agent Bot mentioned this pull request Nov 9, 2026
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.

GitLab project description field with newlines sync mismatch

1 participant