Skip to content

[FINAL] CI Integration#1

Merged
jeiting merged 9 commits into
masterfrom
feature/ci
Mar 30, 2018
Merged

[FINAL] CI Integration#1
jeiting merged 9 commits into
masterfrom
feature/ci

Conversation

@jeiting

@jeiting jeiting commented Mar 30, 2018

Copy link
Copy Markdown
Contributor

No description provided.

@jeiting jeiting merged commit 18c3329 into master Mar 30, 2018
jeiting added a commit that referenced this pull request May 1, 2018
@vegaro vegaro deleted the feature/ci branch January 15, 2019 18:37
vegaro pushed a commit that referenced this pull request Jun 23, 2026
### Motivation

Follow-up test coverage for #3603. That PR's refactor commit (`b2bfd86`)
fixed a bug where `workflowId`/`stepId` were `@Transient` on the cached
transaction metadata and were lost on the disk round-trip, so
`presented_workflow_id` / `presented_step_id` would be sent as `null` on
retry or unsynced replay. The field was promoted to a first-class
`workflowMetadata` on `LocalTransactionMetadata` with
`@SerialName("workflow_metadata")`, but there was no regression test
asserting it actually survives serialization.

### What this adds

One test in `LocalTransactionMetadataStoreTest`,
`cacheLocalTransactionMetadata round-trips workflow metadata`, mirroring
the existing `handles paywall data` test. The JSON written to
`SharedPreferences` is captured and fed back to
`getLocalTransactionMetadata`, so the real `JsonTools.json`
encode/decode runs (only SharedPreferences I/O is mocked).

### Verification (RED → GREEN)

- **RED**: with `workflowMetadata` marked `@Transient`, the test fails
at the assertion (`retrieved?.workflowMetadata` is `null`).
- **GREEN**: with `@SerialName("workflow_metadata")` (current state), it
passes.

Ran `:purchases:testDefaultsBc8DebugUnitTest --tests
"...LocalTransactionMetadataStoreTest"` locally (JDK 21).

Companion to #3636 (which covers the `PostReceiptHelper` threading and
replay paths). Together they close the two test gaps identified in
review of #3603.

<details>
<summary>AI session context</summary>

**Task:** Review #3603 ("is anything missing?"), then close the
identified test gaps.

**Findings from review of #3603:**
1. (important) Disk round-trip of `workflowMetadata` untested, the exact
bug `b2bfd86` fixed. `LocalTransactionMetadataStoreTest` had the
analogous `handles paywall data` round-trip test but nothing for
`workflowMetadata`.
2. (important) `PostReceiptHelper` threading untested (only an `any()`
count bumped). → covered by #3636.

**This PR** addresses finding #1.

**Decisions:**
- Reused the existing capture-the-written-JSON pattern so the test
exercises real serialization, not a mock, which is what makes it a
genuine guard for the `@Transient` regression.
- Based on `cesar/receipt-presented-paywall-workflow-ids` because the
`workflowMetadata` field only exists there, not on `main`.

**Verified:** RED→GREEN as described above. Production code
(`LocalTransactionMetadata.kt`) left unchanged; only the test file is
added.

**Not done:** The remaining review items on #3603 were questions, not
test gaps (all-or-nothing `WorkflowMetadata.from`, impression/purchase
step-id divergence under dedup, `pr:other` vs `pr:fix` label). Not
addressed here.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
</details>

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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