Skip to content

Unit tests for argument parsing; one Run per --email end-to-end test - #214

Merged
JacobStephens2 merged 3 commits into
issue-174from
issue-205
Sep 30, 2026
Merged

JacobStephens2 merged 3 commits into
issue-174from
issue-205

Conversation

@JacobStephens2

Copy link
Copy Markdown
Owner

Summary

Argument parsing is now unit-tested in args. The two --email looping end-to-end tests were nine full Runs between them; now each is one Run.

 src/args.rs
+  mod tests
+    a_bare_flag_asks_for_email_to_and_an_address_after_the_flag_is_the_one_asked_for   # 5 cases
+    the_flag_goes_anywhere_around_a_merge_goal_and_never_takes_the_issue_url         # 6 cases
 tests/run_notification.rs
-  a_bare_flag_sends_to_email_to_and_an_address_after_the_flag_wins                  # 3 Runs
-  the_flag_works_in_any_position_and_never_takes_the_issue_url_as_its_address       # 6 Runs
+  a_bare_flag_sends_to_email_to                          # 1 Run: [url, --email] → email.to
+  merge_after_a_bare_flag_reaches_the_run_notification_as_the_goal   # 1 Run: [url, --email, merge] → "merged"

Every argument list the old loops ran is now a unit case. Each case asserts the Issue URL, the NotificationAsk (Send(None) or Send(Some(address))) and the goal.

Some of what the old Runs checked is still checked end to end by other tests:

  • An address after the flag wins over email.to: with_email_always_an_address_after_the_flag_still_wins.
  • A Run with no goal ends ready for review: a_run_ready_for_review_sends_one_notification_to_the_address_given.

Evidence

Timings are cargo test -q --test run_notification, three runs each. The machine was shared with other sessions, so the numbers are noisy.

  • Before: 48.8 s, 55.0 s, 48.5 s
    After: 37.7 s, 38.4 s, 32.9 s

  • cargo test --bin thirdshift args::: 2 passed.

  • A mutation check: when is_address was changed to accept merge, the position test failed.

  • Full suite: every binary passes. In the full run, spec_run::the_parallel_flag_wins_over_spec_parallel failed once under load. It depends on timing and doesn't touch this change. It passed twice on its own, and the whole spec_run binary then passed (63/63).

Merge Danger

Door: two-way

Blast Radius: tests-only

No production code changes. A regression in argument parsing is now caught by unit tests, not by the removed Runs.

Unaddressed findings

Standards

  • Duplicated code: the two unit tests share one loop shape and could be one table. Skipped. Each test names one rule and mirrors one of the end-to-end tests it replaces, which keeps a failure easy to read.
  • Mysterious Name (mild): the first unit test's name joins two behaviours with "and". Skipped. The two behaviours are one rule, a bare flag against an address, and the old end-to-end name had the same shape.
  • Duplicated code: the two remaining end-to-end tests repeat the same four setup lines. Skipped. Every test in tests/run_notification.rs sets up its Scenario inline, and extracting a helper for two tests would break that pattern.

Spec

  • Nit: the email word form and an address before the Issue URL reach a real Run only through other end-to-end tests. Skipped. Both parse to the same RunArgs the unit tests pin, and a_merge_run_sends_one_notification_that_it_merged already runs ["email", "me@example.com", "merge", url].
  • Scope creep (minor): one unit case, ["--email", "flag@example.com", URL], wasn't in the old loops. Kept. It pins an address before the Issue URL, which costs nothing.

Closes #205

🤖 Generated with Claude Code

JacobStephens2 and others added 3 commits September 30, 2026 21:01
The two --email looping tests in run_notification ran nine full Runs
to cover flag position, bare flag against an address, the Issue URL
never taken as an address, and merge before and after. args now has
unit tests for every one of those cases, and each end-to-end test is
cut to one Run showing the parsed arguments reach the Run notification.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@JacobStephens2
JacobStephens2 merged commit d43f48c into issue-174 Sep 30, 2026
13 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-205 branch September 30, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant