Skip to content

chore: strengthen V1.2 idempotency test and dedupe release-gate helper#178

Merged
duncanita merged 1 commit into
mainfrom
chore/v1.2-simplify-followup
May 7, 2026
Merged

chore: strengthen V1.2 idempotency test and dedupe release-gate helper#178
duncanita merged 1 commit into
mainfrom
chore/v1.2-simplify-followup

Conversation

@duncanita
Copy link
Copy Markdown
Owner

Summary

Three follow-up fixes surfaced by a /simplify review of #176 / #177.

  • Strengthen the renewal idempotency contract test. test_contract_renew_effect_lease_is_idempotent_when_until_ms_unchanged previously only checked lease_until_ms. The port docstring promises the no-op case returns an unchanged record, so the test now also asserts lease_owner, status, and updated_at_ms are invariant. This is what would have caught a regression that quietly applied record.with(...) in the no-op branch.
  • Drop a no-op .downcase in the V1.2 release-gate test. The docstring fragment \"cooperatively extend the lease\" is already lowercase in lib/dag/ports/storage.rb, so the call only masked an inconsistency with the case-sensitive signature assertion right above it.
  • Dedupe the normalized(path) helper. It was identical in both spec/r0/v1_1_release_gate_test.rb and spec/r0/v1_2_release_gate_test.rb. Moves it into spec/support/release_gate_helpers.rb and auto-includes it on Minitest::Test, matching the convention used by RunnerFactory, WorkflowBuilders, StepHelpers, and EventHelpers.

Test plan

  • bundle exec rake green: 597 runs, 40598 assertions (+3 from the strengthened idempotency test), 0 failures, 0 offenses.
  • The strengthened idempotency test fails as expected if the no-op early-return in StorageState#renew_effect_lease is removed (verified by reasoning, not destructive change).

Out of scope

/simplify surfaced several findings that we deliberately skipped:

  • Setup duplication across the eight renew_effect_lease contract tests — by design, the contract suite values stand-alone readability over DRY.
  • The # Implements Ports::Storage#X doc comments — uniform across storage_state.rb, more navigation than narration.
  • The record.with(...) → state[:effects][id] = updated pattern — transparent enough not to merit extraction.
  • Repeated File.read in release-gate tests — full suite runs in ~0.7s, not worth caching.

🤖 Generated with Claude Code

Three follow-up fixes from a /simplify review of the V1.2 changes:

- Strengthen `test_contract_renew_effect_lease_is_idempotent_when_until_ms_unchanged`
  to assert what the port docstring promises: when `until_ms == lease_until_ms`,
  the renewal must return an unchanged record. The previous assertion only
  checked `lease_until_ms`, leaving the no-op invariant on `lease_owner`,
  `status`, and `updated_at_ms` untested.
- Drop a no-op `.downcase` in the V1.2 release-gate test: the docstring
  fragment is already lowercase in the source, so the call only masked an
  inconsistency with the case-sensitive signature assertion above it.
- Extract the duplicated `normalized(path)` helper from `v1_1_release_gate_test.rb`
  and `v1_2_release_gate_test.rb` into `spec/support/release_gate_helpers.rb`
  so future release-gate suites pick it up automatically.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@duncanita duncanita merged commit 48cb4d3 into main May 7, 2026
6 checks passed
@duncanita duncanita deleted the chore/v1.2-simplify-followup branch May 7, 2026 09:18
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