Test the update check's store failures and what an API token's request is told

Open
#804 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
backend, testing

Research direction

Start with crates/adapters/store/src/row.rs (release_check) and crates/adapters/store/src/lib.rs (release_check, keep_release_check) to see how a corrupt update_version and a failing database surface as StoreError, then read app::updates::CheckForUpdates and its store fake in the app tests to see how the loop reacts and logs. For part 2 read answer_told in crates/adapters/http/src/sign_in.rs and the existing the_session_route_tells_the_available_update_with_the_build test, then decide whether an API-token request gets available-update and record the answer in §4.6 or §10.7. Done when each new test fails if its behavior changes and decision 107 point 7 is reflected.

Written by the indexing model from the issue text.

Description

enhancement priority: low

#802 (update notice, #513 stage 1) left two paths without a test. Its review named both as P3 test gaps, and the maintainer wants them covered.

1. The store's release-check failure branches

In crates/adapters/store:

  • row::release_check refuses a stored update_version that isn't a version (reader.corrupt("update_version", …)). No test seeds a corrupt row and checks that the read fails as corrupt, nor what app::updates::CheckForUpdates does then. Decision 107, point 7, says the next check overwrites a version this build couldn't have written rather than stop checking.
  • release_check and keep_release_check (lib.rs) return StoreError when the database fails. No test drives either failure through CheckForUpdates to show the loop logs it and keeps checking: no panic, no stop, and no notice lost or invented.

Tests: a store test with a corrupt release_check row; app tests with the store fake failing on read and on write, asserting what the loop does next and what the log says.

2. available-update on a request made with an API token

The session route (crates/adapters/http/src/sign_in.rs, answer_told) adds build and available-update whenever the build is shown. the_session_route_tells_the_available_update_with_the_build covers a signed-in session. Nothing pins what a request made with an API token gets. Decide and pin one of:

  • the same as a session (the current behavior), or
  • nothing, because a token's scopes don't cover it.

Either way, it's one test, plus a line in §4.6 or §10.7 if the answer isn't already written down.

Acceptance

Each case above has a test that fails if its behavior changes. For 2, the design states the answer.

Dominant language
Rust
Stars
0
Forks
0
Avg merge
56m
Merged PRs (30d)
349

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nledford/Ladderback

All issues in nledford/Ladderback

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.