You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(ps-cache-kotlin): correct README ports, DB config, and reproduction steps (#124)
- Fix app port: 8080 (not 8090) per application.properties
- Fix DB config: testdb/postgres/postgres on port 5432 (not demodb/testpass on 5433)
- Add Docker Compose option as the recommended approach
- Document environment variables with their defaults
- Fix scoring description: +5 tiebreaker bonus (not +50/-50)
- Add note about variable test numbering
- Quote curl URLs for shell safety
Signed-off-by: slayerjain <shubhamkjain@outlook.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: ps-cache-kotlin/README.md
+62-33Lines changed: 62 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ The JDBC driver (PostgreSQL JDBC + HikariCP) caches prepared statements per conn
11
11
3. Sort-order prediction starts from 0 on a fresh connection, pointing to the wrong window's mocks
12
12
13
13
### Real-world impact
14
-
This was reported by a customer running a Kotlin/Spring Boot app with Agoda's travel account service. Test-6 (member_id=31) returned Alice's data (member_id=19) instead of Charlie's — **silently returning the wrong customer's financial data**.
14
+
This was reported by a customer running a Kotlin/Spring Boot app with Agoda's travel account service. The post-eviction test returned Alice's data (member_id=19) instead of Charlie's — **silently returning the wrong customer's financial data**.
15
15
16
16
## Architecture
17
17
@@ -39,84 +39,113 @@ This was reported by a customer running a Kotlin/Spring Boot app with Agoda's tr
ACTUAL: {"id":1, "memberId":19, "name":"Alice", "balance":1000} <- WRONG PERSON
86
102
```
87
103
104
+
> **Note:** The exact test number that fails depends on how many health-check
105
+
> requests keploy captures during recording (typically test-5 through test-7).
106
+
88
107
**With obfuscation enabled (worse):**
89
108
```
90
-
test-5: EXPECTED Charlie → ACTUAL Alice
91
-
test-6: EXPECTED Diana → ACTUAL Bob ← TWO wrong results
109
+
Post-eviction member=31: EXPECTED Charlie -> ACTUAL Alice
110
+
Post-eviction member=42: EXPECTED Diana -> ACTUAL Bob <- TWO wrong results
92
111
```
93
112
94
113
### With the FIXED keploy binary
95
114
```bash
96
-
# Same steps → all tests pass, correct data for each member
115
+
# Same steps -> all tests pass, correct data for each member
97
116
```
98
117
99
118
## What the Fix Does
100
119
101
120
The fix adds **recording-connection affinity** to the Postgres mock matcher (see [keploy/integrations#121](https://github.com/keploy/integrations/pull/121)):
102
121
103
122
1. When the first `Bind` mock is consumed on a replay connection, its recording `connID` is stored
104
-
2. Subsequent scoring applies +50/-50 bonus/penalty to prefer mocks from the same recording window
123
+
2. Subsequent scoring applies a small tiebreaker bonus to prefer mocks from the same recording connection
105
124
3. Only activates when 2+ distinct recording connections exist (zero impact on single-connection apps)
106
125
107
126
## Configuration
108
127
109
128
### application.properties
110
129
| Property | Value | Purpose |
111
130
|----------|-------|---------|
131
+
|`server.port`|`8080`| HTTP server port |
112
132
|`spring.datasource.hikari.maximum-pool-size`|`1`| Forces all requests through one connection |
113
133
|`prepareThreshold=1`| JDBC URL param | Caches PS after first use |
114
-
|`spring.sql.init.mode`|`never`| Schema created externally |
134
+
|`spring.sql.init.mode`|`never`| Schema created externally (via init.sql) |
135
+
136
+
### Environment variables (defaults in parentheses)
0 commit comments