Repository navigation
Conversation
tdgao
commented
Dec 1, 2026
- Trim heading before count check.
- Surface the headings detected as too long.
- Change copy from "header" to "heading."
Pull request changelogAppAddedChangedDeprecatedRemovedFixedSecurityWebsiteAddedChangedDeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
|
Tick the box to add this pull request to the merge queue (same as
|
[Medium impact] The change reaches project-description validation and its moderation messages. The PR appears safe to merge, with a non-blocking regression-test gap.
|
| let first = "first heading ".repeat(7); | ||
| let second = "second heading ".repeat(7); | ||
| let description = format!( | ||
| "# **{first}text**\n\n<h2><em>{second}text</em> </h2>" | ||
| ); | ||
|
|
||
| assert_eq!( | ||
| DescriptionMarkdown::parse(&long_header).long_header_count(), | ||
| 1 | ||
| DescriptionMarkdown::parse(&description).long_headers(), | ||
| [format!("{first}text"), format!("{second}text")] |
There was a problem hiding this comment.
Tests miss padded short headings
Both updated examples remain over 80 characters after trimming. They would still pass if the helper counted whitespace before trimming the returned text. Add a heading with at most 80 characters whose padding pushes it over the limit, and assert that long_headers() returns nothing. Also check exactly 80 and 81 characters to protect the limit.
Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/labrinth/src/validate/project/description/markdown.rs
Line: 234-242
Comment:
**Tests miss padded short headings**
Both updated examples remain over 80 characters after trimming. They would still pass if the helper counted whitespace before trimming the returned text. Add a heading with at most 80 characters whose padding pushes it over the limit, and assert that `long_headers()` returns nothing. Also check exactly 80 and 81 characters to protect the limit.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Frontend previewsLast deployed commit is 1c8d1788ca7da6d54ddb199ecb4b609ea1e5e084 Persistent
Latest commit
|