Code review
Flag hidden side effects
Identify functions whose names and contracts hide observable changes.
01 The question
Does this function change observable state in a way that is not apparent from its name or supplied contract?
- true
- It writes external or shared state, performs I/O, or mutates an argument without making that behavior clear.
- false
- It is read-only, or its observable changes are clearly part of the supplied contract.
Copy includes the complete instructions, criteria, usage notes, and attribution.
02 Input
A complete function, relevant surrounding state, and its documented contract.
{
"code": "let views = 0;\nfunction getPrice(product) {\n views += 1;\n return product.price;\n}",
"contract": "getPrice returns the product price. No side effects are documented."
}03 Answer & policy
A Noul probability that the function has an undisclosed observable side effect.
Your code decides what happens next.
Use a high probability to start a review conversation, not to automatically reject code. The example reports the probability without choosing a universal cutoff.
04 Use it in your code
Node.js 24 · TypeSafe SDK 0.6.0 · Set TYPESAFE_API_KEY in your environment. Run on your server; API calls incur provider charges.
import { noul, TypeSafeClient, type JsonValue } from "@typesafe-ai/sdk";
// Illustrative input, not a recorded model test.
const state: JsonValue = {
"code": "let views = 0;\nfunction getPrice(product) {\n views += 1;\n return product.price;\n}",
"contract": "getPrice returns the product price. No side effects are documented."
};
const client = new TypeSafeClient();
try {
const response = await client.systemOne({
model: "jev-latest",
state,
questions: {
hidden_effect: noul(
"Does this function change observable state in a way that is not apparent from its name or supplied contract?",
{
"true": "It writes external or shared state, performs I/O, or mutates an argument without making that behavior clear.",
"false": "It is read-only, or its observable changes are clearly part of the supplied contract."
}
)
},
});
console.log({ hiddenEffectProbability: response.answers.hidden_effect.noul, action: "human_review" });
} catch (error) {
console.error("Decision unavailable; use your fallback or human review.", error);
process.exitCode = 1;
}The wrapper and example input are provided by Jev Directory. Checked against SDK types; no live model call was made. Pin a model version before evaluating production behavior.
Before you adapt it
- Missing caller or contract context can make an intentional effect look unexpected.
- This is not Jeff’s built-in rule or a claim of CLI compatibility.
More about the original project or pattern
What it does
Jeff checks files against twenty named semantic rules. The catalog covers concerns such as unclear responsibility, hidden side effects, weak error context, unnecessary complexity, duplicated domain knowledge, fragile control flow, boundary separation, and testability.
What you can reuse
The strongest reusable idea is the rule contract: a stable identifier, a narrow question, and a CI-compatible outcome. Jeff separates a conclusive violation from an inconclusive or provider error through distinct exit codes, which is valuable whenever probabilistic judgments enter an automated check.
How it fits
Source files and a fixed rule catalog become typed checks. The CLI can print a human-readable report or JSON for automation. Jev performs semantic judgment; the process controls input discovery, result formatting, and exit behavior.
Setup and compatibility
The documented interface is jeff check, with optional JSON output and cache control. Authentication uses a TypeSafe API key from the environment or the operating system keyring. A custom TypeSafe-compatible base URL can be configured for testing.
Limitations
The visible repository did not show a license at review time, so this entry links to the implementation without republishing its code. The README documents a built-in rule set; it does not establish a portable third-party rule format. Jev Directory has not run the CLI.
Sources
Primary source: Jeff repository.