Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Revise length of generated GitHub issue link to avoid hitting URI max length #1336

Merged
merged 10 commits into from
Mar 17, 2025

Conversation

stalgiag
Copy link
Contributor

This PR truncates conflict markdown when a "Raise an issue" link has more than 8k chars.

Assumptions:

  • 8k was tested in Chrome, Firefox, and Safari. It works on all. There is conflicting information about the limits for Edge but the most up-to-date info suggests that it shares Chrome's limit which would make sense.
  • I couldn't create a testing scenario in which anything other than conflict markdown creates an issue link that exceeds this limit. If a reviewer believes otherwise please let me know.

This PR isn't entirely satisfying as it does result in truncated data in the issue. I tried to mitigate the worst effects of this by including a link back to the originating location. I looked into other options but the tradeoffs didn't seem worth it.

Alternatives

  • Creating a GH issue via post to GH API
    • pros: no limitation on content
    • cons: would come from a central account rather than users' personals
  • Replacing body with a link to a central view of the relevant info in the app
    • pros: no limitations on content, freedom with presentation
    • cons: requires navigating away from GH

related to #1334

Copy link
Contributor

@howard-e howard-e left a comment

Choose a reason for hiding this comment

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

Thanks for addressing. This seems like a safe enough solution to move forward with!

On the alternatives, GH API would definitely be a solid and long lasting solution. The in-app view sounds like a larger buildout of the /conflicts page. And with it just being considered an alternative (but always available) if GH cannot take all the content doesn't really place it as too much of a con for me! At a glance, the latter feels more favorable to me right now.

There may also be very minor changes and removal of some unnecessary white space in the template builder but not enough savings for me to require that be done right now.

Other than that, left an inline comment on the truncated text message.

// This code assumes that URLs can only become too long with conflict markdown present
if (conflictMarkdown && url.length > MAX_GITHUB_URL_LENGTH) {
// If URL is too long, truncate the conflict markdown section
const truncationMessage = `\n\n[Content truncated due to URL length limits. Please visit [${window.location}](${window.location}) and click "Review Conflicts" to review the full conflict information.]`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we now have the conflicts page, this message may have to hold additional context or be more generic. If it's done from the /conflicts, there wouldn't be a "Review Conflicts" button to click.

If you want to avoid passing in additional context, maybe something like 'Content truncated due to URL length limits. Please visit link to review the conflicts.' (and if testSequenceNumber is available, could also append something along the lines of "for Test sequenceNumber")?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I forgot about that page! Thanks for reminding me. I took on your suggestion for messaging with 002aa6f

Copy link
Contributor

@howard-e howard-e left a comment

Choose a reason for hiding this comment

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

Confirmed internally that the changes work as expected. Thanks for sorting this out @stalgiag!

@howard-e howard-e merged commit a6f5c9f into development Mar 17, 2025
1 check passed
@howard-e howard-e deleted the revise-issue-uris branch March 17, 2025 20:47
howard-e added a commit that referenced this pull request Mar 17, 2025
Create March 17, 2025 Release [2]

Includes the following changes:

* #1336, which addresses #1334
* #1340 
* #1339
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.

2 participants