Skip to content

Consider setting up Gold for flutter/tests #71437

Open

Description

@dnfield

I'm not sure if this is feasible. I'm hoping @Hixie and/or @Piinks will know.

When a 3p customer test (e.g. flutter_svg) fails on a golden file, perhaps because of minor and visually acceptable change in Skia, it requires updating the golden in the downstream repo and coordinating that change with an engine roll.

It would be far preferable if Skia gold, or something like it, could be used instead so that reviewers could triage these changes (with approval from the 3p owner of the package).

Activity

  1. added
    a: tests"flutter test", flutter_test, or one of our tests
    c: new featureNothing broken; request for a new capability
    P3Issues that are less important to the Flutter project
    on Nov 30, 2020
  2. dnfield commented on Nov 30, 2020

    @dnfield
    ContributorAuthor

    See #71436

  3. dnfield commented on Nov 30, 2020

    @dnfield
    ContributorAuthor

    /cc @zanderso as well - my thought is this would lead to a better workflow for engine sheriffs, but there may be some other way to handle this as well.

  4. Piinks commented on Nov 30, 2020

    @Piinks
    Contributor

    I think this would require our customers to create and manage their own Skia Gold instances (they are unique to a repository) and grant us permission to triage image changes.

  5. dnfield commented on Nov 30, 2020

    @dnfield
    ContributorAuthor

    If I wanted to do that for flutter_svg (or any 3p repo), is there documentation on how to do it?

    Is it something we could conceivably do for the tests repo and tie the instance to the tests repository?

  6. Piinks commented on Nov 30, 2020

    @Piinks
    Contributor

    If I wanted to do that for flutter_svg (or any 3p repo), is there documentation on how to do it?

    There is documentation at https://github.com/google/skia-buildbot/tree/master/golden in the read me

    Is it something we could conceivably do for the tests repo and tie the instance to the tests repository?

    I don't think so, since changes to customer tests have to be associated with commits in the customer repo, not the flutter/tests repo. Otherwise customers would not be able to update their images while working on their own packages. Skia Gold associates images with commits in a given repository for that instance.

    Right now, we clone a customer repo and run the tests. Customers could be managing their golden files any number of ways - we haven't specified rules around this type of test in flutter/tests.

  7. dnfield commented on Nov 30, 2020

    @dnfield
    ContributorAuthor

    That makes sense. I'm a little worried the burden of that is high for 3p customers who are not already using gold. In particular, every commit to flutter/flutter would end up using up GCP credits on a 3p customer's account. But maybe there's some other way to make this easier on rollers and customers...

  8. Piinks commented on Nov 30, 2020

    @Piinks
    Contributor

    I'm a little worried the burden of that is high for 3p customers who are not already using gold.

    I agree completely. I think it would be an undue burden.

  9. Piinks commented on Dec 1, 2020

    @Piinks
    Contributor

    Thinking about this a bit more, golden files are not considered breaking changes in flutter/flutter. I wonder if we should not allow them in flutter/tests since they are non-breaking. That would certainly free up the workflow.

  10. dnfield commented on Dec 1, 2020

    @dnfield
    ContributorAuthor

    That would make flutter_svg a little sad - the majority of tests there are golden tests.

  11. Piinks commented on Dec 2, 2020

    @Piinks
    Contributor

    But if goldens aren't considered breaking - why include them? 🤔

    Especially with the challenges we've had today trying to update them due to an engine change. That change is not going through breaking change procedure, because it is not a breaking change. But it creates an excruciating break in the system that closes the tree.

    I wonder, to what end do we include golden file tests in flutter/tests if not to just break the tree? What is the purpose of including golden files in flutter/tests?

    Context:
    flutter/tests#68
    #71436
    #71496
    #71519
    flutter/tests#70
    #71498

  12. dnfield commented on Dec 2, 2020

    @dnfield
    ContributorAuthor

    I'm not sure I agree that a golden file changing isn't considered a breaking change. My understanding is that if one of our upstream dependencies (e.g. Skia) changes a golden in a way that isn't deemed to be a bug (e.g. minor pixel differences in anti-aliasing or gradient or font rendering that carries some other benefit), we don't consider it a breaking change for Flutter (because really it's a breaking change for that upstream dependency). So the change breaking flutter_svg's tests isn't a breaking change, and my job as the maintainer is to make sure it gets updated so that I can still pass on master.

    That said, if Flutter broke rendering in a way that was only caught by a golden test, and we agreed it was not a bug but a feature, it would be a breaking change right?

    All of that can be true and we could still decide to ban goldens from the 3p test repo, but we definitely deal with this elsewhere in the Google internal repo anyway.

    I agree we need a better process for this. I opened this bug naively hoping that Skia Gold could help that process. Banning golden tests from the tests repo would also make this specific problem go away, but if we do that we should communicate it to customers and update the customer testing script(s) to enforce it.

  13. 4 remaining items

  14. Hixie commented on Dec 2, 2020

    @Hixie
    Contributor

    (And for my third comment of the day...)

    I don't really understand the problem here though. What is different about updating golden tests vs any other test?

  15. Piinks commented on Dec 2, 2020

    @Piinks
    Contributor

    I think the issue here is that if a customer golden file test is broken by an engine roll, the roll gets stuck, and when the customer updates their golden file to unblock the engine roll, the tree breaks until the engine rolls in.

    We were able to coordinate landing changes yesterday as it was just one customer package that was affected, but that's not going to scale very well.

  16. Piinks commented on Dec 2, 2020

    @Piinks
    Contributor

    We still support versioning golden files, like in the flutter/goldens days. Maybe we can encourage customers to version their golden files so the tree doesn't break.

  17. Hixie commented on Dec 2, 2020

    @Hixie
    Contributor

    The engine roll is not exempt from the breaking change policy. The correct behaviour is to revert the breaking change, make it opt-in, write a migration guide, opt people in, land the change, remove the opt-in from the customer tests, then remove the opt in, just like with any breaking change.

    Unless we're talking specifically about upstream changes form Skia? (In which case maybe we should open a conversation with the Skia team about the impact of their breaking changes on our customers, and maybe they can included these tests in their CI.)

  18. Piinks commented on Dec 2, 2020

    @Piinks
    Contributor

    Unless we're talking specifically about upstream changes form Skia? (In which case maybe we should open a conversation with the Skia team about the impact of their breaking changes on our customers.)

    Yeah, it was traced to a Skia roll.

    dnfield/flutter_svg#461

    Screen Shot 2020-12-02 at 2 15 48 PM

  19. Hixie commented on Dec 2, 2020

    @Hixie
    Contributor

    Maybe we can come up with some metric whereby each individual pixel is allowed to vary by some tiny amount? That would still allow my 5x5-box example to trigger a failure while allowing subtle shifts to be considered fine?

  20. dnfield commented on Dec 2, 2020

    @dnfield
    ContributorAuthor

    The reason I mentioned gold to begin with is that it could help us triage these things much more quickly and easily. Today the process ends up being:

    1. Open a PR in the downstream repo
    2. Land it
    3. Update the tests registry with the new hash
    4. Land the new hash in conjunction with the engine roll, temporarilly breaking the tree until the engine builders finish (or are re-run with the "right" tests commit)

    And then reverts get painful.

    Another option is to just temporarily disable the repo, which can lead to other problems (e.g. if some other breakage is introduced in the mean time).

    If there was some way to set up gold so that it was registered to the tests repo, and had some "reasonable" amount of usage, that would help triaging this (the engine roll itself could choose to update the goldens).

  21. Piinks commented on Dec 2, 2020

    @Piinks
    Contributor

    If there was some way to set up gold so that it was registered to the tests repo, and had some "reasonable" amount of usage, that would help triaging this (the engine roll itself could choose to update the goldens).

    I don't think that this is possible, or at least I haven't thought of a way yet.

    If we set up a Gold instance for flutter/tests, it will relate specifically to commits in that repo. Not commits in customer/package. Not commits in flutter/flutter. It would not work like the engine rolling into flutter/flutter and triaging the new images for instance flutter/flutter.
    Images are checked into Gold with commits, so without a commit in flutter/tests, new images could not be checked in.

    Even if it could work, customers would have to integrate their tests with Gold and give us permission to approve changes - which doesn't feel right. I don't know that we can be the arbiter of someone else's golden files.

    Furthermore, customers would not be able to work on their own package and their own golden files independently if we are managing them in a Gold instance based in a separate repo. It would effectively put the same burden on the customers to land multiple commits in order to land their own changes in their own product. And we would still have to step through the same process on the framework side. 😞

  22. dnfield commented on Dec 2, 2020

    @dnfield
    ContributorAuthor

    We could still allow customers to decide on approval, it would just be in gold (or something like gold anyway) and more manageable.

    Wouldn't they still have their own golden files however they want to manage them, just distinct from the gold instance?

  23. Piinks commented on Dec 2, 2020

    @Piinks
    Contributor

    I feel I may not be conveying how Gold works very well. 😆
    Gold cannot track images across multiple repositories.

  24. dnfield commented on Dec 3, 2020

    @dnfield
    ContributorAuthor

    I'm speaking of a hypothetical gold that can do this - whether by adding that feature to gold, or finding something else. I have no idea how feasible that is :)

  25. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: tests"flutter test", flutter_test, or one of our testsc: new featureNothing broken; request for a new capabilityframeworkflutter/packages/flutter repository. See also f: labels.team-frameworkOwned by Framework teamtriaged-frameworkTriaged by Framework team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions