nextcloud / neon

A framework for building convergent cross-platform Nextcloud clients using Flutter.
Other
124 stars 31 forks source link

Stop re-exporting packages to avoid breaking changes #1434

Closed provokateurin closed 8 months ago

provokateurin commented 9 months ago

When we re-export another package then the breaking changes of that package also become our breaking changes.

provokateurin commented 8 months ago

I wonder if this actually makes sense. Do we consider updating a dependency with a breaking change to be a breaking change for our users as well? From the user perspective it doesn't matter if we re-export a package and the package has a breaking change or we update a dependency and pull in a breaking change. We could mitigate it by using version ranges, but that is a lot of maintenance and error-prone. I'm not sure if renovate correctly adds the ! when the update is a major version bump (but we can probably configure that). @Leptopoda what do you think?

provokateurin commented 8 months ago

I couldn't find an option to configure the ! in the commit messages with renovate and there was also no relevant issue to the problem.

provokateurin commented 8 months ago

Either way we need to mark major dependency updates as breaking changes. Afterwards we can still decided if we want to keep re-exporting the packages. I'd be in favor of that because it makes it easier for consumers.

Leptopoda commented 8 months ago

I would not consider both cases the same. See this discussion in the dependency_validator issue tracker (https://github.com/Workiva/dependency_validator/issues/6). The person (from the dart-core team) argues that in cases you depend on the interface of a transitive dependency you should just add it to your pubspec to avoid such issues.

A breakdown on all packages (correct me if I missed something):

Either way we need to mark major dependency updates as breaking changes.

See the first link. I do not think this makes sense and it is not what the rest of the dart ecosystem does.

provokateurin commented 8 months ago

Thanks for your input.

In dynamite_runtime we could change how we handle cookies and only provide a boolean to enable or disable cookies. I don't see why anyone would provide a custom implementation anyway. This would solve the problem IMO and not cause any problems in the future.

I think for packages that we re-export but also develop in this repo we actually do everything correct already, because a commit like fix(dynamite_runtime)!: bla bla would also contain the necessary changes for the nextcloud package. Then that commit would also show up in the history of the nextcloud package and correctly detected as a breaking change.

Leptopoda commented 8 months ago

I don't see why anyone would provide a custom implementation anyway.

Cookies are currently only persisted in memory and some implementations might require persisting them across runs in a database.

provokateurin commented 8 months ago

Oh that is actually wrong, the cookies should have been saved on disk by default. But yeah maybe memory-only cookies are useful in some cases.

provokateurin commented 8 months ago

So what do we do with cookie_jar? Just stop re-exporting and adding it as a dependency everywhere?

Leptopoda commented 8 months ago

I'd make it similar to the httClient where the DynamiteClient instantiates it as a PersistCookieJar to fix the above limitation with an option to overwrite it. That way our unit tests could still use the in memory jar.

Do you have the bandwidth to make this or should I quickly make a PR?

provokateurin commented 8 months ago

Adding a default is good, but still: should we keep re-exporting it or not? Also for neon_framework we still need to use the memory jar for now: https://github.com/nextcloud/neon/issues/1536#issuecomment-1913109469

Please create the PR if possible.

provokateurin commented 8 months ago

After https://github.com/nextcloud/neon/pull/1537 is merged we can close the issue, right? For our own packages we know that the breaking change will always be communicated correctly.