Review principles
We use lenses like security and testing to surface risks and trade-offs, and guards to check changes against explicit principles. When a change departs from a principle, we look for a clear reason. These built-in practices are a starting point, shaped by your team’s guidance, your product’s direction and what we find in the codebase.
Guards
AI Completeness
Checks whether plausible-looking code delivers its promised behaviour end to end, including ordinary edge cases and state transitions.
Type Safety Regression
Trace a weakened type through input, decisions and output. Check whether formerly unrepresentable states can now reach behaviour that cannot handle them.
Why it matters. The compiler can otherwise catch missing cases before a plausible-looking branch ships.
Follow Behaviour Beyond the Happy Path
Trace a realistic non-success input or result through the changed path and verify that the promised behaviour is implemented end to end.
Why it matters. The success case can work even when routine exceptions stop a feature from doing its job.
Verify the Work Behind the Interface
Trace a plausible-looking function to the validation, write, retry or other effect its contract promises. Check reachable call paths and required inputs.
Why it matters. A correct name and return type can make work that never happens look complete.
Check Assumptions at Real Boundaries
Trace external values and their guarantees before relying on shape, bounds or presence. Check realistic values the caller or parser can pass.
Why it matters. Production inputs exercise assumptions that representative examples can miss.
Account for Reachable States
Check that changed decisions account for valid, invalid and transitional states with a meaningful outcome for each relevant case.
Why it matters. A default branch can silently discard a state the rest of the system depends on.
Trace What the Caller Learns from Failure
When handling looks complete, follow the returned value through its consumer and check whether the feature signals the degraded or failed result it promises.
Why it matters. A handler can appear to recover while the caller proceeds on an outcome that never happened.
Check Existing Behaviour Before Reimplementing It
When new code duplicates an established operation, compare the full contract and identify behaviour it now omits or risks letting drift.
Why it matters. Matching the common case is easy. The existing path may carry safeguards the replacement leaves behind.
Code Quality
Checks that changes preserve useful type guarantees and fit the codebase, with complexity and boundaries justified by the work they serve.
Finish the Implementation Behind the Contract
Review executable placeholders on reachable production paths. Verify that the implementation performs the effect its caller expects.
Why it matters. A default return can satisfy the interface while leaving the real work unfinished.
Type Safety Regression
Keep useful compile-time guarantees when changing domain types. Preserve exhaustive handling, validation boundaries and constraints callers depend on.
Why it matters. Type guarantees make later changes easier to check safely.
Choose the Simplest Correct Design
Prefer the simplest design that meets the current requirements and preserves necessary constraints.
Why it matters. Each extra decision and indirection makes the next change harder to reason about.
Build for the Need at Hand
Require a present requirement before adding optional modes, extension points or speculative generality.
Why it matters. A feature the team cannot yet specify still costs review and maintenance effort.
Require an Abstraction to Earn Its Cost
Introduce abstraction when a real variation, reuse or boundary justifies it. Check what implementation detail the abstraction must expose to stay accurate.
Why it matters. An abstraction based on a guessed similarity can make later changes more coupled.
Verify What Is Unused Before Removal
Trace readers, registrations and runtime entry points before removing dead code. Remove code when its lack of consumers is established.
Why it matters. Unused paths consume review time, while a missing runtime registration can break callers that static search misses.
Keep Boundaries Intentional
Use a provider or component boundary when it makes a concrete concern easier to change, test or enforce. Keep meaningful provider constraints visible and weigh the cost against premature abstraction.
Why it matters. A good boundary isolates change without giving reviewers a misleading model of the dependency.
Reuse Established Patterns Where They Fit
Compare a new approach with supported local patterns and name the concrete reason for any meaningful divergence.
Why it matters. Consistent approaches let a fix or a review benefit from what the team already understands.
Keep Values in Their Intended Context
Review reuse of values and helpers for differences in units, scope, time windows and domain meaning. Expose the distinction where callers can see it.
Why it matters. A value that looks interchangeable can silently change a decision when reused in another context.
Retire Schema Fields with Their Consumers in Mind
Trace producers, readers and compatibility obligations before deprecating, repurposing or removing shared schema fields.
Why it matters. A field can be dormant in one code path and still be depended on by another consumer.
Preserve Useful Batching
Trace the workload and its bounds when replacing a batch operation with sequential calls. Check whether the extra round trips create a material regression.
Why it matters. A path that is quick with a few items can dominate latency at production sizes.
Data Consistency
Checks that producers, consumers and stores agree on data identity, meaning, accepted inputs and concurrency guarantees.
Agree on Identity Across Producers and Consumers
Check that writers and readers share an exact contract for keys, partitions and field names across runtimes and storage boundaries.
Why it matters. A key mismatch can look like an empty result and escape error monitoring.
Preserve the Meaning of Shared Data
Keep units, scope, time windows and interpretation consistent where systems exchange or compare values.
Why it matters. Two correct values can still produce a wrong decision if their meanings are incompatible.
Align Defaults Across Runtimes
Agree on how a missing, null or defaulted value is represented and interpreted across producers and consumers.
Why it matters. Old records and mixed deployments often surface default mismatches first.
Preserve Intended Query Scope
When changing filters, prove the result set or mutation remains scoped to the intended owner, tenant, lifecycle or query contract.
Why it matters. Removing a predicate can turn an ordinary data change into an isolation or correctness failure.
Keep Shared State Consistent Under Concurrency
Protect dependent reads and writes using the appropriate transaction, condition or lock. Check the interleavings introduced by the change.
Why it matters. An invariant that holds in one execution can fail when two operations overlap.
Keep Serialized Contracts Compatible
Consider old records, mixed-version services and queued messages when changing field names, types, defaults or required inputs.
Why it matters. Stored and in-flight data can outlast the version that produced it.
Trace Every Producer of a Newly Required Input
Before requiring an input, identify every producer and determine how old or queued input will be handled during transition.
Why it matters. One overlooked producer can turn an apparently safe deploy into a partially broken workflow.
Make Changes to Accepted Inputs Explicit
Identify inputs newly accepted or rejected and verify that the contract change is intentional, compatible where needed, and tested at the boundary.
Why it matters. A quiet change in what passes validation can move errors farther downstream.
Bound Per-Item Data Access
Follow the maximum item count and operation cost when changing batch or per-item data access. Require a bounded or batched path where the workload makes fan-out material.
Why it matters. An unbounded number of calls can make a data path unreliable as data grows.
Key Manifest Metadata by Full Object Identity
Keep per-object metadata keyed by the same full identifier the reader uses. For Superpositional’s manifests, the convention is the complete object key.
Why it matters. Objects can share a basename while representing independent files and metadata.
Data Lifecycle
Checks what can delete or overwrite data, how that work is bounded, and whether recoverable data can be restored within agreed limits.
Fence Destructive Work Against Superseded Runs
Bind deletion and overwrite authority to the current owner or generation. Check that a worker that lost ownership cannot continue changing shared state.
Why it matters. A worker can finish after another run has become authoritative.
Bound Destructive Operations
Check scope and apply count, fraction or other risk-based limits that stop unsafe work visibly before it proceeds.
Why it matters. A bad selector or unexpectedly large result set should stop before it causes widespread loss.
Enforce the Declared Data Lifecycle
Derive destructive scope from explicit retention and durability rules. Verify that rebuilding derived data leaves durable records outside its reach.
Why it matters. The ability to rebuild an index gives no recovery path for records that existed only in that store.
Declare Durability for New Collections
Record whether a new collection is derived or durable and state its source, retention and recovery requirements.
Why it matters. The declaration gives cleanup, backup and restore routines an explicit contract for new data.
Advance Coordination State Under Its Authority
Claim and advance run-scoped state only under the lock, lease or conditional write that owns it. Carry the relevant state across retries.
Why it matters. Resetting a generation, claim or budget can let overlapping work bypass the intended ordering.
Test Recovery Against Data Loss and Downtime Limits
Before changing or deleting non-derivable data, verify a restore path and exercise it against agreed recovery time and recovery point objectives.
Why it matters. A backup only helps if it can restore usable data within the time and loss the service can tolerate.
Send Each Target Once in a Destructive Batch
Build a unique target set and apply the provider’s batch, scope and failure rules. Verify what happened for individual targets when partial success is possible.
Why it matters. Duplicate or ambiguous targets can reject a batch or leave cleanup only partially complete.
Delivery
Checks that changes are reviewable in proportion to their risk and have a safe path through rollout, abort and recovery.
Deliver Coherent End-to-End Slices
Group the changes needed to deliver one independently verifiable outcome. Separate unrelated work when it can ship on its own.
Why it matters. An end-to-end slice lets reviewers follow one behaviour from entry point to result.
Keep the Review Proportional
Keep changes focused enough to review thoroughly. Increase review depth and verification for critical or unusually risky changes, including small diffs.
Why it matters. A short diff can still change a high-stakes boundary, while one coherent feature may need several files.
Configure Production Controls
Use validated deployment configuration for values operators need to vary safely across environments or under load. Document meaningful defaults and bounds.
Why it matters. The team can change an operational control safely without changing the implementation.
Plan Rollout, Abort and Recovery
Stage risky changes and define promotion and abort criteria. Prepare a credible path through rollback, roll-forward or restore, taking any irreversible effects into account.
Why it matters. Reverting code may leave state changed. The recovery plan must account for the state the rollout can leave behind.
Failure Handling
Checks that failures stay truthful to callers and that retries, overload and dependency degradation stay within explicit limits.
Keep Failure Visible to the Caller
Propagate an actionable failure or return an explicit, safe degraded result. Keep successful-looking responses truthful about what completed.
Why it matters. Callers make further decisions from the result. A false success hides the point where they need to change course.
Complete Promised Failure Paths
Trace whether an altered failure or recovery path performs the promised work. A success placeholder on a reachable path is a review finding when it bypasses that work.
Why it matters. The first failure in production is a poor time to discover that recovery only returned success.
Keep Tests Aligned with Changed Failure Behaviour
When a failure outcome changes, trace the existing tests that claim to cover it and check that they still exercise and assert the revised contract.
Why it matters. A passing test can reassure the team about behaviour that no longer exists.
Preserve State and Retry Safeguards
Keep state transitions, invariants and idempotency protections in force when changing how work is accepted, applied or retried.
Why it matters. A replay or overlapping operation should leave the system in a valid state.
Reject Invalid Required Configuration
Validate required configuration at the appropriate boundary. Fail visibly when it is missing or invalid and when a fallback could violate the expected operating contract.
Why it matters. An apparently healthy service can operate against the wrong resource or policy for a long time.
Record What Actually Failed and Recovered
Check that every path recording a cause or recovery status supports what it claims. Distinguish work requested, attempted and completed.
Why it matters. An operator can only act safely if the recorded status reflects what happened.
Set Timeout and Retry Budgets
Set deadlines and cap attempts across dependency layers. Allow retries only where safe, with backoff and jitter as appropriate.
Why it matters. Retries consume time and capacity. Uncoordinated layers can turn one failure into an overload.
Bound Overload and Declare Degradation
Use bounded concurrency or queues and an explicit backpressure, shedding or fallback policy. Tell callers what service guarantees still hold during dependency failure.
Why it matters. A bounded system can protect useful work during overload and make partial service visible.
Infrastructure Wiring
Checks that changed application paths have the handlers, resources, configuration, permissions and subscriptions needed in deployment.
Wire Deployed Handlers to Their Entry Points
Verify that infrastructure deploys the changed handler and points to the correct entry point in each affected deployment.
Why it matters. A working handler has no effect if the runtime cannot find or invoke it.
Link Required Runtime Configuration
Trace required settings from deployment values into the runtime that reads them. Confirm the effective value is present and meaningful in the affected environment.
Why it matters. Declaring a variable alone does not make its value available to the code that needs it.
Connect Resources, Permissions and Consumers
Trace producers, consumers and deployed resource bindings. Verify identities have only the needed access and that queues have an intended consumer and failure destination where required.
Why it matters. A resource can exist while the work still goes nowhere or cannot be processed.
Connect Events to Subscribers
Verify the event source, identity or type filters, delivery target and permission chain for changed event flows.
Why it matters. An event can be emitted successfully even though its intended subscriber never receives it.
Provision and Scope Runtime Secrets
Verify that required secrets are provisioned securely and available to intended workload identities with appropriate permissions and rotation.
Why it matters. A missing secret can break deployment. A broadly shared secret can widen compromise.
Retire Resources with Their Dependencies
Trace consumers, retained data and replacement dependencies before removing obsolete resources or leaving them behind.
Why it matters. Orphaned resources add cost and ambiguity, while premature cleanup can remove a live dependency.
Operability
Checks that teams can see user impact, diagnose failure and recovery, and know who responds when action is needed.
Measure User Impact and Recovery
Define outcomes users depend on and measure them with service-level indicators and objectives where appropriate. Alert when impact warrants an actionable response and show when the service recovers.
Why it matters. A user-facing signal gives responders a reason to act and a way to know when the incident is over.
Make Operations Repeatable
Version and review repeatable operational configuration and procedures. Automate material steps where doing so makes execution safer and easier to verify.
Why it matters. A repeatable procedure makes recovery less dependent on the operator who happens to be on call.
Name Responders and Rehearse Response
Assign responders and escalation paths for important services. Keep actionable runbooks and exercise them against plausible failure and recovery scenarios.
Why it matters. A page only helps if somebody can take ownership and knows which action to take.
Make Dependency Degradation Visible
Measure material dependency failures and the fallback outcomes users receive. Correlate those metrics with user impact and recovery.
Why it matters. Dependency metrics tell responders where to investigate. The service objective tells them when to page.
Choose Log Severity by Operational Impact
Use severity consistently with the service’s diagnostic conventions and capture user-visible or unrecovered failures. Set paging rules separately using actionable impact criteria.
Why it matters. Clear severity helps triage. Paging for every error can bury an incident in noise.
Record Useful Failure Context
At the appropriate boundary, keep the operation, outcome and safe cause detail needed to trace a failure. Correlate related events and redact sensitive fields.
Why it matters. A failure message should let a responder start investigating without having to reproduce the error.
Readability
Checks whether a teammate can safely understand, review and maintain the changed code.
Write for the Next Maintainer
Ask for readability changes when a teammate could plausibly misunderstand an invariant, trace the wrong path, or struggle to change the code safely.
Why it matters. A concrete maintenance consequence makes the review actionable and keeps stylistic preference proportionate.
Name the Meaning That Matters
Clarify names that obscure a material domain distinction, unit, scope or side effect. Explain how the current name could mislead a maintainer.
Why it matters. A name that hides a relevant distinction can cause the next reader to use the value incorrectly.
Document Constraints a Reader Cannot Infer
Explain consequential invariants, trade-offs or ordering requirements where a reader cannot recover the reason from the code.
Why it matters. A maintainer who knows why the constraint exists is less likely to remove a safeguard while simplifying the code.
Security
Checks how changes prevent abuse, protect identities and sensitive data, contain compromise, and support detection and investigation.
Anticipate Abuse Before Implementation
Identify assets, actors, trust boundaries and plausible abuse cases early. Tie material risks to concrete design controls and checks.
Why it matters. A design that names the harm gives reviewers a way to verify the defence.
Prevent Sensitive Data in Outputs
Keep credentials, session material and unnecessary personal data out of logs, errors, traces and debug output. Keep sanitised context that operators need.
Why it matters. One diagnostic stream can reach more people and systems than the original data.
Vendor Abstraction
Keep security-critical provider settings behind a boundary when that makes credential handling, redaction or access enforcement easier to verify. Make any broader provider boundary earn its cost.
Why it matters. A boundary helps when it centralises a real control. A generic wrapper can hide controls reviewers need to see.
Protect Security-Sensitive Configuration
Validate settings that control access, exposure or abuse limits. Restrict who can change them and fail visibly when an invalid value would weaken protection.
Why it matters. The same security rule has little value if a permissive setting can bypass it.
Rotate and Revoke Sessions
Rotate session identifiers at authentication and privilege changes. Expire sessions and enforce server-side revocation when the user logs out or loses access.
Why it matters. A credential issued under earlier conditions can outlive the authority it represents.
Protect Sensitive Data and Exports
Classify sensitive data, including financial records. Encrypt it in transit and at rest, and scope read, decryption and export permissions independently where appropriate.
Why it matters. An export or broad decryption grant can undo the protection on the primary store.
Contain Compromised Identities and Workloads
Scope roles to the required actions and resources. Separate workloads, tenants or environments where a shared identity or permission would let one compromise spread.
Why it matters. Narrow permissions and isolation reduce what a stolen credential or compromised workload can reach.
Minimise Exposure in Scope and Duration
Expose only the necessary surface to the intended callers for as long as it is needed. Verify independent edge, origin and API defences where those layers exist. Give temporary exposure an expiry or a removal plan, and make it possible to restrict, patch or isolate a newly vulnerable public path quickly.
Why it matters. Fewer reachable paths, fewer callers and shorter exposure windows reduce the opportunities for abuse. Independent controls and a fast response limit the impact when a weakness is found.
Capture Evidence for Detection and Investigation
Capture and correlate security-relevant events, protect their integrity and access, and exercise detection and incident reconstruction. Limit fields and retention to what those purposes require.
Why it matters. Operators need enough evidence to reconstruct an incident. Every extra field increases the exposure of the audit trail.
Testing
Checks whether the test suite can demonstrate changed behaviour and catch meaningful regressions.
Test Behaviour Users and Callers Depend On
Choose test boundaries that demonstrate the real outcome and catch material failures. Verify what a test double leaves unexercised.
Why it matters. The confidence a test provides depends on the behaviour it can actually disprove.
Verify New and Changed Behaviour
Exercise the changed contract, including relevant failure outcomes. Match test depth to the change’s risk and verify existing assertions still address the behaviour claimed.
Why it matters. A passing suite gives confidence when its assertions reach the code and outcomes the change affects.
Reproduce Regressions in a Repeatable Test
For consequential defects, exercise the underlying failure with a check that fails before the fix and passes with it where practical.
Why it matters. The test preserves what the team learned about how the defect reached users.
Make Skipped Verification Visible
Fail a required test when its setup is absent, or use an explicit skip or separate suite for optional environments.
Why it matters. A skipped test should not be counted as evidence that the behaviour worked.
Assert an Outcome That Can Be Wrong
Derive the actual result from the system under test and compare it with an independently known expectation.
Why it matters. An assertion whose result is fixed by test setup can pass while production behaviour is wrong.
Sources
- Amazon S3 User Guide, Naming Amazon S3 objects
- ASD and partners, Best Practices for Event Logging and Threat Detection
- AWS AppConfig User Guide, Validators
- AWS Lambda Developer Guide, Define Lambda function handler in Python
- AWS Lambda Developer Guide, Using Lambda with Amazon SQS
- AWS Well-Architected Security Pillar, Data protection
- AWS Well-Architected, COST04-BP02 Implement a decommissioning process
- AWS Well-Architected, OPS05-BP02 Develop and test playbooks to respond to incidents
- AWS Well-Architected, REL04-BP04 Make mutating operations idempotent
- AWS Well-Architected, REL05-BP03 Control and limit retry calls
- AWS Well-Architected, REL09-BP01 Identify and back up data that needs to be backed up
- AWS Well-Architected, REL09-BP04 Perform periodic recovery of the data
- AWS Well-Architected, Reliability Pillar, Implement change
- AWS Well-Architected, SEC03-BP01 Grant least privilege access in workload components
- CloudEvents Primer, Event Producers and Consumers
- DORA, Working in small batches
- Google AIP-180, Backwards compatibility
- Google AIP-231, Batch methods: Get
- Google AIP-235, Batch methods: Delete
- Google Engineering Practices, Small CLs
- Google Engineering Practices, The standard of code review
- Google Engineering Practices, What to look for in a code review
- Google SRE Workbook, Alerting on SLOs
- Google SRE Workbook, Canarying Releases
- Google SRE, Addressing Cascading Failures
- Google SRE, Monitoring Distributed Systems
- Martin Fowler, Refactoring
- Martin Fowler, Yagni
- Mike Burrows, The Chubby Lock Service, §2.4 Locks and sequencers
- NIST SP 800-207, §2.1 Tenets of Zero Trust
- NIST SSDF v1.1, PW.1.1 and PW.2.1
- OWASP API8:2023 Security Misconfiguration
- OWASP Authorization Cheat Sheet, Enforce Least Privileges and Validate Permissions on Every Request
- OWASP Input Validation Cheat Sheet, Syntactic and Semantic Validation
- OWASP Logging Cheat Sheet
- OWASP Secrets Management Cheat Sheet
- OWASP Session Management Cheat Sheet, Session ID Renewal and Expiration
- PostgreSQL documentation, Transaction Isolation
- pytest documentation, Skipping test functions
- RFC 9110, §15 Status Codes
- Software Engineering at Google, Chapter 12: Unit Testing
- Software Engineering at Google, Chapter 13: Test Doubles
- The Rust Programming Language, The match Control Flow Construct
- The Twelve-Factor App, III. Config
- The Twelve-Factor App, IV. Backing services
- TypeScript Handbook, Narrowing: Exhaustiveness checking
- UK NCSC, Familiar weaknesses, exploited faster: defending against agentic cyber attacks, sections 1, 2, 4 and 6