sync: small cleanups after #69
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start in crates/tern-sync/src/github.rs: the Method-to-verb match lives in UreqHttp::send, and current_keychain, current_gh and current_http hold the cfg(test) branches. Pull the mapping into a pure verb(Method) function with a unit test, and replace the unreachable-code branches with paired cfg(test) and cfg(not(test)) blocks. Move UnsetKeychain, UnsetGh, UnsetHttp and FakeGh into a cfg(test) mod test_support. Done when the new test passes, the existing 47 tests still pass, and CONTRIBUTING.md has been followed.
Written by the indexing model from the issue text.
Description
What would you like to be added?
Three follow-ups from the review of #69, all in crates/tern-sync/src/github.rs:
- The Method → HTTP verb mapping is untested.
UreqHttp::sendmatchesMethod::Post => post, Method::Patch => patch. Hand-swapping that arm leaves all 47 tests green, becauseUreqHttpis excluded from mutation testing. Pull the mapping into a purefn verb(Method) -> &'static stroutside the adapter, callagent.request(verb(m), url), and add a unit test. current_keychain/current_gh/current_httpuse#[cfg(test)] if … { return } else { return }plus#[allow(unreachable_code)]on the release path. A pair of#[cfg(test)]/#[cfg(not(test))]blocks would read more clearly.- About 130 lines of test-only code (
UnsetKeychain,UnsetGh,UnsetHttp,FakeGh) sit ingithub.rs. Move them to a#[cfg(test)] mod test_supportso the adapter file stays about production code.
Why is this needed?
The first closes the last untested piece of the push path: nothing yet proves that creating a gist sends POST. The other two keep github.rs easy to read for the next person who touches token or push code.
Difficulty: easy. Read CONTRIBUTING.md before opening a pull request.
- Dominant language
- Rust
- Stars
- 2
- Forks
- 2
- Avg merge
- 1h 56m
- Merged PRs (30d)
- 36
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from your-moon/tern
-
area::tern kind::feature triage::needs-decision
Difficulty 5/5 Over a week Newbie friendliness 22/100
Maintainers usually reply within 1 day
-
area::tern kind::feature triage::needs-decision
Difficulty 3/5 1-2 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
area::tern kind::feature triage::needs-decision
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
area::tern kind::feature triage::needs-decision
Difficulty 5/5 Over a week Newbie friendliness 12/100
Maintainers usually reply within 1 day
-
area::tern kind::bug triage::ready
Difficulty 3/5 Half a day Newbie friendliness 62/100
your-moon/tern#64 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
agent:triaged bug bughunt pm:bundler priority:p1
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
SocketDev/socket-patch#1573 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
bytecodealliance/rustix#1706 · 1 comment ·
Maintainers usually reply within 11 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
wormhole-foundation/wormhole#5062 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day