ICIJ / datashare

A self-hosted search engine for documents.
https://datashare.icij.org
GNU Affero General Public License v3.0
598 stars 54 forks source link

chore: improve TaskView encapsulation #1404

Open ClemDoum opened 5 months ago

ClemDoum commented 5 months ago

Current behavior

Today, the signature of TaskFactoryHelper.createTaskCallable is:

public class TaskFactoryHelper {
    public static Callable<?> createTaskCallable(
        TaskFactory factory, String name, TaskView<?> taskView, Function<Double, Void> progress
    )  throws UnknownTask;
}

The issue with this signature is that implementer get a TaskView as input of their task, while they should only need the TaskView.properties. By providing the full TaskView<?> taskView to the implementer, we give the task implementer control over the taskView state. In particular implementers can access setError, setResult which should only be called by the datashare-tasks codebase.

Expected behavior and potential solutions

Task implementer should not be allowed to update the task state as this can have detrimental side effects.

Potential solutions:

github-actions[bot] commented 4 months ago

This issue is stale because it has been open for 40 days with no activity.

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 40 days with no activity.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 40 days with no activity.