Detect concurrency hazards API
Flag potential race and shared-state hazards in caller-supplied source using deterministic pattern matches for async/concurrency markers, shared globals, and TOCTOU-shaped spans. The code is not executed.
The Detect concurrency hazards operation is part of the Source Code Structure & Correctness Checks API on BRAINIAC.software. Flag potential race and shared-state hazards in caller-supplied source using deterministic pattern matches for async/concurrency markers, shared globals, and TOCTOU-shaped spans. The code is not executed. It is exposed as POST /api/v1/code/concurrency-hazard-detect and priced at $0.04 USDC on Base. Payment uses the x402 exact scheme: an unpaid call returns HTTP 402 with payment requirements; after paying the exact USDC amount, retry the same request with a payment-signature header and Idempotency-Key. No account and no API key are required. Data sources for this product: Caller-supplied source text, AST, module edges, and change sets processed locally Limitations: The parser builds a structural AST for maintainability metrics. It is not a compiler and it does not run the code. Coupling, concurrency, and error findings are deterministic text/graph checks. They are not proof of a production defect. JavaScript, TypeScript, and Go are read from braces and keywords. Python is read from indentation. No repository checkout, CI system, or test runner is used. Outputs are compliance prechecks, drafts, or data lookups for human review. They are not official determinations, legal advice, identity confirmation, or certified filings. Related operations in this group include Index source maintainability, Analyze change coupling, Audit error propagation. Open the group documentation for the full request schema, field notes, and response examples before integrating.
/api/v1/code/concurrency-hazard-detectExample request
curl -i -X POST "https://www.brainiac.software/api/v1/code/concurrency-hazard-detect" \
-H 'content-type: application/json' \
-H 'Idempotency-Key: <fresh-64-character-random-hex-key>' \
--data-binary @- <<'JSON'
{
"files": [
{
"path": "worker.js",
"language": "javascript",
"source": "let sharedCounter = 0\nasync function tick() {\n const checked = sharedCounter\n await Promise.resolve()\n sharedCounter = checked + 1\n}\n"
}
]
}
JSONAn unpaid probe returns HTTP 402 with x402 payment requirements. After paying the exact USDC amount on Base, retry the identical request with a payment-signature header.
FAQ
- Do I need an API key? No. Pay the listed USDC amount with x402.
- What network? Base (eip155:8453), USDC.
- Is this an official determination? No. Results are for human review against the cited sources.
Related operations
- Index source maintainability — $0.04 USDC
- Analyze change coupling — $0.04 USDC
- Audit error propagation — $0.04 USDC
Related APIs
Source Code Structure & Correctness Checks APIFull docsHow it works