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

[JENKINS-60866][JENKINS-71515] Use JSON#parse to process codemirror-config argument #6867

Merged
merged 7 commits into from
Oct 2, 2024

Conversation

daniel-beck
Copy link
Member

@daniel-beck daniel-beck commented Jul 17, 2022

See JENKINS-60866.

jenkinsci/antisamy-markup-formatter-plugin#91 would be nice to have, but not necessary.

Strictly speaking, this "just" makes the code behave as documented at

<st:attribute name="codemirror-config">
Specifies additional key/value pairs in the JSON format (except the start and end bracket)
to be passed as CodeMirror option object.
</st:attribute>
but since tons of plugins set this value badly, I added backward compatibility for what appears to be the most common configuration (mode).

Proposed changelog entries

  • Require syntactically valid JSON snippet to be returned from MarkupFormatter#getCodemirrorConfig / provided to codemirror-config in f:textarea.

Proposed upgrade guidelines

N/A

Submitter checklist

  • (If applicable) Jira issue is well described
  • Changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developer, depending on the change) and are in the imperative mood. Examples
    • Fill-in the Proposed changelog entries section only if there are breaking changes or other changes which may require extra steps from users during the upgrade
  • Appropriate autotests or explanation to why this change has no tests
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadoc, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO") if applicable.
  • For dependency updates: links to external changelogs and, if possible, full diffs

Desired reviewers

@mention

Maintainer checklist

Before the changes are marked as ready-for-merge:

  • There are at least 2 approvals for the pull request and no outstanding requests for change
  • Conversations in the pull request are over OR it is explicit that a reviewer does not block the change
  • Changelog entries in the PR title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood
  • Proper changelog labels are set so that the changelog can be generated automatically
  • If the change needs additional upgrade steps from users, upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the PR title. (example)
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

@daniel-beck daniel-beck requested a review from Wadeck July 17, 2022 13:09
@NotMyFault NotMyFault added the skip-changelog Should not be shown in the changelog label Jul 17, 2022
@daniel-beck daniel-beck self-assigned this Jul 17, 2022
@daniel-beck daniel-beck added the needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging label Jul 17, 2022
@daniel-beck
Copy link
Member Author

I don't really see why I needed jenkinsci/antisamy-markup-formatter-plugin#91 to make the test pass, any ideas?

@daniel-beck daniel-beck removed their assignment Jul 18, 2022
@daniel-beck daniel-beck added on-hold This pull request depends on another event/release, and it cannot be merged right now and removed needs-comments-resolved Comments in the PR need to be addressed before it can be considered for merging labels Jul 18, 2022
@github-actions github-actions bot added the unresolved-merge-conflict There is a merge conflict with the target branch. label Aug 25, 2022
@github-actions
Copy link
Contributor

Please take a moment and address the merge conflicts of your pull request. Thanks!

@github-actions github-actions bot removed the unresolved-merge-conflict There is a merge conflict with the target branch. label Aug 25, 2022
@basil basil added the squash-merge-me Unclean or useless commit history, should be merged only with squash-merge label Aug 25, 2022
@basil
Copy link
Member

basil commented Aug 29, 2022

What are the next steps for this PR? As far as I can tell jenkinsci/antisamy-markup-formatter-plugin#91 needs to be merged and released, then this PR needs to be updated to a non-incremental build of antisamy-markup-formatter-plugin. Is there any additional work that needs to be done?

@basil basil changed the title [JENKINS-60866] Use JSON#parse to process codemirror-config argument [JENKINS-60866] Use JSON#parse to process codemirror-config argument Aug 29, 2022
@daniel-beck
Copy link
Member Author

daniel-beck commented Aug 30, 2022

What are the next steps for this PR? As far as I can tell jenkinsci/antisamy-markup-formatter-plugin#91 needs to be merged and released, then this PR needs to be updated to a non-incremental build of antisamy-markup-formatter-plugin. Is there any additional work that needs to be done?

Ideally I'd find the time to understand why this needs the plugin update despite the attempt at backwards compatibility. HTMLUnit throws at codemirror.js line 2246, and then

config.executeJavaScript("document.getElementsByTagName('TEXTAREA')[0].codemirrorObject.setLine(0,'foobar')");
doesn't work because codeMirrorObject isn't set.

Otherwise this is just waiting for the plugin release, yes.

How do we have a billion different linters and not one did tell me
I'm redefining a variable?
@basil basil removed the on-hold This pull request depends on another event/release, and it cannot be merged right now label Sep 1, 2022
@basil basil requested a review from a team September 1, 2022 14:28
@basil
Copy link
Member

basil commented Sep 2, 2022

With a passing test suite, this is looking close to ready (if not fully ready) from my perspective. Do others feel that the mode compatibility path is sufficient, or do others feel that a more systematic search of cases not covered by that compatibility path is needed? My personal opinion is that while the latter could not hurt, I leave that to Daniel's discretion and trust his judgment regarding whether a systematic search is necessary or not.

@NotMyFault NotMyFault added developer Changes which impact plugin developers and removed skip-changelog Should not be shown in the changelog labels Sep 2, 2022
Copy link
Member

@NotMyFault NotMyFault left a comment

Choose a reason for hiding this comment

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

Looks fine so far, maybe we can get a release of the antisamy-markup plugin soonish, but I wouldn't consider this as blocker, given the antisamy PR is up for review.

@basil
Copy link
Member

basil commented Sep 2, 2022

antisamy-markup-formatter-plugin is fully covered by the compatibility path, so while that PR is valuable as a code cleanup, there is no need to hold this PR for that one. Whether there are other plugins not covered by the compatibility path that ought to be considered is a bit of an open question, but as I wrote earlier I won't insist on a systematic search.

@Wadeck
Copy link
Contributor

Wadeck commented Nov 10, 2022

@NotMyFault I will ask someone (else than Daniel) from security team 👍

@NotMyFault
Copy link
Member

@NotMyFault I will ask someone (else than Daniel) from security team 👍

Thanks, just mentioned you, because Daniel requested your review initially.

@Wadeck
Copy link
Contributor

Wadeck commented Nov 10, 2022

it was because of CSP topic :) but you did right, thanks 👍

@daniel-beck
Copy link
Member Author

daniel-beck commented Nov 10, 2022

Just in case, I don't think this should be merged yet. I haven't done the followup work for #6867 (comment) yet.

So while I think this change is final and can be reviewed, I recommend we hold off merging. IIRC, this will break CodeMirror use in several plugins, most notably job-dsl, groovy, and powershell plugins.

@basil
Copy link
Member

basil commented Sep 27, 2024

jenkinsci/cloudbees-feature-management-plugin#86 only has 40 installations, and everything else is merged and released, so are we ready to move forward with this?

@daniel-beck
Copy link
Member Author

daniel-beck commented Oct 1, 2024

@basil Depends on your threshold for plugin popularity. Based on the notes I took ~2 yrs ago, templating-engine is the only one left with >500 known installs that would be incompatible. I suggest a re-review of current plugins for compatibility in case something new popped up since. I'd be happy to share the old notes or to do it myself, but cannot commit to a date right now for the latter.

@basil
Copy link
Member

basil commented Oct 1, 2024

While I appreciate the desire for perfection here, perhaps we are falling into analysis paralysis and letting "perfect" be the enemy of "good enough." The value of shipping code is far higher than the value of non-shipping code, and the cost of old PRs is high (including the cost of retesting), so I think we should take it out of draft and ship it in weekly (especially since we are early in an LTS cycle). Whatever minor issues remain can be dealt with if and when they come up.

basil added a commit to basil/acceptance-test-harness that referenced this pull request Oct 1, 2024
basil added a commit to basil/bom that referenced this pull request Oct 1, 2024
@basil basil added the ath-successful This PR has successfully passed the full acceptance-test-harness suite label Oct 1, 2024
@basil
Copy link
Member

basil commented Oct 1, 2024

Passing ATH: jenkinsci/acceptance-test-harness#1748

@basil
Copy link
Member

basil commented Oct 1, 2024

Passing PCT: jenkinsci/bom#3651

@basil basil added the pct-successful This PR has successfully passed the full plugin-compatibility-test suite label Oct 1, 2024
@basil basil self-assigned this Oct 1, 2024
@basil basil marked this pull request as ready for review October 1, 2024 21:47
Copy link
Member

@basil basil left a comment

Choose a reason for hiding this comment

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

This PR is now ready for merge. We will merge it after approximately 24 hours if there is no negative feedback. Please see the merge process documentation for more information about the merge process. Thanks!

@basil basil added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Oct 1, 2024
@MarkEWaite MarkEWaite merged commit 7a1c2ce into jenkinsci:master Oct 2, 2024
16 checks passed
basil added a commit to basil/acceptance-test-harness that referenced this pull request Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ath-successful This PR has successfully passed the full acceptance-test-harness suite developer Changes which impact plugin developers pct-successful This PR has successfully passed the full plugin-compatibility-test suite ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback squash-merge-me Unclean or useless commit history, should be merged only with squash-merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants