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

feat(dnscheck): implement richer input #1618

Merged
merged 19 commits into from
Jun 7, 2024
Merged

feat(dnscheck): implement richer input #1618

merged 19 commits into from
Jun 7, 2024

Conversation

bassosimone
Copy link
Contributor

@bassosimone bassosimone commented Jun 6, 2024

This diff:

  1. modifies ./internal/registry and its dnscheck.go file such that dnscheck has its own private target loader;
  2. modifies ./internal/targetloading to allow reusing the code to read static input from CLI and from files;
  3. modifies ./internal/model to pass optional richer input to experiments;
  4. modifies ./internal/engine to pass richer input to experiments;
  5. modifies ./internal/experiment/dnscheck to read and use the richer input it is passed;
  6. implements a custom target loader for ./internal/experiment/dnscheck returning some static entries;
  7. modifies ./internal/oonirun to make sure richer-input experiments honor their options by moving option loading before the loading of targets.

Once this diff is merged, miniooni and ooniprobe will run dnscheck with richer input. Obviously, we are still lacking an API to fetch richer input, so for now this is static richer input, suitable as a starting point to land more diffs.

Part of ooni/probe#2607.

This diff completes the set of preliminary richer input diffs.

We build the TargetLoader using the ExperimentBuilder, which in turn
uses a registry.Factory under the hood.

This means that we can load targets for each experiment.

Part of ooni/probe#2607
Conflicts:
	internal/oonirun/experiment.go
	internal/registry/dnscheck.go
	internal/targetloading/targetloading.go
@@ -114,7 +114,7 @@ func (m *Measurer) ExperimentVersion() string {
// errors are in addition to any other errors returned by the low level packages
// that are used by this experiment to implement its functionality.
var (
ErrInputRequired = errors.New("this experiment needs input")
ErrInputRequired = targetloading.ErrInputRequired
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: this change breaks the ABI in terms of the exact error string that we emit in such a case. Because we do not have an API/ABI strict stability guarantee and because it makes sense to avoid having so many duplicate errors, I think it makes sense to apply this change in the interested of reducing unnecessary duplication a bit.

model.NewOOAPIURLInfoWithDefaultCategoryAndCountry("b"),
model.NewOOAPIURLInfoWithDefaultCategoryAndCountry("c"),
}
return results, nil
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This fixes a test that I broke previously. Now that we have a loader, we need to return "a", "b", "c" here rather than using the Inputs fields above. With this change we're back at 100% coverage.

@bassosimone bassosimone marked this pull request as ready for review June 6, 2024 20:23
Copy link
Contributor

@DecFox DecFox left a comment

Choose a reason for hiding this comment

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

The changes look good to me. I left some comments which I think should make the diff good to go.

internal/registry/factory_test.go Outdated Show resolved Hide resolved
internal/reflectx/reflectx_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@DecFox DecFox left a comment

Choose a reason for hiding this comment

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

LGTM!

@bassosimone bassosimone merged commit 41a4282 into master Jun 7, 2024
18 checks passed
@bassosimone bassosimone deleted the issue/2607g branch June 7, 2024 07:18
@bassosimone bassosimone added the 2024-06-richer-input Tracking 2024-06 richer input work label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2024-06-richer-input Tracking 2024-06 richer input work
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants