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

14: skip unknown types #181

Merged
merged 2 commits into from
Sep 19, 2023
Merged

14: skip unknown types #181

merged 2 commits into from
Sep 19, 2023

Conversation

Jorropo
Copy link
Contributor

@Jorropo Jorropo commented Sep 11, 2023

No description provided.

@Jorropo Jorropo requested a review from lidel September 11, 2023 08:08
Copy link
Member

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

Suggestions are not meant to be taken seriously. Instead, consider refactoring to not use goto.

fs-repo-14-to-15/migration/migration.go Outdated Show resolved Hide resolved
fs-repo-14-to-15/migration/migration.go Outdated Show resolved Hide resolved
Copy link
Contributor

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

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

Haven't run the migration to test yet, but aside from the comment on substitution seems ok.

Some tests on the error cases might be nice if not too painful.

fs-repo-14-to-15/migration/migration.go Outdated Show resolved Hide resolved
var newSwarm []interface{}
for _, v := range swarm {
if addr, ok := v.(string); ok {
if !strings.Contains(addr, "/quic") || strings.Contains(addr, "/quic-v1") {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if we have good options, but it's pretty awkward that we're removing /quic here when we have no idea if there's a substitute /quic-v1 in place. Should we look for identical matches instead, otherwise we're going to delete the users' data that they may have added to AppendAnnounce, etc.

Given the user has to do something here would we be better off:

  1. Changing their custom config to /quic-v1
  2. Deleting /quic
  3. Letting the user get an error on start and figure it out (error messages in kubo need to be helpful enough for this to be viable, they might already be)

Seems like probably not a ton of people will be impacted, but the support time here might be no fun unless this is taken care of 😢.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we already had a migration that duplicated quic into quic-v1 addresses, do you want me to copy paste it and rerun it again ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Well don't want to end up with duplicate quic-v1 addresses. Could do more work here to make sure we're not, but a bit concerned about added surface needing testing.

Might be fine leaving things alone given it meant that after quic-v1 addresses were in the config the user added only a /quic address.

WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

@lidel says the previous code did deduplication, if it does then lets reuse that.

Copy link
Member

@lidel lidel Sep 12, 2023

Choose a reason for hiding this comment

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

+1, it will be safer is we effectively re-run migration and convert all remaining /quic to /quic-v1 and then remove any /quic-1 duplicates.

This way we won't break users who manually added /quic since last migration for soem reason.

Comment on lines 178 to 181
if !ok {
continue
fmt.Printf("invalid type for .Addresses got %T expected json map; skipping .Addresses\n", a)
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

What kinds of things are we expecting here? Is the idea that we don't really care, it's not something with a valid /quic address we can deal with?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mb should be a continue

@BigLep
Copy link
Contributor

BigLep commented Sep 12, 2023

Some tests on the error cases might be nice if not too painful.

Per 2023-09-12 conversation: we should get tests so we're not relying on manual tests. Right now we support a single input/output test. This should be expanded to support multiple.

@BigLep BigLep mentioned this pull request Sep 14, 2023
14 tasks
@Jorropo
Copy link
Contributor Author

Jorropo commented Sep 14, 2023

About testing for null I didn't made two test suites since this made the tests bigger than required.
So I just put under different fields in the end.

Copy link
Contributor

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

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

LGTM. You may want to change the test to include what if the user changed one of the HTTPHeaders (e.g. origins) but not the others.

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

lgtm, fwiw i've tested manually the scenario described by Adin and works fine.

I think it's ok to ship, we've spent enough time on this already, but if we end up having to fix this migration one more time 🙃 then we will create a separate test for every edge case.

@Jorropo Jorropo merged commit 611d46f into master Sep 19, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants