Skip to content

fix: heading length validator - #8525

Open
tdgao wants to merge 3 commits into
mainfrom
truman/change-nag-copy
Open

tdgao wants to merge 3 commits into
mainfrom
truman/change-nag-copy

Conversation

@tdgao

@tdgao tdgao commented Dec 1, 2026

Copy link
Copy Markdown
Contributor
  • Trim heading before count check.
  • Surface the headings detected as too long.
  • Change copy from "header" to "heading."

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

@mergify

mergify Bot commented Dec 1, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request once it meets the queue conditions

@greptile-apps

greptile-apps Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 4/5 · The PR appears safe to merge, with a non-blocking regression-test gap.RetriggerView in GreptileConfidence Score: 4/5

[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.

Summary

The PR trims heading text before checking its length and includes detected headings in validation feedback.

  • Project description nags show which headings are too long.

Reviews (1) · Last reviewed commit: "feat: surface what heading is detected a..." · Reviewed by Greptile

Comment on lines +234 to +242
let first = "first heading ".repeat(7);
let second = "second heading ".repeat(7);
let description = format!(
"# &nbsp;**{first}text**\n\n<h2><em>{second}text</em>&nbsp;</h2>"
);

assert_eq!(
DescriptionMarkdown::parse(&long_header).long_header_count(),
1
DescriptionMarkdown::parse(&description).long_headers(),
[format!("{first}text"), format!("{second}text")]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 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!

@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Frontend previews

Last deployed commit is 1c8d1788ca7da6d54ddb199ecb4b609ea1e5e084

Persistent

Environment URL
staging https://pr-8525.frontend-staging.rinth.dev
production https://pr-8525.frontend.rinth.dev
storybook https://pr-8525-storybook.modrinth.workers.dev

Latest commit

Environment URL
staging https://2a0705cb.frontend-staging.rinth.dev
production https://f3335507.frontend.rinth.dev

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant