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

SPIKE Review third party dependencies #10488

Closed
maxime-rainville opened this issue Sep 4, 2022 · 4 comments
Closed

SPIKE Review third party dependencies #10488

maxime-rainville opened this issue Sep 4, 2022 · 4 comments
Assignees

Comments

@maxime-rainville
Copy link
Contributor

maxime-rainville commented Sep 4, 2022

There's a thirdparty dependencies in framework that contains a bunch of weird things that probably shouldn't exists.

Timebox

  • 1 day

Objectives

  • Review all the dependencies managed via the thirdparty folder
  • For each one, identified an approach to managing them going forward:
    • Fold it back into our codebase
    • Spine them out into seperate module
    • Swap for a better more modern equivalent
    • Something else
  • Where we expect to take full ownership of the thirdparty dependency, we should scope the work needed to provide reasonable test coverage
  • Create matching cards for each dependency
@GuySartorelli GuySartorelli self-assigned this Jan 10, 2023
@GuySartorelli
Copy link
Member

GuySartorelli commented Jan 10, 2023

Initial thoughts here.

difflib (see #10640)

Used by:

  • We made our own SilverStripe\View\Parsers\Diff subclass of it
  • SiteTreeTest references it
  • DataDifferencer uses it to get differences between copies of HTML content
  • VersionedAdmin's DiffField (who knew we had that?) uses it to get differences between copies of HTML content

php-peg (see #10644)

  • The original is at https://github.com/hafriedlander/php-peg but is super abandoned (no updated since 2014)
  • Of the available forks, this one seems to be maintained but it is self proclaimed as "somehow opinionated" which worries me a little.
  • I'll spend a small amount of time looking into that fork, but ultimately it may be better for peace of mind to just fold this into our codebase and accept that we have to live with it until such a time as we can ditch the concept of *.ss templates.

Simpletest (see #10642)

  • This is only ever directly used by TestSession::lastPage() which is used by TestSession::SubmitForm().
  • I think it should be relatively easy to just replace this with something modern (there's probably already something in our codebase or in phpunit)

@maxime-rainville
Copy link
Contributor Author

difflib

My preference would be swap it with something modern. If it's not possible to do it in time for the beta, my instinct would be to declare it an internal API and not support it officially. Alternatively, we could create an interface in front of SilverStripe\View\Parsers\Diff and support that instead of the underlying implementation.

php-peg

I'm OK with folding it in. Again, I think it makes sense to declare class @internal if we don't want people to interact with them directly.

Simpletest

Presuming we don't expose any of those classes through our own API, I think it makes total sense to declare this an unsupported dep. Which means we could remove it post beta if wanted/needed to.

@maxime-rainville
Copy link
Contributor Author

Presuming there's no added complexity with difflib, I'm happy to call this SPIKE done.

@GuySartorelli
Copy link
Member

GuySartorelli commented Jan 11, 2023

Difflib

My POC PR for difflib shows that it should be possible to swap out with a modern alternative fairly easily - the main problem we're gonna have I think is not mangling the html in the process (difflib is a bit odd in that it marks replacements, where most diff libraries I've seen just mark them as separate added/removed which makes it harder to keep the HTML in once piece) - but I think with some careful thought we can deal with that in a day or two at most.

But yeah if that takes too long it's also easy enough to just move that logic into our SilverStripe\View\Parsers\Diff class, which is how I'd recommend folding it in if we were to fold it in.

php-peg

I've added an AC to the php-peg issue to mark the classes as @internal.

simpletest

simpletest is only used by SessionTest but we do return a simpletest "page" object from a public method on that class. So it's technically part of our public API at the moment.

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

No branches or pull requests

2 participants