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

Metadata API: Consider removing 'update()' methods #1627

Closed
lukpueh opened this issue Oct 20, 2021 · 3 comments · Fixed by #1736
Closed

Metadata API: Consider removing 'update()' methods #1627

lukpueh opened this issue Oct 20, 2021 · 3 comments · Fixed by #1736
Assignees
Labels
backlog Issues to address with priority for current development goals repository Related to the repository implementation

Comments

@lukpueh
Copy link
Member

lukpueh commented Oct 20, 2021

[edited on 12/20/2021: Mention ".json" bias]
[edited on 11/10/2021: Point to #1230]

Description of issue or feature request:

The Metadata API classes for top-level roles Targets, Timestamp and Snapshot each have an update method. They have been criticised in several places (#1193 (comment) pp, #1223 (comment) pp, #1620 (comment)).

More specifically the following doubts have been expressed:

Current behavior:

  • purpose of method is unclear
  • method name is ambiguous

Expected behavior:

  • Make a better case for the purpose and names of methods and document it, or replace/remove.
@jku
Copy link
Member

jku commented Oct 26, 2021

The case for (better named) update methods is that they do allow us to do validation on user input, while inserting things directly to a dictionary does not.

This is a major advantage in an untyped language but, I think, made slightly less important with good static typing support: calling code is still free to insert nonsense into our Metadata data structures, but static typing checks will inform them that they are doing bad things (at least it will once we fix #1633). We may still want to do the input validation but I would argue it's not as critical as it would be otherwise.

@sechkova sechkova added the repository Related to the repository implementation label Oct 27, 2021
@sechkova sechkova added the backlog Issues to address with priority for current development goals label Nov 10, 2021
@MVrachev
Copy link
Collaborator

Issue #1230 and this one are almost the same.
Maybe we can close #1230?

@lukpueh
Copy link
Member Author

lukpueh commented Nov 10, 2021

Added one concern from #1230 to the issue description above. Will close there.

@lukpueh lukpueh self-assigned this Dec 8, 2021
lukpueh added a commit to lukpueh/tuf that referenced this issue Dec 20, 2021
Remove ambiguous, unspecific, opinionated and trivial 'update'
methods, which can be replaced by feasible one-liners that assign
values directly to the object attribute to be *updated*. (see theupdateframework#1627
for details).

Reasons to have these methods would be increased usability in terms of
- reduced work
- immediate feedback on invalid assignments

However, given above described issues, the reasons against the
methods as they are now seem to outweigh the reasons for them.
Furthermore, it seems easier to re-add similar methods, which
addressed these issues, after the upcoming 1.0.0 release than to
remove or modify them.

This patch also removes the corresponding tests as they become
irrelevant (there is no need to test object assignment).  In the
case of the timestamp test, the removal also includes redundant
test logic, which is already tested in `test_metadata_base`.

Signed-off-by: Lukas Puehringer <[email protected]>
lukpueh added a commit to lukpueh/tuf that referenced this issue Dec 21, 2021
Remove ambiguous, unspecific, opinionated and trivial 'update'
methods, which can be replaced by feasible one-liners that assign
values directly to the object attribute to be *updated*. (see theupdateframework#1627
for details).

Reasons to have these methods would be increased usability in terms of
- reduced work
- immediate feedback on invalid assignments

However, given above described issues, the reasons against the
methods as they are now seem to outweigh the reasons for them.
Furthermore, it seems easier to re-add similar methods, which
addressed these issues, after the upcoming 1.0.0 release than to
remove or modify them.

This patch also removes the corresponding tests as they become
irrelevant (there is no need to test object assignment).  In the
case of the timestamp test, the removal also includes redundant
test logic, which is already tested in `test_metadata_base`.

Signed-off-by: Lukas Puehringer <[email protected]>
sechkova pushed a commit to sechkova/tuf that referenced this issue Dec 21, 2021
Remove ambiguous, unspecific, opinionated and trivial 'update'
methods, which can be replaced by feasible one-liners that assign
values directly to the object attribute to be *updated*. (see theupdateframework#1627
for details).

Reasons to have these methods would be increased usability in terms of
- reduced work
- immediate feedback on invalid assignments

However, given above described issues, the reasons against the
methods as they are now seem to outweigh the reasons for them.
Furthermore, it seems easier to re-add similar methods, which
addressed these issues, after the upcoming 1.0.0 release than to
remove or modify them.

This patch also removes the corresponding tests as they become
irrelevant (there is no need to test object assignment).  In the
case of the timestamp test, the removal also includes redundant
test logic, which is already tested in `test_metadata_base`.

Signed-off-by: Lukas Puehringer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Issues to address with priority for current development goals repository Related to the repository implementation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants