Skip to content
Skills Library
Programming · Testing

concurrent-write-interleaving

/concurrent-write-interleaving

Issue two writes to the same record together and read the result, because an unguarded update lets the later write silently discard the earlier one. Use when the API permits concurrent updates to one record and the interleaving behaviour is unconfirmed

Repository
flawpath ↗
Licence
MIT
Last repository change
28.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
2
Deprecation

No signals detected. Repository changed on 28.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Issue two writes to the same record together and read the result, because an unguarded update lets the later write silently discard the earlier one. Use when the API permits concurrent updates to one record and the interleaving behaviour is unconfirmed

Original author description

Issue two writes to the same record together and read the result, because an unguarded update lets the later write silently discard the earlier one. Use when the API permits concurrent updates to one record and the interleaving behaviour is unconfirmed

How it works

  1. Procedure
  2. Signals
  3. Patterns
  4. Pitfalls
  5. Done when
  6. References
Original SKILL.md headings · 61 lines, 375 words
SKILL.md preview
---
name: concurrent-write-interleaving
description: "Issue two writes to the same record together and read the result, because an unguarded update lets the later write silently discard the earlier one. Use when the API permits concurrent updates to one record and the interleaving behaviour is unconfirmed"
pack: flawpath
version: 1.0.0
category: backend-api
tags: [probe, concurrency, state]
---

# Concurrent Write Interleaving

> Issue two writes to the same record together and read the result, because an unguarded update lets the later write silently discard the earlier one

**Use when:** the API permits concurrent updates to one record and the interleaving behaviour is unconfirmed

**Avoid when:** an optimistic locking or version field is enforced and a test confirms a conflict is rejected

## Procedure

1. Confirm the boundary permits concurrent requests and that a rollback exists for the record.
2. Capture the record's state, then send two updates touching different fields at the same time.
3. Read the record back and record whether both changes survived or one was lost.
4. Repeat if the first attempt happened to serialize by timing, since a clean result may just be luck.
5. Check for a version, etag or updated-at guard in the request and response.
6. Record the observed behaviour as guarded, lost update, or serialized by timing with evidence.

## Signals

- Two updates to different fields result in only one surviving
- No version or etag guard appears in the request or response contract
- The record's updated-at is identical after two logically separate writes
- A repeat of the test yields a different outcome, indicating timing dependence

## Patterns

**1. Interleaving record**

```text
write A {field1} and write B {field2} sent together -> read-back: field1 unchanged, field2 applied; verdict: lost update
```

**2. Guard check**

```text
look for version, etag or updated-at in both directions; absence is recorded as no guard rather than as safe by default
```

**3. Repeat rule**

```text
a single clean run may be serialization by luck; repeat enough times to state the behaviour honestly
```

## Pitfalls

- Concluding safe behaviour from one run that happened to serialize
- Changing two fields in one request rather than issuing two requests
- Reporting a lost update without noting whether a guard field exists but was not supplied

## Done when

- Two concurrent writes have a recorded read-back showing which changes survived
- The presence or absence of a version guard is stated, with repeats to rule out luck

## References

- [CWE-362 - Concurrent execution using shared resource with improper synchronization](https://cwe.mitre.org/data/definitions/362.html)
- [OWASP - Race condition guidance](https://owasp.org/www-project-web-security-testing-guide/)

Versions

The database has no other skills named concurrent-write-interleaving.

Database snapshot: 13.11.2026 · package version fdf3212d563e (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100handle-optimistic-concurrency
    Enable and handle ABP optimistic concurrency control so concurrent updates to the same record are detected and rejected. USE FOR: enabling concurrency with IHasConcurrencyStamp/ConcurrencyStamp, deriving from aggregate root base classes to get it for free, flowing the stamp…
  • 90testing-concurrent-behavior
    Use when testing concurrent behavior is required during quality work, especially when the result must be traceable, independently reviewable, and safe to hand to another agent.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.