snippet_slug
stringlengths
97
241
task_slug
stringlengths
81
225
domain
stringclasses
40 values
context
stringclasses
13 values
description
stringlengths
82
228
lang
stringclasses
4 values
code
stringlengths
110
4.47k
line_count
int64
5
80
unclear_naming
bool
2 classes
noise_comments
bool
2 classes
dead_code
bool
2 classes
inconsistent_style
bool
2 classes
over_abstracted
bool
2 classes
too_clever
bool
2 classes
duplicated_logic
bool
2 classes
error_handling_problem
bool
2 classes
type_safety_hole
bool
2 classes
unsafe_input
bool
2 classes
primary_flaw
stringclasses
11 values
quality
int64
1
5
difficulty
stringclasses
3 values
uncertain_flags
listlengths
0
3
findings
listlengths
0
28
purge-orphaned-draft-attachments-from-object-storage-that-have-unreferenced-asset-identifiers-ts-0583d9d48172
purge-orphaned-draft-attachments-from-object-storage-that-have-unreferenced-asset-identifiers
content-publishing
cli-script
Purge orphaned draft attachments from object storage that have unreferenced asset identifiers.
ts
import yargs from 'yargs'; import { hideBin } from 'yargs/helpers'; import { z } from 'zod'; import { createDatabasePool } from './database.js'; import { deleteObjectBatch } from './objectStorage.js'; interface AttachmentDeletion { remove(keys: string[]): Promise<void>; } class StorageDeletion implements AttachmentD...
43
false
false
false
false
true
false
true
false
false
false
over_abstracted
3
subtle
[]
[ { "finding_slug": "over-abstracted-0583d9d48172-l7-l14-99c4d5c1", "flag": "over_abstracted", "start_line": 7, "end_line": 14, "excerpt": "interface AttachmentDeletion {", "explanation": "The deletion interface has a single implementation whose only operation forwards to deleteObjectBatch, so...
aggregate-hourly-pick-rates-per-workstation-into-consolidated-shift-totals-for-warehouse-supervisor-reporting-ts-38dbb0a848c0
aggregate-hourly-pick-rates-per-workstation-into-consolidated-shift-totals-for-warehouse-supervisor-reporting
warehouse-operations
data-transform
Aggregate hourly pick rates per workstation into consolidated shift totals for warehouse supervisor reporting.
ts
import _ from "lodash"; import { z } from "zod"; const hourlyPickSchema = z.object({ workstationId: z.string().trim().min(1), shiftCode: z.string().trim().min(1), timestamp: z.string().datetime({ offset: true }), unitsPicked: z.number().int().nonnegative().finite(), activeMinutes: z.number().min(0).max(60).f...
38
false
true
false
false
false
false
false
false
true
false
noise_comments
3
borderline
[ "type_safety_hole" ]
[ { "finding_slug": "noise-comments-38dbb0a848c0-l20-l20-614cb1df", "flag": "noise_comments", "start_line": 20, "end_line": 20, "excerpt": " // Return the promise chain.", "explanation": "Only restates the return statement immediately below it.", "audit_verdict": "valid" }, { "fin...
define-typescript-interfaces-representing-a-multi-currency-refund-request-payload-and-corresponding-api-response-ts-5c195eca1d08
define-typescript-interfaces-representing-a-multi-currency-refund-request-payload-and-corresponding-api-response
payments
type-definitions
Define TypeScript interfaces representing a multi-currency refund request payload and corresponding API response.
ts
// The currencies supported by refunds. export type Currency = "USD" | "EUR" | "GBP"; // The possible refund statuses. export type RefundStatus = "pending" | "succeeded" | "failed"; // A monetary amount. export interface Money { currency: Currency; minorUnits: number; } type A = Money[]; type B = Record<string, str...
29
true
true
false
false
false
false
false
false
false
false
unclear_naming
3
obvious
[]
[ { "finding_slug": "noise-comments-5c195eca1d08-l1-l1-d8607929", "flag": "noise_comments", "start_line": 1, "end_line": 1, "excerpt": "// The currencies supported by refunds.", "explanation": "Restates the Currency declaration without adding constraints or rationale.", "audit_verdict": "i...
attach-a-live-input-event-listener-to-the-search-bar-to-trigger-debounced-autocomplete-suggestions-js-30eadfc312b6
attach-a-live-input-event-listener-to-the-search-bar-to-trigger-debounced-autocomplete-suggestions
search
dom-code
Attach a live input event listener to the search bar to trigger debounced autocomplete suggestions.
js
import { fetchAutocompleteSuggestions } from "./api.js" import { saveRecentSearchQuery } from "./storage.js" export function initializeSearchAutocomplete(searchInput, suggestionsContainer) { let timer, revision = 0 searchInput.addEventListener("input", () => { const query = searchInput.value.trim(), current = ...
21
false
false
false
false
false
true
false
false
false
false
too_clever
3
subtle
[]
[ { "finding_slug": "too-clever-30eadfc312b6-l14-l14-d0966d36", "flag": "too_clever", "start_line": 14, "end_line": 14, "excerpt": " suggestionsContainer.replaceChildren(...items.slice(0, 5).map(text => ((element) => (element.className = \"suggestion-item\", element.textContent = text, elem...
receive-incoming-webhook-payloads-from-external-calendar-providers-and-update-appointment-status-records-in-the-database-js-b95af7c6f6a3
receive-incoming-webhook-payloads-from-external-calendar-providers-and-update-appointment-status-records-in-the-database
scheduling
http-handler
Receive incoming webhook payloads from external calendar providers and update appointment status records in the database.
js
const { NextResponse } = require('next/server') const { z } = require('zod') const { verifyCalendarSignature } = require('@/lib/calendar-crypto') const { findAppointmentByExternalId, updateAppointmentStatus } = require('../../services/appointmentService') const webhookSchema = z.object({ eventId: z.string().refine...
44
false
false
false
false
true
true
false
true
false
false
error_handling_problem
2
borderline
[ "over_abstracted" ]
[ { "finding_slug": "over-abstracted-b95af7c6f6a3-l13-l15-b64085dc", "flag": "over_abstracted", "start_line": 13, "end_line": 15, "excerpt": "async function writeCalendarStatus(appointment, status) {", "explanation": "This helper only forwards to updateAppointmentStatus after extracting appoin...
check-that-enrolling-a-student-in-a-fully-booked-course-throws-a-capacity-exceeded-error-and-prevents-saving-ts-6869a2aec424
check-that-enrolling-a-student-in-a-fully-booked-course-throws-a-capacity-exceeded-error-and-prevents-saving
course-management
test
Check that enrolling a student in a fully booked course throws a capacity exceeded error and prevents saving.
ts
import { EnrollmentService } from '../EnrollmentService' import { CapacityExceededError } from '../errors' import type { CourseRepository } from '../CourseRepository' describe('EnrollmentService.enroll', () => { it('rejects a full course without saving', async () => { const courseId = 'ceramics-evening' cons...
30
false
false
false
true
false
false
false
false
true
false
type_safety_hole
3
obvious
[]
[ { "finding_slug": "inconsistent-style-6869a2aec424-l8-l8-8d1993ed", "flag": "inconsistent_style", "start_line": 8, "end_line": 8, "excerpt": " const student_id = \"student-302\";", "explanation": "This declaration mixes snake_case with courseId, double quotes with the surrounding single q...
query-the-postgresql-database-to-retrieve-full-user-profile-records-including-encrypted-notification-preferences-ts-291e94e95733
query-the-postgresql-database-to-retrieve-full-user-profile-records-including-encrypted-notification-preferences
user-profiles
database-access
Query the PostgreSQL database to retrieve full user profile records including encrypted notification preferences.
ts
import type { Pool } from "pg"; import type Redis from "ioredis"; import { z } from "zod"; const profileSchema = z.object({ id: z.string().uuid(), email: z.string().email(), displayName: z.string(), bio: z.string().nullable(), avatarUrl: z.string().url().nullable(), createdAt: z.coerce.date(), updatedAt: z...
34
false
false
true
false
false
false
false
false
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "dead-code-291e94e95733-l13-l13-981b660d", "flag": "dead_code", "start_line": 13, "end_line": 13, "excerpt": "const summaryFields = [\"id\", \"displayName\", \"avatarUrl\"];", "explanation": "This local constant is never referenced and should be removed.", "audit_verdic...
build-a-custom-hook-that-debounces-live-search-inputs-for-the-knowledge-base-article-lookup-and-returns-matching-search-suggestions-ts-02863967205b
build-a-custom-hook-that-debounces-live-search-inputs-for-the-knowledge-base-article-lookup-and-returns-matching-search-suggestions
customer-support
react-hook
Build a custom hook that debounces live search inputs for the knowledge base article lookup and returns matching search suggestions.
ts
import { useEffect, useState } from "react" import { z } from "zod" const articleIndex = z.array(z.object({ id: z.string().min(1), title: z.string().min(1), summary: z.string(), href: z.string().url().regex(/^https?:\/\//) })) type Article = z.infer<typeof articleIndex>[number] export function useArti...
54
false
false
false
false
false
false
true
false
false
false
duplicated_logic
4
borderline
[ "duplicated_logic" ]
[ { "finding_slug": "duplicated-logic-02863967205b-l35-l44-b9029549", "flag": "duplicated_logic", "start_line": 35, "end_line": 44, "excerpt": " const timer = window.setTimeout(() => {", "explanation": "The timer and storage listener both normalize input with input.trim().toLowerCase() ...
group-completed-project-milestones-by-client-organization-and-sum-their-finalized-budgets-in-descending-order-js-909ddcef0e92
group-completed-project-milestones-by-client-organization-and-sum-their-finalized-budgets-in-descending-order
project-management
data-transform
Group completed project milestones by client organization and sum their finalized budgets in descending order.
js
import { z } from "zod"; import { fetchMilestonesByOrganization } from "./milestoneApiClient.js"; const milestonesSchema = z.array(z.object({ status: z.string().min(1), clientOrganization: z.string().min(1), finalizedBudget: z.number().finite() })); const organizationIdSchema = z.string().min(1); export f...
40
true
false
false
false
false
false
false
false
false
false
unclear_naming
4
borderline
[ "unclear_naming" ]
[ { "finding_slug": "unclear-naming-909ddcef0e92-l19-l19-e1c999cc", "flag": "unclear_naming", "start_line": 19, "end_line": 19, "excerpt": " const state = new Map();", "explanation": "The name 'state' does not identify what the map stores, whereas 'totalsByClient' would expose its c...
attach-a-live-input-formatter-to-the-wire-transfer-routing-number-field-that-strips-non-numeric-characters-and-enforces-nine-digit-lengths-js-38083ce1cd20
attach-a-live-input-formatter-to-the-wire-transfer-routing-number-field-that-strips-non-numeric-characters-and-enforces-nine-digit-lengths
banking
dom-code
Attach a live input formatter to the wire transfer routing number field that strips non-numeric characters and enforces nine-digit lengths.
js
import $ from "jquery"; export function attachRoutingNumberFormatter(field, status, message = "Routing number must contain nine digits.") { if (!(field instanceof HTMLInputElement)) { throw new TypeError("A routing number input is required."); } if (field.type !== "text" && field.type !== "tel") { throw ...
46
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
define-shopping-cart-redux-slice-with-reducers-for-updating-quantities-and-removing-selected-items-jsx-ad1c56a7a850
define-shopping-cart-redux-slice-with-reducers-for-updating-quantities-and-removing-selected-items
shopping-cart
state-management
Define shopping cart Redux slice with reducers for updating quantities and removing selected items
jsx
import { createContext, useContext, useReducer } from "react"; import { createSlice } from "@reduxjs/toolkit"; import { z } from "zod"; const CartContext = createContext(null); const itemSchema = z.object({ id: z.string().min(1), name: z.string().min(1), unitPrice: z.number().finite().nonnegative(), quantity: ...
67
false
false
false
false
true
true
true
false
false
false
over_abstracted
3
borderline
[ "too_clever" ]
[ { "finding_slug": "duplicated-logic-ad1c56a7a850-l19-l21-ad667dc8", "flag": "duplicated_logic", "start_line": 19, "end_line": 21, "excerpt": " if (!Number.isInteger(item.quantity) || item.quantity < 1 || item.quantity > 999) {", "explanation": "The integer/range check and error message ar...
dispatch-automated-reminder-emails-to-recipients-who-have-not-viewed-their-assigned-documents-within-three-days-js-82e2068348f6
dispatch-automated-reminder-emails-to-recipients-who-have-not-viewed-their-assigned-documents-within-three-days
document-signing
async-job
Dispatch automated reminder emails to recipients who have not viewed their assigned documents within three days.
js
import { z } from 'zod'; import { DynamoDBClient } from '@aws-sdk/client-dynamodb'; import { DynamoDBDocumentClient, QueryCommand } from '@aws-sdk/lib-dynamodb'; import { SESClient, SendEmailCommand } from '@aws-sdk/client-ses'; const database = DynamoDBDocumentClient.from(new DynamoDBClient({ region: 'us-east-1' }));...
51
false
false
false
false
false
false
true
false
false
true
unsafe_input
3
subtle
[]
[ { "finding_slug": "unsafe-input-82e2068348f6-l21-l26-750cd3cf", "flag": "unsafe_input", "start_line": 21, "end_line": 26, "excerpt": " const { documentId } = JSON.parse(record.body);", "explanation": "The batch schema validates only that body is a string, leaving its parsed contents and d...
process-incoming-refund-webhook-payloads-by-validating-hmac-signatures-and-updating-the-corresponding-transaction-ledger-entry-js-253ed6b7b9d6
process-incoming-refund-webhook-payloads-by-validating-hmac-signatures-and-updating-the-corresponding-transaction-ledger-entry
order-management
http-handler
Process incoming refund webhook payloads by validating HMAC signatures and updating the corresponding transaction ledger entry
js
const crypto = require('crypto'); const { NextResponse } = require('next/server'); const { z } = require('zod'); const ledgerRepository = require('@/repositories/ledgerRepository'); const auditLogger = require('@/services/audit'); const refundEvent = z.object({ id: z.string().trim().min(1), type: z.literal('refund.pr...
35
false
false
false
false
false
false
false
true
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "unsafe-input-253ed6b7b9d6-l12-l15-afe9f806", "flag": "unsafe_input", "start_line": 12, "end_line": 15, "excerpt": " const secret = process.env.REFUND_WEBHOOK_SECRET;", "explanation": "The environment-provided HMAC secret is used without checking that it is configured and ...
define-typescript-interfaces-representing-signer-roles-authentication-methods-and-cryptographic-certificate-metadata-ts-7333ea0db1a0
define-typescript-interfaces-representing-signer-roles-authentication-methods-and-cryptographic-certificate-metadata
document-signing
type-definitions
Define TypeScript interfaces representing signer roles, authentication methods, and cryptographic certificate metadata.
ts
export type SignerRole = 'primary' | 'witness' | 'notary' | 'approver'; export type AuthenticationMethod = 'sms' | 'email' | 'oauth' | 'hardware_token'; export interface CertificateMetadata { issuer: string; serialNumber: string; validFrom: string; validTo: string; thumbprint: string; } export int...
31
false
false
false
true
true
false
false
false
false
false
over_abstracted
3
subtle
[]
[ { "finding_slug": "inconsistent-style-7333ea0db1a0-l20-l25-862ea8c6", "flag": "inconsistent_style", "start_line": 20, "end_line": 25, "excerpt": " const requires_authentication = configuration.role === 'primary' || configuration.role === 'witness';", "explanation": "Local variables mix sn...
manage-paginated-time-off-request-fetching-with-automatic-caching-and-optimistic-approval-updates-ts-69b439a30594
manage-paginated-time-off-request-fetching-with-automatic-caching-and-optimistic-approval-updates
payroll
react-hook
Manage paginated time-off request fetching with automatic caching and optimistic approval updates.
ts
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { z } from 'zod'; type RequestPage = { items: { id: string; employeeId: string; startDate: string; endDate: string; status: 'pending' | 'approved' | 'rejected'; }[]; nextPage: number | null; }; export funct...
51
false
false
false
false
false
false
false
true
true
true
error_handling_problem
2
borderline
[ "dead_code" ]
[ { "finding_slug": "type-safety-hole-69b439a30594-l24-l24-b56b1353", "flag": "type_safety_hole", "start_line": 24, "end_line": 24, "excerpt": " return await response.json();", "explanation": "The any-valued JSON result is returned under the declared Promise<RequestPage> contract without ...
check-that-enrolling-a-student-in-a-fully-booked-course-throws-a-capacity-exceeded-error-and-prevents-saving-ts-de7438761a43
check-that-enrolling-a-student-in-a-fully-booked-course-throws-a-capacity-exceeded-error-and-prevents-saving
course-management
test
Check that enrolling a student in a fully booked course throws a capacity exceeded error and prevents saving.
ts
import { EnrollmentService } from '../EnrollmentService' import { CapacityExceededError } from '../errors' import type { Course } from '../Course' import type { CourseRepository } from '../CourseRepository' describe('EnrollmentService.enroll', () => { it('rejects a full course without saving', async () => { cons...
32
false
true
false
false
false
false
false
false
false
false
noise_comments
4
subtle
[]
[ { "finding_slug": "noise-comments-de7438761a43-l24-l24-885220a3", "flag": "noise_comments", "start_line": 24, "end_line": 24, "excerpt": " // A full course must reject another enrollment.", "explanation": "This repeats the test title and the immediately following rejection assertion witho...
calculate-the-great-circle-distance-in-kilometers-between-two-latitude-and-longitude-waypoints-for-route-optimization-ts-9f3a8c267163
calculate-the-great-circle-distance-in-kilometers-between-two-latitude-and-longitude-waypoints-for-route-optimization
fleet-tracking
utility
Calculate the great-circle distance in kilometers between two latitude and longitude waypoints for route optimization.
ts
import type { VehicleWaypoint, GeoCoordinate } from "./types/fleet"; const EARTH_RADIUS_KM = 6371.0; function convertDegreesToRadians(degrees: number): number { return (degrees * Math.PI) / 180.0; } export function validateCoordinate(coordinate: GeoCoordinate): void { if (coordinate === null || typeof coordinate...
48
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
query-the-database-for-all-unbilled-time-logs-associated-with-a-specific-corporate-client-and-date-range-js-50098e8a791c
query-the-database-for-all-unbilled-time-logs-associated-with-a-specific-corporate-client-and-date-range
time-tracking
database-access
Query the database for all unbilled time logs associated with a specific corporate client and date range.
js
import { Router } from "express"; import { TimeLog } from "../models/time-log.js"; export async function findUnbilledTimeLogs(clientId, from, until) { const filter = [ ["corporateClient", clientId], ["billed", false], ["startedAt", [from, until]] ].reduce((conditions, [field, value]) => ( condition...
37
false
false
false
false
false
true
false
false
false
true
unsafe_input
2
obvious
[]
[ { "finding_slug": "too-clever-50098e8a791c-l9-l17-7575738e", "flag": "too_clever", "start_line": 9, "end_line": 17, "excerpt": " ].reduce((conditions, [field, value]) => (", "explanation": "The reducer hides mutation inside a comma expression and nests a boundary-selection ternary within a ...
process-incoming-webhook-payloads-from-github-to-automatically-update-linked-task-statuses-when-a-pull-request-merges-js-4073f75d00d5
process-incoming-webhook-payloads-from-github-to-automatically-update-linked-task-statuses-when-a-pull-request-merges
project-management
async-job
Process incoming webhook payloads from GitHub to automatically update linked task statuses when a pull request merges.
js
import cron from 'node-cron'; import { z } from 'zod'; const envelopeSchema = z.object({ event: z.string().min(1), payload: z.object({ action: z.string().min(1), repository: z.object({ full_name: z.unknown() }), pull_request: z.object({ number: z.number().int().positive(), merged: z.boolean() }), }),...
34
false
true
false
false
false
false
false
false
false
true
unsafe_input
3
obvious
[]
[ { "finding_slug": "unsafe-input-4073f75d00d5-l8-l8-71e3facd", "flag": "unsafe_input", "start_line": 8, "end_line": 8, "excerpt": " repository: z.object({ full_name: z.unknown() }),", "explanation": "z.unknown() accepts any repository name without validation before that external value is p...
define-a-zustand-store-slice-holding-active-user-point-balance-unlocked-perks-and-redemption-history-ts-276f182e6dd8
define-a-zustand-store-slice-holding-active-user-point-balance-unlocked-perks-and-redemption-history
loyalty-rewards
state-management
Define a Zustand store slice holding active user point balance, unlocked perks, and redemption history.
ts
import { create } from 'zustand'; import { redux } from 'zustand/middleware'; import { z } from 'zod'; const redemptionSchema = z.object({ id: z.string().min(1), perkId: z.string().min(1), points: z.number().int().positive(), redeemedAt: z.number().int().nonnegative(), }); const rewardsSchema = z.object({ ...
53
false
false
false
false
false
false
true
false
false
false
duplicated_logic
3
subtle
[]
[ { "finding_slug": "duplicated-logic-276f182e6dd8-l28-l33-931c2e0e", "flag": "duplicated_logic", "start_line": 28, "end_line": 33, "excerpt": " const history = [...action.payload.history].sort((left, right) => {", "explanation": "This history sorting block duplicates the timestamp-...
normalize-raw-ldap-group-memberships-into-structured-permission-claims-for-the-downstream-token-generator-ts-109a0edc7f6a
normalize-raw-ldap-group-memberships-into-structured-permission-claims-for-the-downstream-token-generator
permissions
data-transform
Normalize raw LDAP group memberships into structured permission claims for the downstream token generator.
ts
import { z } from "zod"; export interface PermissionClaim { scope: string; resource: string; } const membershipSchema = z.array(z.object({ dn: z.string().regex(/^cn=[^,]+/i), })); export function normalizeLdapMemberships(rawEntries: unknown): Promise<PermissionClaim[]> { return Promise.resolve().then...
27
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
purge-historical-audit-logs-older-than-three-retention-years-from-the-archival-cold-storage-partition-tables-js-8f51bc60c096
purge-historical-audit-logs-older-than-three-retention-years-from-the-archival-cold-storage-partition-tables
warehouse-operations
cli-script
Purge historical audit logs older than three retention years from the archival cold storage partition tables.
js
import { readdir, readFile, writeFile } from 'node:fs/promises' const archiveRoot = new URL('../cold-storage/audit/', import.meta.url) export function purgeAuditLogs(callback) { const retentionBoundary = new Date() retentionBoundary.setUTCFullYear(retentionBoundary.getUTCFullYear() - 3) const cutoff = ret...
37
false
false
false
false
false
false
false
false
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "unsafe-input-8f51bc60c096-l15-l18-b9a81b8a", "flag": "unsafe_input", "start_line": 15, "end_line": 18, "excerpt": " for (const partition of partitions) {", "explanation": "Directory entry names are used directly as URL references without validating partition names, ...
execute-nightly-inventory-reconciliation-sweeps-to-flag-discrepancies-between-physical-counts-and-system-ledgers-ts-0e283396f93a
execute-nightly-inventory-reconciliation-sweeps-to-flag-discrepancies-between-physical-counts-and-system-ledgers
warehouse-operations
async-job
Execute nightly inventory reconciliation sweeps to flag discrepancies between physical counts and system ledgers.
ts
import { Request, Response } from "express" import { z } from "zod" import { db } from "@/services/database" import { ledgerClient } from "@/clients/ledger" import { warehouseQueue } from "@/queues/warehouse" const shape = z.object({ warehouseId: z.string().min(1), cycleCountBatchId: z.string().min(1) }) const balance...
35
true
true
false
true
false
false
false
true
false
false
error_handling_problem
2
obvious
[]
[ { "finding_slug": "unclear-naming-0e283396f93a-l7-l7-6c7f40fe", "flag": "unclear_naming", "start_line": 7, "end_line": 7, "excerpt": "const shape = z.object({ warehouseId: z.string().min(1), cycleCountBatchId: z.string().min(1) })", "explanation": "The generic name 'shape' does not identify ...
aggregate-raw-listing-impressions-by-neighborhood-identifier-to-calculate-average-daily-views-per-zone-ts-71bb6b22ce9d
aggregate-raw-listing-impressions-by-neighborhood-identifier-to-calculate-average-daily-views-per-zone
property-listings
data-transform
Aggregate raw listing impressions by neighborhood identifier to calculate average daily views per zone.
ts
import { z } from "zod" export interface ListingImpression { neighborhoodId: string viewCount: number timestamp: string } export interface ZoneDailyViews { neighborhoodId: string averageDailyViews: number recordedDaysCount: number } const impressionSchema = z.array(z.object({ neighborhood...
61
false
false
false
true
false
false
false
false
false
false
inconsistent_style
3
obvious
[]
[ { "finding_slug": "inconsistent-style-71bb6b22ce9d-l31-l31-651719bb", "flag": "inconsistent_style", "start_line": 31, "end_line": 31, "excerpt": " const date_key = new Date(impression.timestamp).toISOString().split('T')[0];", "explanation": "This declaration introduces snake_case alon...
attach-native-drag-and-drop-listeners-to-staging-bay-cards-to-reorder-truck-loading-dock-queue-assignments-js-b2c61d1873ae
attach-native-drag-and-drop-listeners-to-staging-bay-cards-to-reorder-truck-loading-dock-queue-assignments
warehouse-operations
dom-code
Attach native drag and drop listeners to staging bay cards to reorder truck loading dock queue assignments.
js
import { updateDockQueuePosition } from '../api/warehouseClient.js'; export async function initializeDockQueueDragAndDrop(containerElement) { const selector = '.staging-bay-card'; let draggedCard = null; let saving = false; const cards = Array.from(containerElement.querySelectorAll(selector)); for ...
72
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
dispatch-automated-reminder-emails-to-recipients-who-have-not-viewed-their-assigned-documents-within-three-days-js-75e46a8ae3b3
dispatch-automated-reminder-emails-to-recipients-who-have-not-viewed-their-assigned-documents-within-three-days
document-signing
async-job
Dispatch automated reminder emails to recipients who have not viewed their assigned documents within three days.
js
import { DynamoDBClient } from '@aws-sdk/client-dynamodb'; import { DynamoDBDocumentClient, QueryCommand } from '@aws-sdk/lib-dynamodb'; import { SESClient, SendEmailCommand } from '@aws-sdk/client-ses'; const signers = DynamoDBDocumentClient.from(new DynamoDBClient({ region: 'us-east-1' })); const delivery = new SESC...
33
false
false
false
false
false
false
false
false
false
true
unsafe_input
3
subtle
[]
[ { "finding_slug": "unsafe-input-75e46a8ae3b3-l9-l10-1906ad15", "flag": "unsafe_input", "start_line": 9, "end_line": 10, "excerpt": " for (const record of event.Records) {", "explanation": "The external queue event is consumed without checking that Records is an array of records with string ...
calculate-the-great-circle-distance-in-kilometers-between-two-latitude-and-longitude-waypoints-for-route-optimization-ts-a7c365e00081
calculate-the-great-circle-distance-in-kilometers-between-two-latitude-and-longitude-waypoints-for-route-optimization
fleet-tracking
utility
Calculate the great-circle distance in kilometers between two latitude and longitude waypoints for route optimization.
ts
import type { VehicleWaypoint, GeoCoordinate } from "./types/fleet"; const EARTH_RADIUS_KM = 6371.0; const KILOMETERS_PER_NAUTICAL_MILE = 1.852; function coordinateLabel(coordinate: GeoCoordinate): string { return `${coordinate.latitude.toFixed(6)}, ${coordinate.longitude.toFixed(6)}`; } export function validateCo...
48
false
false
true
false
false
false
false
false
true
false
type_safety_hole
3
subtle
[]
[ { "finding_slug": "dead-code-a7c365e00081-l4-l4-8cd05718", "flag": "dead_code", "start_line": 4, "end_line": 4, "excerpt": "const KILOMETERS_PER_NAUTICAL_MILE = 1.852;", "explanation": "This non-exported constant is never referenced; the calculation returns kilometers directly.", "audit_...
run-a-nightly-background-worker-that-scans-for-unsubmitted-draft-reports-older-than-thirty-days-and-dispatches-reminder-notices-js-ab13889a8ee2
run-a-nightly-background-worker-that-scans-for-unsubmitted-draft-reports-older-than-thirty-days-and-dispatches-reminder-notices
expense-reports
async-job
Run a nightly background worker that scans for unsubmitted draft reports older than thirty days and dispatches reminder notices.
js
const { z } = require('zod') const reports = require('./repositories/expense-reports') const notices = require('./services/reminder-notices') const nightlyBatch = z.object({ Records: z.array(z.object({ body: z.literal('nightly-draft-reminders') })).min(1) }) exports.handler = (event, context, callback) => { context.c...
14
false
false
false
false
false
false
false
false
false
false
none
5
obvious
[]
[]
sanitize-user-provided-html-strings-in-support-message-bodies-to-strip-out-dangerous-script-tags-while-preserving-safe-formatting-elements-ts-e11d0d9ac293
sanitize-user-provided-html-strings-in-support-message-bodies-to-strip-out-dangerous-script-tags-while-preserving-safe-formatting-elements
customer-support
utility
Sanitize user-provided HTML strings in support message bodies to strip out dangerous script tags while preserving safe formatting elements.
ts
import _ from 'lodash'; import sanitizeHtml from 'sanitize-html'; import { z } from 'zod'; export interface SupportMessagePayload { ticketId: string; authorEmail: string; rawBody: string; } export interface CleanedSupportMessage { ticketId: string; authorEmail: string; processedBody: string; } const supp...
50
false
false
true
false
true
false
false
false
false
false
over_abstracted
3
borderline
[ "dead_code" ]
[ { "finding_slug": "dead-code-e11d0d9ac293-l24-l24-7579a10a", "flag": "dead_code", "start_line": 24, "end_line": 24, "excerpt": " (messageBody, refinementContext) => {", "explanation": "refinementContext is never used by the transform, so the unused callback parameter should be removed.", ...
implement-a-mutation-to-securely-save-a-newly-added-credit-card-token-to-the-customer-account-database-ts-b39a5c172e37
implement-a-mutation-to-securely-save-a-newly-added-credit-card-token-to-the-customer-account-database
payments
server-action
Implement a mutation to securely save a newly added credit card token to the customer account database.
ts
import type { Actions } from './$types' import { error, fail } from '@sveltejs/kit' import { stripe } from '$lib/server/stripe' import { db } from '$lib/server/database' import { creditCardSchema } from '$lib/schemas/payment' export const actions: Actions = { default: async ({ request, locals }) => { if (!locals...
31
false
false
false
false
false
false
false
false
true
true
type_safety_hole
3
subtle
[]
[ { "finding_slug": "type-safety-hole-b39a5c172e37-l13-l13-49953d11", "flag": "type_safety_hole", "start_line": 13, "end_line": 13, "excerpt": " const card: any = parsed.data", "explanation": "The explicit any discards the schema's inferred validated type and disables checking of every late...
manage-selected-dates-filter-slice-and-active-room-type-filters-in-client-search-results-store-js-a510a344190e
manage-selected-dates-filter-slice-and-active-room-type-filters-in-client-search-results-store
hotel-booking
state-management
Manage selected dates filter slice and active room type filters in client search results store.
js
import create from "zustand"; import { z } from "zod"; const roomTypes = ["standard", "deluxe", "suite"]; const dateValue = z.string().date().nullable(); const roomTypeValue = z.enum(["standard", "deluxe", "suite"]); export const useSearchFilterStore = create((set) => ({ checkInDate: null, checkOutDate: null, a...
32
false
false
true
true
false
false
false
true
false
false
error_handling_problem
2
borderline
[ "type_safety_hole" ]
[ { "finding_slug": "dead-code-a510a344190e-l21-l21-9d631d0a", "flag": "dead_code", "start_line": 21, "end_line": 21, "excerpt": " } catch (error) {", "explanation": "The caught error binding is unused, and reporting or propagating it would also address the swallowed-error problem.", "a...
group-completed-deals-by-sales-representative-and-calculate-total-monthly-revenue-generated-ts-b20f3e17661f
group-completed-deals-by-sales-representative-and-calculate-total-monthly-revenue-generated
crm
data-transform
Group completed deals by sales representative and calculate total monthly revenue generated.
ts
import _ from "lodash" import { z } from "zod" const dealSchema = z.object({ salesRepId: z.string().min(1), status: z.enum(["pending", "completed", "lost"]), revenue: z.number().finite().nonnegative(), completedAt: z.string().datetime().nullable() }).refine(deal => deal.status !== "completed" || deal.c...
37
false
false
false
false
false
true
false
false
false
false
too_clever
4
subtle
[]
[ { "finding_slug": "too-clever-b20f3e17661f-l28-l32-8b24f272", "flag": "too_clever", "start_line": 28, "end_line": 32, "excerpt": " (summary, deal) => (", "explanation": "The reducer uses a comma expression to mutate two fields and return the accumulator, whereas a block with expli...
process-incoming-webhook-payloads-from-the-analytics-pipeline-to-increment-daily-impression-counters-for-active-flags-ts-a6bfa2439b7e
process-incoming-webhook-payloads-from-the-analytics-pipeline-to-increment-daily-impression-counters-for-active-flags
feature-flags
async-job
Process incoming webhook payloads from the analytics pipeline to increment daily impression counters for active flags.
ts
import { Job } from 'bullmq'; import { Redis } from 'ioredis'; import { z } from 'zod'; const ImpressionPayloadSchema = z.object({ flagKey: z.string().min(1), environmentId: z.string().uuid(), incrementBy: z.number().int().positive(), timestamp: z.string().datetime(), }); type ImpressionPayload = z.in...
46
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
fetch-all-active-promotion-codes-matching-a-specific-retailer-id-and-return-their-discount-limits-and-expiration-dates-from-the-main-database-table-js-27fcc5a9b09c
fetch-all-active-promotion-codes-matching-a-specific-retailer-id-and-return-their-discount-limits-and-expiration-dates-from-the-main-database-table
promotions
database-access
Fetch all active promotion codes matching a specific retailer ID and return their discount limits and expiration dates from the main database table
js
import { PrismaClient } from "@prisma/client" const prisma = new PrismaClient() function parseRetailerId(rawRetailerId) { if (typeof rawRetailerId !== "number" && (typeof rawRetailerId !== "string" || !/^[0-9]+$/.test(rawRetailerId))) { throw new TypeError("Retailer ID must be a positive integer") } const reta...
49
false
false
false
false
false
false
false
true
false
true
error_handling_problem
2
subtle
[]
[ { "finding_slug": "unsafe-input-27fcc5a9b09c-l18-l20-d897176f", "flag": "unsafe_input", "start_line": 18, "end_line": 20, "excerpt": "\tconst retailerId = rawRetailerId === undefined", "explanation": "The environment fallback bypasses parseRetailerId and relies on Number conversion alone, wh...
check-that-evaluatefeatureflag-correctly-returns-the-fallback-default-value-when-the-underlying-database-is-unreachable-ts-0d9be8643540
check-that-evaluatefeatureflag-correctly-returns-the-fallback-default-value-when-the-underlying-database-is-unreachable
feature-flags
test
Check that evaluateFeatureFlag correctly returns the fallback default value when the underlying database is unreachable.
ts
import { database } from '../database'; import { evaluateFeatureFlag } from '../evaluateFeatureFlag'; describe('evaluateFeatureFlag during a database outage', () => { afterEach(() => { jest.restoreAllMocks(); }); it.each([true, false])('returns the fallback %s', async (defaultValue) => { const lookup = ...
21
false
false
false
false
false
false
false
true
false
false
error_handling_problem
1
obvious
[]
[ { "finding_slug": "error-handling-problem-0d9be8643540-l17-l19-d26a0899", "flag": "error_handling_problem", "start_line": 17, "end_line": 19, "excerpt": " } catch {", "explanation": "This catch suppresses evaluation failures and assertion errors alike, so incorrect results or unexpected l...
process-incoming-webhook-notifications-from-stripe-by-verifying-cryptographic-signatures-and-updating-invoice-records-ts-0ae5efc64f19
process-incoming-webhook-notifications-from-stripe-by-verifying-cryptographic-signatures-and-updating-invoice-records
payments
http-handler
Process incoming webhook notifications from Stripe by verifying cryptographic signatures and updating invoice records.
ts
import type { Context } from 'koa'; import getRawBody from 'raw-body'; import { stripe, webhookSecret } from '../config/stripe.js'; import { invoices } from '../storage/invoices.js'; export async function stripeWebhook(ctx: Context): Promise<void> { const signature = ctx.get('stripe-signature'); if (!signature) { ...
33
false
false
false
false
false
false
false
false
true
true
type_safety_hole
3
subtle
[]
[ { "finding_slug": "type-safety-hole-0ae5efc64f19-l12-l12-10866de9", "flag": "type_safety_hole", "start_line": 12, "end_line": 12, "excerpt": " let notification: any;", "explanation": "Explicit any disables checking of the event discriminant, invoice object, and values passed to storage, so ...
implement-debounce-logic-for-cart-quantity-updates-to-prevent-excessive-network-requests-while-typing-ts-e65f892c1d88
implement-debounce-logic-for-cart-quantity-updates-to-prevent-excessive-network-requests-while-typing
shopping-cart
react-hook
Implement debounce logic for cart quantity updates to prevent excessive network requests while typing
ts
import { useEffect, useState } from "react" type SaveQuantity = (quantity: number) => Promise<void> function createCartQuantityWriter(saveQuantity: SaveQuantity) { return { write: (quantity: number) => saveQuantity(quantity) } } export function useCartQuantity(itemId: string, saveQuantity: SaveQuantity) { const [e...
41
false
false
false
false
true
true
false
false
false
false
over_abstracted
3
borderline
[ "too_clever" ]
[ { "finding_slug": "over-abstracted-e65f892c1d88-l5-l7-4918ee04", "flag": "over_abstracted", "start_line": 5, "end_line": 7, "excerpt": "function createCartQuantityWriter(saveQuantity: SaveQuantity) {", "explanation": "This factory only wraps saveQuantity in a forwarding write method, so call...
check-that-signing-requests-expire-precisely-twenty-four-hours-after-creation-when-no-manual-extension-is-triggered-by-the-sender-ts-91cdf07d97f3
check-that-signing-requests-expire-precisely-twenty-four-hours-after-creation-when-no-manual-extension-is-triggered-by-the-sender
document-signing
test
Check that signing requests expire precisely twenty-four hours after creation when no manual extension is triggered by the sender.
ts
import request from 'supertest'; import { z } from 'zod'; import { app } from '../src/app.js'; import { SigningRequestModel } from '../src/models/SigningRequest.js'; const statusResponse = z.object({ status: z.enum(['PENDING', 'EXPIRED']) }); describe('GET /api/v1/signing-requests/:id/status', () => { it('expires...
46
false
false
false
true
false
false
true
false
true
false
duplicated_logic
3
borderline
[ "duplicated_logic" ]
[ { "finding_slug": "inconsistent-style-91cdf07d97f3-l11-l11-be517c3d", "flag": "inconsistent_style", "start_line": 11, "end_line": 11, "excerpt": " const expiration_time = creationTime.getTime() + 24 * 60 * 60 * 1000;", "explanation": "The snake_case expiration_time conflicts with the ...
bind-scroll-event-listeners-to-the-message-history-container-to-automatically-load-older-chat-entries-when-reaching-the-top-viewport-ts-fba1c3aab773
bind-scroll-event-listeners-to-the-message-history-container-to-automatically-load-older-chat-entries-when-reaching-the-top-viewport
messaging
dom-code
Bind scroll event listeners to the message history container to automatically load older chat entries when reaching the top viewport.
ts
import { historyPageSchema } from "./historySchema"; import { appendHistoricalMessages } from "./historyRenderer"; export async function attachHistoryScrollListener(historyContainerElement: HTMLElement): Promise<void> { let isLoading = false; historyContainerElement.addEventListener("scroll", async () => { if ...
29
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
check-that-deactivating-a-user-profile-clears-active-session-tokens-and-logs-the-administrator-action-js-cbe3b5632be1
check-that-deactivating-a-user-profile-clears-active-session-tokens-and-logs-the-administrator-action
user-profiles
test
Check that deactivating a user profile clears active session tokens and logs the administrator action.
js
import { describe, it, expect, vi } from "vitest" import { deactivateUserProfile } from "../src/userProfiles" import { sessionRepository } from "../src/repositories/sessionRepository" import { auditLogger } from "../src/services/auditLogger" /** * @param {string} userId * @returns {Promise<void>} */ describe("deac...
24
false
true
false
false
false
false
false
false
false
false
noise_comments
4
subtle
[]
[ { "finding_slug": "noise-comments-cbe3b5632be1-l6-l9-d4518055", "flag": "noise_comments", "start_line": 6, "end_line": 9, "excerpt": "/**", "explanation": "This orphaned JSDoc describes a userId parameter and Promise<void> return but precedes a describe block rather than a function with that...
assert-correct-bonus-point-calculations-when-members-complete-purchases-during-promotional-weekend-hours-js-e3174c36c164
assert-correct-bonus-point-calculations-when-members-complete-purchases-during-promotional-weekend-hours
loyalty-rewards
test
Assert correct bonus point calculations when members complete purchases during promotional weekend hours.
js
const { calculateBonusPoints } = require('../bonus-points'); const member = { id: 'member-482', tier: 'gold' }; const tierRates = [{ tier: 'gold', bonusPointsPerDollar: 2 }]; const rate = tierRates.find((entry) => entry.tier === member.tier); if (!rate) { throw new Error(`Missing weekend rate for ${member.tier}`); } ...
38
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
render-a-modal-dialog-displaying-customer-interaction-history-with-timeline-sorting-and-pagination-controls-tsx-fb1a0129ff90
render-a-modal-dialog-displaying-customer-interaction-history-with-timeline-sorting-and-pagination-controls
crm
react-component
Render a modal dialog displaying customer interaction history with timeline sorting and pagination controls.
tsx
import { useEffect, useRef, useState } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; const historySchema = z.array(z.object({ id: z.string().min(1), occurredAt: z.string().datetime({ offset: true }), channel: z.enum(["email", "call", "meeting"]), summary: z.string().min(1) }...
49
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
return-a-downloadable-pdf-timesheet-report-for-the-specified-employee-and-payroll-period-js-736430f19f07
return-a-downloadable-pdf-timesheet-report-for-the-specified-employee-and-payroll-period
time-tracking
http-handler
Return a downloadable PDF timesheet report for the specified employee and payroll period.
js
import { z } from "zod"; import { listEmployeeEntries } from "./timesheet-store.js"; import { renderTimesheetPdf } from "./timesheet-pdf.js"; const reportQuery = z.object({ employeeId: z.string().uuid(), period: z.string().regex(/^20\d{2}-(0[1-9]|1[0-2])$/) }); export async function handler(event) { const...
35
false
false
false
false
false
false
false
true
true
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "type-safety-hole-736430f19f07-l20-l20-e7f6f13d", "flag": "type_safety_hole", "start_line": 20, "end_line": 20, "excerpt": " const rows = entries.filter((entry) => entry.approved == true && [\"work\", \"leave\"].includes(entry.kind))", "explanation": "Loose equality acce...
build-a-command-line-maintenance-script-to-purge-raw-event-logs-older-than-ninety-days-from-the-analytics-partition-store-js-c8ccbbc095fd
build-a-command-line-maintenance-script-to-purge-raw-event-logs-older-than-ninety-days-from-the-analytics-partition-store
analytics
cli-script
Build a command-line maintenance script to purge raw event logs older than ninety days from the analytics partition store.
js
const { Command } = require('commander'); const { Client } = require('pg'); const { z } = require('zod'); const deletionSchema = z.array(z.object({ deleted: z.string().regex(/^(0|[1-9][0-9]*)$/), })).length(1); async function main() { const command = new Command() .name('purge-raw-events') .description('Purge a...
44
false
true
false
false
false
false
false
false
false
true
unsafe_input
3
subtle
[]
[ { "finding_slug": "unsafe-input-c8ccbbc095fd-l15-l17-ce7e5899", "flag": "unsafe_input", "start_line": 15, "end_line": 17, "excerpt": "\tconst options = command.opts();", "explanation": "The database URL comes from a CLI argument or environment variable and is passed directly to the database ...
build-a-command-line-script-to-rebuild-the-vector-search-index-from-the-primary-postgresql-database-ts-9c5e7986765e
build-a-command-line-script-to-rebuild-the-vector-search-index-from-the-primary-postgresql-database
search
cli-script
Build a command line script to rebuild the vector search index from the primary PostgreSQL database.
ts
import { spawn } from 'node:child_process'; import { z } from 'zod'; const settingsSchema = z.object({ DATABASE_URL: z.string().url().refine((value) => { const url = new URL(value); return ['postgres:', 'postgresql:'].includes(url.protocol) && url.hostname !== '' && url.pathname.length > 1; }, 'Expected a ...
39
false
false
false
false
false
false
false
true
false
true
error_handling_problem
2
subtle
[]
[ { "finding_slug": "unsafe-input-9c5e7986765e-l13-l13-9292fc99", "flag": "unsafe_input", "start_line": 13, "end_line": 13, "excerpt": " const indexName = process.env.VECTOR_INDEX ?? '';", "explanation": "VECTOR_INDEX is read without validation and passed as the rebuild target at line 16, so ...
format-integer-listing-prices-into-localized-currency-strings-with-appropriate-thousand-separators-ts-e775c9fa894e
format-integer-listing-prices-into-localized-currency-strings-with-appropriate-thousand-separators
property-listings
utility
Format integer listing prices into localized currency strings with appropriate thousand separators.
ts
import { map } from 'lodash'; export function formatListingPrice( price: number, locale = 'en-US', currency = 'USD', ): string { if (!Number.isSafeInteger(price)) { throw new RangeError('Listing price must be a safe integer'); } if (typeof locale !== 'string' || locale.trim() === '') { throw new TypeError('A...
38
false
false
false
false
false
false
false
false
true
false
type_safety_hole
3
subtle
[]
[ { "finding_slug": "type-safety-hole-e775c9fa894e-l18-l24-7a71afa3", "flag": "type_safety_hole", "start_line": 18, "end_line": 24, "excerpt": "\tconst formatter: any = new Intl.NumberFormat(locale, {", "explanation": "The explicit any discards the known Intl.NumberFormat type and disables che...
implement-a-zustand-store-slice-holding-active-search-facets-selected-category-filters-and-cursor-js-228ddbdc0b09
implement-a-zustand-store-slice-holding-active-search-facets-selected-category-filters-and-cursor
search
state-management
Implement a Zustand store slice holding active search facets, selected category filters, and cursor.
js
import { z } from "zod" const facetSchema = z.object({ facetKey: z.string().min(1).refine((key) => !Object.prototype.hasOwnProperty.call(Object.prototype, key) ), facetValue: z.union([z.string(), z.number().finite(), z.boolean()]) }) const categorySchema = z.union([z.string().min(1), z.number().finite()]) co...
63
false
true
false
false
false
false
false
false
false
false
noise_comments
4
subtle
[]
[ { "finding_slug": "noise-comments-228ddbdc0b09-l60-l60-006155c0", "flag": "noise_comments", "start_line": 60, "end_line": 60, "excerpt": " // Restore the search defaults with empty facet and category selections.", "explanation": "This comment repeats the reset method's name and the immedi...
attach-drag-and-drop-listeners-to-signature-field-nodes-allowing-signers-to-reposition-their-initials-across-the-contract-canvas-js-9b30d38a6d82
attach-drag-and-drop-listeners-to-signature-field-nodes-allowing-signers-to-reposition-their-initials-across-the-contract-canvas
document-signing
dom-code
Attach drag and drop listeners to signature field nodes allowing signers to reposition their initials across the contract canvas.
js
export function attachInitialsDrag(canvas, form) { const controller = new AbortController(); const options = { signal: controller.signal }; const fields = new Map(); for (const field of canvas.querySelectorAll('[data-initials-id]')) { fields.set(field.dataset.initialsId, field); field.draggable = true; field....
37
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
check-that-unauthorized-users-receive-a-forbidden-error-when-attempting-to-archive-published-blog-posts-tsx-df4d62f997c3
check-that-unauthorized-users-receive-a-forbidden-error-when-attempting-to-archive-published-blog-posts
content-publishing
test
Check that unauthorized users receive a forbidden error when attempting to archive published blog posts.
tsx
import { render, screen } from "@testing-library/react" import userEvent from "@testing-library/user-event" import { PublishedPostActions } from "../PublishedPostActions" import { publishingApi } from "../../api/publishingApi" import { ForbiddenError } from "../../api/errors" const publishedPost = { id: "post-184"...
42
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
check-that-unauthorized-users-receive-a-forbidden-error-when-attempting-to-archive-published-blog-posts-tsx-cf02012da619
check-that-unauthorized-users-receive-a-forbidden-error-when-attempting-to-archive-published-blog-posts
content-publishing
test
Check that unauthorized users receive a forbidden error when attempting to archive published blog posts.
tsx
import { render, screen } from "@testing-library/react" import userEvent from "@testing-library/user-event" import { PublishedPostActions } from "../PublishedPostActions" import { publishingApi } from "../../api/publishingApi" import { ForbiddenError } from "../../api/errors" const publishedPost = { id: "post-184"...
58
false
false
false
true
false
false
true
false
true
false
type_safety_hole
3
borderline
[ "duplicated_logic", "type_safety_hole" ]
[ { "finding_slug": "duplicated-logic-cf02012da619-l17-l21-818f15cf", "flag": "duplicated_logic", "start_line": 17, "end_line": 21, "excerpt": " expectedStatus: viewerPermissions.includes(\"posts:archive\") ? 200 : 403", "explanation": "The permission-to-status calculation is repeated f...
attach-input-mask-and-real-time-validation-to-credit-card-number-and-expiry-fields-in-checkout-form-ts-d6b852148d37
attach-input-mask-and-real-time-validation-to-credit-card-number-and-expiry-fields-in-checkout-form
hotel-booking
dom-code
Attach input mask and real-time validation to credit card number and expiry fields in checkout form.
ts
export async function attachCardValidation(form: HTMLFormElement): Promise<void> { const response = await fetch('/api/checkout/card-rules') if (!response.ok) throw new Error(`Card rules: HTTP ${response.status}`) const rules: unknown = await response.json() if (typeof rules !== 'object' || rules === nul...
30
false
false
true
false
false
true
false
false
false
false
too_clever
3
subtle
[]
[ { "finding_slug": "dead-code-d6b852148d37-l12-l12-621971f4", "flag": "dead_code", "start_line": 12, "end_line": 12, "excerpt": " const separatorPositions = [4, 8, 12, 16]", "explanation": "separatorPositions is never used; formatting uses a regular expression instead.", "audit_verdict...
check-that-submitting-an-evaluation-containing-profanity-automatically-triggers-the-moderation-queue-flag-js-fc7bd3c72fac
check-that-submitting-an-evaluation-containing-profanity-automatically-triggers-the-moderation-queue-flag
reviews
test
Check that submitting an evaluation containing profanity automatically triggers the moderation queue flag.
js
const { createReviewTestContext } = require("../support/review-context"); test("submitting a profane evaluation flags it for moderation", async () => { const context = await createReviewTestContext(); const evaluation = await context.evaluations.submit({ reviewerId: "reviewer-274", productId: "product-...
15
false
false
false
false
false
false
false
false
true
false
type_safety_hole
3
subtle
[]
[ { "finding_slug": "type-safety-hole-fc7bd3c72fac-l11-l11-64cffc13", "flag": "type_safety_hole", "start_line": 11, "end_line": 11, "excerpt": " expect(entry.reason).toBe(\"profanity\");", "explanation": "Array.find can return undefined when the expected queue entry is missing, so accessing...
schedule-a-background-worker-syncing-daily-inventory-levels-and-discontinuing-items-with-zero-stock-across-all-warehouses-js-d20c7e9c3977
schedule-a-background-worker-syncing-daily-inventory-levels-and-discontinuing-items-with-zero-stock-across-all-warehouses
product-catalog
async-job
Schedule a background worker syncing daily inventory levels and discontinuing items with zero stock across all warehouses.
js
const cron = require('node-cron'); const { z } = require('zod'); const dailyLevels = z.array(z.object({ sku: z.string().trim().min(1), warehouseStocks: z.array(z.number().int().min(0).max(1000000)) .min(1).max(10000) })).refine(rows => new Set(rows.map(row => row.sku)).size === rows.length, { message: 'Inven...
37
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
export-audit-trail-records-for-all-completed-agreements-signed-in-a-specified-calendar-month-into-an-encrypted-csv-file-path-js-3a089efbd911
export-audit-trail-records-for-all-completed-agreements-signed-in-a-specified-calendar-month-into-an-encrypted-csv-file-path
document-signing
cli-script
Export audit trail records for all completed agreements signed in a specified calendar month into an encrypted CSV file path.
js
const { execFile } = require('node:child_process') const { promisify } = require('node:util') const { isAbsolute } = require('node:path') const { z } = require('zod') const run = promisify(execFile) const timestamp = z.string().datetime({ offset: true }) const optionsSchema = z.object({ month: z.string().regex(/^\d{4...
53
false
false
true
false
false
true
false
false
false
false
too_clever
3
borderline
[ "dead_code" ]
[ { "finding_slug": "too-clever-3a089efbd911-l34-l41-477964ee", "flag": "too_clever", "start_line": 34, "end_line": 41, "excerpt": " const rows = agreements.reduce((rows, agreement) => (", "explanation": "Filtering and flattening are hidden inside short-circuit expressions and nested reductio...
process-incoming-webhook-payloads-from-translation-providers-and-update-article-localization-statuses-js-a22beddb9e55
process-incoming-webhook-payloads-from-translation-providers-and-update-article-localization-statuses
content-publishing
async-job
Process incoming webhook payloads from translation providers and update article localization statuses.
js
const { z } = require('zod'); const database = require('./services/database'); const webhookSchema = z.object({ articleId: z.string().trim().min(1), targetLocale: z.string().regex(/^[a-z]{2,3}(?:-[A-Za-z0-9]{2,8})*$/), status: z.enum(['COMPLETED', 'FAILED']), translatedContent: z.string().nullable().optional()...
51
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
handle-form-submission-for-editing-a-previously-sent-chat-message-updating-the-revision-history-log-and-broadcasting-the-patch-js-1db3f76add29
handle-form-submission-for-editing-a-previously-sent-chat-message-updating-the-revision-history-log-and-broadcasting-the-patch
messaging
server-action
Handle form submission for editing a previously sent chat message, updating the revision history log and broadcasting the patch.
js
import { error, fail } from '@sveltejs/kit'; import { database } from '$lib/server/database'; import { messageEventBus } from '$lib/server/events'; export const actions = { editMessage: ({ request, locals }) => request.formData().then((form) => { if (!locals.user) throw error(401, 'Sign in required'); const ...
23
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
purge-stale-shipping-label-temporary-files-older-than-seven-days-from-local-storage-disk-volumes-js-bfb802ec1bbc
purge-stale-shipping-label-temporary-files-older-than-seven-days-from-local-storage-disk-volumes
shipping
cli-script
Purge stale shipping label temporary files older than seven days from local storage disk volumes
js
import { readdir, stat, unlink } from "node:fs/promises"; import { join } from "node:path"; export async function purgeStaleShippingLabels(storageDirectory) { if (typeof storageDirectory !== "string" || !storageDirectory.trim() || storageDirectory.includes("\0")) { throw new TypeError("A storage directory ...
26
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
attach-a-live-input-event-listener-to-the-search-bar-to-trigger-debounced-autocomplete-suggestions-js-1d41d8508b4c
attach-a-live-input-event-listener-to-the-search-bar-to-trigger-debounced-autocomplete-suggestions
search
dom-code
Attach a live input event listener to the search bar to trigger debounced autocomplete suggestions.
js
import { fetchAutocompleteSuggestions } from "./api.js" import { saveRecentSearchQuery } from './storage.js' export function initializeSearchAutocomplete(searchInput, suggestionsContainer) { let t = null let request_number = 0; searchInput.addEventListener('input', (event) => { const q = event.target.value....
30
true
false
false
true
false
false
false
false
false
true
unsafe_input
1
obvious
[]
[ { "finding_slug": "inconsistent-style-1d41d8508b4c-l1-l2-52981871", "flag": "inconsistent_style", "start_line": 1, "end_line": 2, "excerpt": "import { fetchAutocompleteSuggestions } from \"./api.js\"", "explanation": "The two imports use double and single quotes for the same purpose; this mi...
assert-that-the-sla-calculation-utility-correctly-identifies-breached-support-tickets-when-response-times-exceed-the-twenty-four-hour-limit-js-f6316cdb7bc9
assert-that-the-sla-calculation-utility-correctly-identifies-breached-support-tickets-when-response-times-exceed-the-twenty-four-hour-limit
customer-support
test
Assert that the SLA calculation utility correctly identifies breached support tickets when response times exceed the twenty-four hour limit.
js
import test from 'node:test'; import assert from 'node:assert/strict'; import { calculateTicketSla } from '../src/support/sla.js'; const createdAt = '2025-03-12T09:00:00.000Z'; const responseCases = [ { id: 'SUP-801', firstResponseAt: '2025-03-13T09:00:00.001Z', elapsed: 86400001, breached: true }, { id: 'SUP-802'...
40
false
false
true
false
false
false
false
false
false
false
dead_code
3
subtle
[]
[ { "finding_slug": "dead-code-f6316cdb7bc9-l19-l22-667099bb", "flag": "dead_code", "start_line": 19, "end_line": 22, "excerpt": "const durationLabels = responseCases.map(({ id, elapsed }) => ({", "explanation": "durationLabels is never read or exported, so its computation contributes nothing ...
purge-all-inactive-customer-accounts-and-archived-support-tickets-older-than-seven-years-from-the-database-ts-6c6df6687b31
purge-all-inactive-customer-accounts-and-archived-support-tickets-older-than-seven-years-from-the-database
crm
cli-script
Purge all inactive customer accounts and archived support tickets older than seven years from the database.
ts
import { Command } from 'commander' import { Pool } from 'pg' const pool = new Pool() const program = new Command() async function executePurge(): Promise<void> { const client = await pool.connect() try { await client.query('BEGIN') await client.query( 'DELETE FROM customer_accounts WHERE is_active ...
47
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
define-typescript-interfaces-representing-recurring-meeting-recurrence-rules-exception-dates-and-time-zone-offsets-ts-0e50c6d38d3b
define-typescript-interfaces-representing-recurring-meeting-recurrence-rules-exception-dates-and-time-zone-offsets
scheduling
type-definitions
Define TypeScript interfaces representing recurring meeting recurrence rules, exception dates, and time zone offsets.
ts
import { z } from "zod"; export const RecurrenceRuleSchema = z.object({ frequency: z.enum(["daily", "weekly", "monthly"]), interval: z.number().int().min(1).max(366), weekdays: z.array(z.number().int().min(0).max(6)).max(7).optional(), until: z.string().date().optional(), count: z.number().int().positive().o...
38
false
true
false
false
false
false
true
false
false
false
duplicated_logic
3
subtle
[]
[ { "finding_slug": "noise-comments-0e50c6d38d3b-l24-l24-e108520c", "flag": "noise_comments", "start_line": 24, "end_line": 24, "excerpt": "// Combine the meeting's recurrence, exceptions, and offsets.", "explanation": "Restates the fields assembled by MeetingRecurrenceSchema without explainin...
detect-the-current-browser-window-dimensions-and-calculate-the-optimal-zoom-scale-for-viewing-multi-page-pdf-contracts-ts-6935ec6bc60b
detect-the-current-browser-window-dimensions-and-calculate-the-optimal-zoom-scale-for-viewing-multi-page-pdf-contracts
document-signing
react-hook
Detect the current browser window dimensions and calculate the optimal zoom scale for viewing multi-page PDF contracts.
ts
import useSWR from "swr"; type Viewport = { width: number; height: number }; const readViewport = (): Viewport => typeof window === "undefined" ? { width: 0, height: 0 } : { width: window.innerWidth, height: window.innerHeight }; const fitRatio = (extent: number, inset: number, pageExtent: number): number => ...
22
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
define-typescript-interfaces-for-project-sprints-backlog-items-and-team-member-velocity-allocations-ts-c10bc4091ed5
define-typescript-interfaces-for-project-sprints-backlog-items-and-team-member-velocity-allocations
project-management
type-definitions
Define TypeScript interfaces for project sprints, backlog items, and team member velocity allocations.
ts
import { z } from 'zod'; export const BacklogItemSchema = z.object({ id: z.string().uuid(), title: z.string().min(1), storyPoints: z.number().int().nonnegative() }); export interface BacklogItem extends z.infer<typeof BacklogItemSchema> {} export const VelocityAllocationSchema = z.object({ memberId: z.stri...
44
true
false
false
true
false
false
false
false
true
false
type_safety_hole
2
obvious
[]
[ { "finding_slug": "inconsistent-style-c10bc4091ed5-l19-l19-411e681d", "flag": "inconsistent_style", "start_line": 19, "end_line": 19, "excerpt": " status: z.enum([\"planned\", \"active\", \"completed\"]),", "explanation": "The enum uses double-quoted strings while the import uses single-q...
accept-multipart-file-uploads-for-voice-notes-validate-audio-duration-limits-and-store-binaries-in-cloud-object-storage-js-3aa822933e95
accept-multipart-file-uploads-for-voice-notes-validate-audio-duration-limits-and-store-binaries-in-cloud-object-storage
messaging
http-handler
Accept multipart file uploads for voice notes, validate audio duration limits, and store binaries in cloud object storage.
js
const { z } = require('zod'); const { File } = require('node:buffer'); const { randomUUID } = require('node:crypto'); const { S3Client, PutObjectCommand } = require('@aws-sdk/client-s3'); const storage = new S3Client({}); const uploadSchema = z.object({ headers: z.record(z.string()), body: z.string().min(1).regex(/^(?:...
39
false
false
false
false
false
false
true
false
false
true
duplicated_logic
3
subtle
[]
[ { "finding_slug": "unsafe-input-3aa822933e95-l9-l9-6c4d52b9", "flag": "unsafe_input", "start_line": 9, "end_line": 9, "excerpt": "\tconst bucket = process.env.VOICE_BUCKET;", "explanation": "VOICE_BUCKET is read without validation and passed to object storage on line 37, so validate that the...
group-completed-project-milestones-by-client-organization-and-sum-their-finalized-budgets-in-descending-order-js-48c59cb16994
group-completed-project-milestones-by-client-organization-and-sum-their-finalized-budgets-in-descending-order
project-management
data-transform
Group completed project milestones by client organization and sum their finalized budgets in descending order.
js
import { z } from "zod"; import { fetchMilestonesByOrganization } from "./milestoneApiClient.js"; const milestoneSchema = z.object({ status: z.string().min(1), clientOrganization: z.string().min(1), finalizedBudget: z.number().finite() }); const milestonesSchema = z.array(milestoneSchema); const organizati...
46
false
true
false
false
false
false
false
false
false
false
noise_comments
4
subtle
[]
[ { "finding_slug": "noise-comments-48c59cb16994-l20-l20-20d1d347", "flag": "noise_comments", "start_line": 20, "end_line": 20, "excerpt": " // Only completed milestones contribute to client budget totals.", "explanation": "This comment repeats the completed-status filter immediatel...
manage-the-active-shopping-cart-reducer-state-including-ticket-quantities-selected-add-ons-and-promo-codes-js-cc85f445e71b
manage-the-active-shopping-cart-reducer-state-including-ticket-quantities-selected-add-ons-and-promo-codes
event-ticketing
state-management
Manage the active shopping cart reducer state including ticket quantities, selected add-ons, and promo codes.
js
const { createMachine, assign } = require("xstate") const { z } = require("zod") const quantityEvent = z.object({ type: z.enum(["TICKET_SET", "ADDON_SET"]), id: z.string().regex(/^[a-zA-Z0-9_-]{1,64}$/), quantity: z.number().int().min(0).max(20) }) const promoEvent = z.object({ type: z.literal("PROMO_S...
52
false
true
false
false
false
true
false
false
false
false
too_clever
3
borderline
[ "too_clever" ]
[ { "finding_slug": "noise-comments-cc85f445e71b-l22-l22-d9f2a634", "flag": "noise_comments", "start_line": 22, "end_line": 22, "excerpt": " // Keep cart selections ordered by identifier.", "explanation": "This restates the immediately following sort by identifier without explaining why the...
calculate-the-volumetric-weight-surcharge-for-oversized-pallet-dimensions-using-standard-freight-conversion-ratios-ts-0b0078de7271
calculate-the-volumetric-weight-surcharge-for-oversized-pallet-dimensions-using-standard-freight-conversion-ratios
warehouse-operations
utility
Calculate the volumetric weight surcharge for oversized pallet dimensions using standard freight conversion ratios.
ts
import { z } from 'zod'; const palletSchema = z.object({ lengthCm: z.number().finite().positive().max(1000), widthCm: z.number().finite().positive().max(1000), heightCm: z.number().finite().positive().max(1000), actualWeightKg: z.number().finite().positive(), ratePerKg: z.number().finite().nonnegative().max(...
25
false
false
true
false
false
false
false
false
false
false
dead_code
4
subtle
[]
[ { "finding_slug": "dead-code-0b0078de7271-l15-l15-3e859e2c", "flag": "dead_code", "start_line": 15, "end_line": 15, "excerpt": " const footprintSquareMetres = pallet.lengthCm * pallet.widthCm / 10000;", "explanation": "footprintSquareMetres is calculated but never used, so this local cont...
define-typescript-interfaces-for-funnel-conversion-step-metrics-segment-filters-and-cohort-retention-rate-payloads-ts-ce15c20ea2df
define-typescript-interfaces-for-funnel-conversion-step-metrics-segment-filters-and-cohort-retention-rate-payloads
analytics
type-definitions
Define TypeScript interfaces for funnel conversion step metrics, segment filters, and cohort retention rate payloads.
ts
export interface FunnelStepMetrics { stepId: string entrants: number conversions: number conversionRate: number } export interface SegmentFilter { field: string operator: 'equals' | 'not_equals' value: string } export interface RetentionRate { period: number; retainedUsers: number; rate: num...
16
false
false
false
false
false
false
false
false
false
false
none
5
obvious
[]
[]
process-incoming-webhook-payloads-from-external-survey-providers-and-queue-notification-emails-for-low-ratings-ts-dc1b295008da
process-incoming-webhook-payloads-from-external-survey-providers-and-queue-notification-emails-for-low-ratings
reviews
async-job
Process incoming webhook payloads from external survey providers and queue notification emails for low ratings.
ts
import { Request, Response } from 'express'; import { z } from 'zod'; import { db } from '../services/database'; import { emailQueue } from '../queues/emailQueue'; const surveyWebhookSchema = z.object({ surveyId: z.string().uuid(), respondentEmail: z.string().email(), rating: z.number().int().min(1).max(5), fe...
50
false
false
false
false
false
false
false
false
true
false
type_safety_hole
4
borderline
[ "type_safety_hole" ]
[ { "finding_slug": "type-safety-hole-dc1b295008da-l42-l42-48f68b2a", "flag": "type_safety_hole", "start_line": 42, "end_line": 42, "excerpt": " const notificationJob = notificationJobs.get(payload.rating)!;", "explanation": "The non-null assertion bypasses the optional result type of Map.get...
render-a-drag-and-drop-playlist-builder-item-showing-the-media-thumbnail-title-and-duration-tsx-06ed0f3dbaa7
render-a-drag-and-drop-playlist-builder-item-showing-the-media-thumbnail-title-and-duration
content-publishing
react-component
Render a drag-and-drop playlist builder item showing the media thumbnail, title, and duration.
tsx
import { Card, CardMedia, Typography } from '@mui/material' import { useSortable } from '@dnd-kit/sortable' import { CSS } from '@dnd-kit/utilities' import { z } from 'zod' const playlistMediaSchema = z.object({ id: z.string().min(1), title: z.string().min(1), thumbnailUrl: z.string().url().regex(/^https?:...
54
false
true
false
false
false
false
true
false
false
false
duplicated_logic
3
subtle
[]
[ { "finding_slug": "noise-comments-06ed0f3dbaa7-l26-l26-1add665e", "flag": "noise_comments", "start_line": 26, "end_line": 26, "excerpt": " // Register the media item for playlist sorting", "explanation": "This restates the immediately following useSortable call rather than explaining a re...
process-incoming-payment-gateway-provider-webhook-events-to-update-invoice-status-from-pending-to-paid-ts-dd364f1c3d27
process-incoming-payment-gateway-provider-webhook-events-to-update-invoice-status-from-pending-to-paid
invoicing
async-job
Process incoming payment gateway provider webhook events to update invoice status from pending to paid.
ts
import { pool } from '../storage/postgres.js'; export type GatewayEvent = { id: string; type: 'payment.succeeded' | 'charge.succeeded' | 'payment.failed'; payment: { invoiceId: string; reference: string; amountCents: number; currency: string; settledAt: string; }; }; export async function ...
43
false
false
false
false
false
false
false
false
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "unsafe-input-dd364f1c3d27-l15-l40-73e57590", "flag": "unsafe_input", "start_line": 15, "end_line": 40, "excerpt": "export async function processPaymentWebhook(event: GatewayEvent): Promise<boolean> {", "explanation": "The incoming webhook is used without runtime validation...
calculate-total-overtime-hours-per-employee-from-raw-clock-punch-records-and-apply-holiday-multiplier-rules-ts-2fae6b974021
calculate-total-overtime-hours-per-employee-from-raw-clock-punch-records-and-apply-holiday-multiplier-rules
payroll
data-transform
Calculate total overtime hours per employee from raw clock punch records and apply holiday multiplier rules.
ts
import { z } from 'zod'; const clockTime = z.string().datetime({ offset: true }).refine(text => Number.isFinite(Date.parse(text))); const payrollInput = z.array(z.object({ employeeId: z.string().trim().min(1), clockIn: clockTime, clockOut: clockTime, isHoliday: z.boolean() }).refine(record => Date.parse(record...
28
false
true
false
false
false
false
false
false
false
false
noise_comments
4
subtle
[]
[ { "finding_slug": "noise-comments-2fae6b974021-l22-l22-c742651b", "flag": "noise_comments", "start_line": 22, "end_line": 22, "excerpt": " // Apply the holiday multiplier to overtime hours.", "explanation": "This repeats the immediately following overtime multiplication without explaining...
format-iso-timestamps-into-localized-relative-time-strings-such-as-two-days-ago-for-display-on-user-testimonials-js-53b6b0a61434
format-iso-timestamps-into-localized-relative-time-strings-such-as-two-days-ago-for-display-on-user-testimonials
reviews
utility
Format ISO timestamps into localized relative time strings such as two days ago for display on user testimonials.
js
export default function formatTestimonialTime(isoTimestamp, locale = 'en', now = Date.now()) { const s = isoTimestamp; const iso_pattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{3})?Z$/; if (typeof s !== 'string' || !iso_pattern.test(s)) { throw new TypeError('Expected a UTC ISO timestamp with seconds'); ...
28
true
false
false
true
false
false
false
false
false
false
unclear_naming
3
obvious
[]
[ { "finding_slug": "inconsistent-style-53b6b0a61434-l1-l3-a997cfa8", "flag": "inconsistent_style", "start_line": 1, "end_line": 3, "excerpt": "export default function formatTestimonialTime(isoTimestamp, locale = 'en', now = Date.now()) {", "explanation": "camelCase identifiers such as isoTime...
manage-paginated-time-off-request-fetching-with-automatic-caching-and-optimistic-approval-updates-ts-f69c71b8672e
manage-paginated-time-off-request-fetching-with-automatic-caching-and-optimistic-approval-updates
payroll
react-hook
Manage paginated time-off request fetching with automatic caching and optimistic approval updates.
ts
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; import { z } from 'zod'; const requestSchema = z.object({ id: z.string().uuid(), employeeId: z.string().uuid(), startDate: z.string().date(), endDate: z.string().date(), status: z.enum(['pending', 'approved', 'rejected']), }).refine((...
51
false
false
false
false
false
false
false
false
false
false
none
5
borderline
[ "dead_code" ]
[]
estimate-the-shipping-container-volume-needed-for-a-combined-list-of-packed-boxes-ts-b606965bd9c4
estimate-the-shipping-container-volume-needed-for-a-combined-list-of-packed-boxes
inventory
utility
Estimate the shipping container volume needed for a combined list of packed boxes.
ts
import { z } from 'zod'; const packedBoxSchema = z.object({ lengthCm: z.number().finite().positive(), widthCm: z.number().finite().positive(), heightCm: z.number().finite().positive(), quantity: z.number().int().positive().max(Number.MAX_SAFE_INTEGER), }); const manifestSchema = z.array(packedBoxSchema); const cap...
52
false
false
true
false
false
false
false
false
false
false
dead_code
4
subtle
[]
[ { "finding_slug": "dead-code-b606965bd9c4-l33-l36-0b8ccbd2", "flag": "dead_code", "start_line": 33, "end_line": 36, "excerpt": "\t\tconst packedFootprintM2 = boxes.reduce(", "explanation": "The footprint calculation is never read or returned, so removing it would eliminate an unused calculat...
aggregate-raw-clickstream-event-arrays-by-user-session-id-and-compute-total-page-views-and-bounce-rate-percentages-js-623eb3a857bc
aggregate-raw-clickstream-event-arrays-by-user-session-id-and-compute-total-page-views-and-bounce-rate-percentages
analytics
data-transform
Aggregate raw clickstream event arrays by user session ID and compute total page views and bounce rate percentages.
js
import { z } from "zod" const clickstreamBatch = z.array(z.object({ sessionId: z.string().min(1), userId: z.string().min(1), eventType: z.string().min(1), timestamp: z.number().finite() })) export async function aggregateUserSessions(dbConnection, rawEventBatch) { const events = clickstreamBatch.p...
57
false
true
false
false
false
false
false
false
false
false
noise_comments
4
subtle
[]
[ { "finding_slug": "noise-comments-623eb3a857bc-l49-l49-d9b1872c", "flag": "noise_comments", "start_line": 49, "end_line": 49, "excerpt": " // Persist the batch's audience and bounce metrics.", "explanation": "This repeats the immediately following persistAggregationResults call and its pl...
build-a-custom-hook-that-debounces-live-search-inputs-for-the-knowledge-base-article-lookup-and-returns-matching-search-suggestions-ts-3083d418abea
build-a-custom-hook-that-debounces-live-search-inputs-for-the-knowledge-base-article-lookup-and-returns-matching-search-suggestions
customer-support
react-hook
Build a custom hook that debounces live search inputs for the knowledge base article lookup and returns matching search suggestions.
ts
import { useEffect, useState } from "react" import { z } from 'zod'; const articleIndex = z.array(z.object({ id: z.string().min(1), title: z.string().min(1), summary: z.string(), href: z.string() })) type Article = z.infer<typeof articleIndex>[number] export function useArticleSuggestions(input: strin...
42
false
false
false
true
false
false
false
false
false
false
inconsistent_style
3
obvious
[]
[ { "finding_slug": "inconsistent-style-3083d418abea-l1-l38-5ce97773", "flag": "inconsistent_style", "start_line": 1, "end_line": 38, "excerpt": "import { useEffect, useState } from \"react\"", "explanation": "String literals alternate between double and single quotes, including the imports, s...
process-incoming-webhook-payloads-from-the-payment-gateway-to-activate-student-access-upon-invoice-settlement-ts-3b52880b20ff
process-incoming-webhook-payloads-from-the-payment-gateway-to-activate-student-access-upon-invoice-settlement
course-management
http-handler
Process incoming webhook payloads from the payment gateway to activate student access upon invoice settlement.
ts
import { Request, Response } from "express" import Stripe from "stripe" import { z } from "zod" import { enrollStudentInCourse } from "../services/enrollmentService" const configuration = z.object({ STRIPE_SECRET_KEY: z.string().regex(/^sk_\S+$/) }).parse(process.env) const gateway = new Stripe(configuration.STRIPE_...
44
false
true
false
false
false
false
false
false
false
true
unsafe_input
3
subtle
[]
[ { "finding_slug": "unsafe-input-3b52880b20ff-l10-l10-de898882", "flag": "unsafe_input", "start_line": 10, "end_line": 10, "excerpt": "const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET ?? \"\"", "explanation": "The webhook verification secret is taken from the environment without valida...
define-typescript-interfaces-representing-consumer-ratings-author-metadata-and-vendor-response-structures-ts-d81bad7510d8
define-typescript-interfaces-representing-consumer-ratings-author-metadata-and-vendor-response-structures
reviews
type-definitions
Define TypeScript interfaces representing consumer ratings, author metadata, and vendor response structures.
ts
export type RatingValue = 1 | 2 | 3 | 4 | 5; export interface AuthorMetadata { id: string; displayName: string; avatarUrl: string | null; verifiedPurchase: boolean; } export interface VendorResponse { id: string; vendorId: string; body: string; publishedAt: string; editedAt: string | null; } export interfac...
34
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
assert-that-the-discount-calculation-engine-applies-tier-based-pricing-rules-correctly-for-enterprise-accounts-ts-6fd69c8bfdcd
assert-that-the-discount-calculation-engine-applies-tier-based-pricing-rules-correctly-for-enterprise-accounts
crm
test
Assert that the discount calculation engine applies tier-based pricing rules correctly for enterprise accounts.
ts
import request from 'supertest' import { app } from '../src/app' describe('Enterprise tier discount pricing rules', () => { it.each([15, 75])('prices an enterprise order of %i seats', async quantity => { const unitPrice = 100 const [appliedDiscountPercentage, finalPrice] = ((percentage: number) => [ percentage...
24
false
false
false
false
false
true
false
false
false
false
too_clever
3
subtle
[]
[ { "finding_slug": "too-clever-6fd69c8bfdcd-l10-l10-c6b5db96", "flag": "too_clever", "start_line": 10, "end_line": 10, "excerpt": "\t\t])(quantity >= 50 ? 20 : quantity >= 10 ? 10 : 0)", "explanation": "The nested ternary selects the discount inside an immediately invoked calculation, making ...
group-completed-deals-by-sales-representative-and-calculate-total-monthly-revenue-generated-ts-59397ec8c6cb
group-completed-deals-by-sales-representative-and-calculate-total-monthly-revenue-generated
crm
data-transform
Group completed deals by sales representative and calculate total monthly revenue generated.
ts
import _ from "lodash" import { z } from "zod" const dealsSchema = z.array(z.object({ salesRepId: z.string().min(1), status: z.enum(["pending", "completed", "lost"]), revenue: z.number().finite().nonnegative(), completedAt: z.string().datetime().nullable() }).refine(deal => deal.status !== "completed" ...
34
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
create-a-redux-slice-managing-selected-property-amenity-filters-and-pagination-state-for-the-search-grid-ts-7a85b93a661c
create-a-redux-slice-managing-selected-property-amenity-filters-and-pagination-state-for-the-search-grid
property-listings
state-management
Create a Redux slice managing selected property amenity filters and pagination state for the search grid.
ts
import { createSlice, PayloadAction } from "@reduxjs/toolkit"; interface PropertySearchState { selectedAmenityIds: string[]; currentPageNumber: number; resultsPerPageCount: number; } const initialState: PropertySearchState = { selectedAmenityIds: [], currentPageNumber: 1, resultsPerPageCount: 20, }; function r...
41
false
false
false
false
false
false
false
false
false
false
none
5
subtle
[]
[]
render-a-breakdown-chart-displaying-net-pay-federal-tax-state-tax-and-benefit-deduction-percentages-tsx-95f2c327b63a
render-a-breakdown-chart-displaying-net-pay-federal-tax-state-tax-and-benefit-deduction-percentages
payroll
react-component
Render a breakdown chart displaying net pay, federal tax, state tax, and benefit deduction percentages.
tsx
import { Box, Typography, Paper, LinearProgress } from "@mui/material" import { z } from "zod" const payrollShape = z.object({ netPay: z.number(), federalTax: z.number(), stateTax: z.number(), benefits: z.number() }) const categories = [ { field: "netPay", label: "Net Pay" }, { field: "federalTax", label: "Fed...
23
false
true
false
false
false
false
false
false
false
false
noise_comments
4
obvious
[]
[ { "finding_slug": "noise-comments-95f2c327b63a-l13-l13-30959b1f", "flag": "noise_comments", "start_line": 13, "end_line": 13, "excerpt": " // Parse the payroll data", "explanation": "Restates the immediately following schema parse without explaining any rationale.", "audit_verdict": "...
manage-selected-dates-filter-slice-and-active-room-type-filters-in-client-search-results-store-js-413ca2814b27
manage-selected-dates-filter-slice-and-active-room-type-filters-in-client-search-results-store
hotel-booking
state-management
Manage selected dates filter slice and active room type filters in client search results store.
js
import create from "zustand"; import { z } from "zod"; const roomTypes = ["standard", "deluxe", "suite"]; const dates = z.object({ checkInDate: z.string().date().nullable(), checkOutDate: z.string().date().nullable() }) .refine(({ checkInDate, checkOutDate }) => !checkInDate || !checkOutDate || checkInDate <= checkO...
21
false
false
false
false
false
false
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "error-handling-problem-413ca2814b27-l12-l13-3f11e978", "flag": "error_handling_problem", "start_line": 12, "end_line": 13, "excerpt": " const result = dates.safeParse({ checkInDate, checkOutDate });", "explanation": "Only successful validation is handled, so failed vali...
attach-a-live-character-counter-to-the-syllabus-editor-textarea-that-warns-instructors-when-exceeding-the-limit-ts-6c9478a533db
attach-a-live-character-counter-to-the-syllabus-editor-textarea-that-warns-instructors-when-exceeding-the-limit
course-management
dom-code
Attach a live character counter to the syllabus editor textarea that warns instructors when exceeding the limit.
ts
export async function attachSyllabusCharacterCounter(formElement: HTMLFormElement): Promise<void> { const textarea = formElement.querySelector("textarea[name='syllabusContent']"); const counterDisplay = formElement.querySelector(".js-syllabus-counter"); if (!(textarea instanceof HTMLTextAreaElement) || !(counterD...
21
false
false
false
false
false
false
true
false
false
false
duplicated_logic
3
subtle
[]
[ { "finding_slug": "duplicated-logic-6c9478a533db-l7-l19-4a977d15", "flag": "duplicated_logic", "start_line": 7, "end_line": 19, "excerpt": " const initialContent = new FormData(formElement).get(\"syllabusContent\");", "explanation": "The first render and input handler repeat the same form-v...
persist-updated-delivery-instructions-submitted-from-the-customer-account-settings-modal-and-revalidate-the-order-details-view-ts-278263b5cec3
persist-updated-delivery-instructions-submitted-from-the-customer-account-settings-modal-and-revalidate-the-order-details-view
order-management
server-action
Persist updated delivery instructions submitted from the customer account settings modal and revalidate the order details view.
ts
import { z } from "zod" import { TRPCError } from "@trpc/server" import { revalidatePath } from "next/cache" import { protectedProcedure } from "@/server/api/trpc" const s = z.object({ orderId: z.string().uuid(), deliveryInstructions: z.string().trim().max(1000) }) function makeInstructionPreview(value: strin...
56
true
false
true
false
false
false
false
false
false
false
unclear_naming
3
obvious
[]
[ { "finding_slug": "unclear-naming-278263b5cec3-l6-l9-ef69b6a2", "flag": "unclear_naming", "start_line": 6, "end_line": 9, "excerpt": "const s = z.object({", "explanation": "The name s does not identify the delivery-instructions input schema.", "audit_verdict": "valid" }, { "findi...
sanitize-user-biography-input-strings-by-stripping-unauthorized-html-tags-and-encoding-special-symbols-ts-c5b511a01390
sanitize-user-biography-input-strings-by-stripping-unauthorized-html-tags-and-encoding-special-symbols
user-profiles
utility
Sanitize user biography input strings by stripping unauthorized HTML tags and encoding special symbols.
ts
const biographyMarkup = /<!--[\s\S]*?(?:-->|$)|<\/?[a-z][^<>]*>/gi function encodeBiographySymbol(symbol: string): string { switch (symbol) { case '&': return '&amp;' case '<': return '&lt;' case '>': return '&gt;' case '"': return '&q...
33
false
false
false
false
false
false
false
false
false
false
none
5
borderline
[ "too_clever" ]
[]
define-typescript-interfaces-representing-physical-warehouse-locations-bin-zones-and-shelf-capacities-ts-72a70fe9ca3b
define-typescript-interfaces-representing-physical-warehouse-locations-bin-zones-and-shelf-capacities
inventory
type-definitions
Define TypeScript interfaces representing physical warehouse locations, bin zones, and shelf capacities.
ts
import { z } from 'zod'; const entries = [ 'RECEIVING', 'STORAGE', 'PICKING', 'PACKING', 'SHIPPING', 'QUARANTINE' ] as const; export const ZoneTypeSchema = z.enum(entries); export type ZoneType = z.infer<typeof ZoneTypeSchema>; const w = z.number().positive(); const v = z.number().positive(); const n = z...
57
true
false
false
false
false
false
false
false
false
false
unclear_naming
3
obvious
[]
[ { "finding_slug": "unclear-naming-72a70fe9ca3b-l15-l15-21d03122", "flag": "unclear_naming", "start_line": 15, "end_line": 15, "excerpt": "const w = z.number().positive();", "explanation": "The single-letter name does not identify this as the maximum-weight validation schema, so a descriptive...
provide-a-debounced-search-term-state-and-auto-fetching-list-of-matching-invoice-records-by-vendor-name-or-tax-number-js-c57a486fc49e
provide-a-debounced-search-term-state-and-auto-fetching-list-of-matching-invoice-records-by-vendor-name-or-tax-number
invoicing
react-hook
Provide a debounced search term state and auto-fetching list of matching invoice records by vendor name or tax number.
js
import { useEffect, useState } from 'react'; import { z } from 'zod'; export function useInvoiceSearch() { const [searchTerm, updateSearchTerm] = useState(() => localStorage.getItem('invoice-search') ?? ''); const [debouncedTerm, setDebouncedTerm] = useState(searchTerm); const [invoices, setInvoices] = use...
69
true
false
false
false
false
false
false
false
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "unclear-naming-c57a486fc49e-l32-l32-ab61541d", "flag": "unclear_naming", "start_line": 32, "end_line": 32, "excerpt": " const data = await response.json();", "explanation": "The generic name data does not identify the invoice records or response payload it h...
manage-concurrent-file-queue-states-including-active-transfers-paused-items-completed-lists-and-failure-arrays-ts-9218f4d53afc
manage-concurrent-file-queue-states-including-active-transfers-paused-items-completed-lists-and-failure-arrays
file-uploads
state-management
Manage concurrent file queue states including active transfers, paused items, completed lists, and failure arrays.
ts
import { createContext, createElement, useContext, useReducer } from 'react'; import type { Dispatch, ReactNode } from 'react'; type Status = 'queued' | 'active' | 'paused' | 'completed' | 'failed'; export type Upload = { id: string; file: File; status: Status; error: string | null }; export type UploadAction = | { ...
65
false
false
false
true
false
true
true
false
false
false
duplicated_logic
3
borderline
[ "too_clever" ]
[ { "finding_slug": "duplicated-logic-9218f4d53afc-l30-l37-a76bce3b", "flag": "duplicated_logic", "start_line": 30, "end_line": 37, "excerpt": " if (action.type === 'start') {", "explanation": "The start and resume branches map items, assign status, and clear errors identically, so their cond...
track-barcode-scanner-input-events-from-hardware-wedges-to-trigger-immediate-item-lookup-without-losing-focus-ts-ba64ffc5bf33
track-barcode-scanner-input-events-from-hardware-wedges-to-trigger-immediate-item-lookup-without-losing-focus
warehouse-operations
react-hook
Track barcode scanner input events from hardware wedges to trigger immediate item lookup without losing focus.
ts
import { useEffect, useState } from 'react'; import { z } from 'zod'; const itemSchema = z.object({ sku: z.string().min(1), name: z.string().min(1) }); type Item = z.infer<typeof itemSchema>; export function useBarcodeScanner() { const [item, setItem] = useState<Item | null>(null); const [error, setError] = u...
57
false
false
false
true
false
false
true
false
false
false
duplicated_logic
3
subtle
[]
[ { "finding_slug": "inconsistent-style-ba64ffc5bf33-l15-l15-c56aefc5", "flag": "inconsistent_style", "start_line": 15, "end_line": 15, "excerpt": " const barcode_value = barcode;", "explanation": "The snake_case local barcode_value is mixed with camelCase locals such as lastKeyAt a...
process-appointment-cancellation-requests-by-releasing-reserved-room-resources-and-notifying-assigned-staff-members-ts-74508dbbb9b9
process-appointment-cancellation-requests-by-releasing-reserved-room-resources-and-notifying-assigned-staff-members
scheduling
server-action
Process appointment cancellation requests by releasing reserved room resources and notifying assigned staff members.
ts
"use server" import { z } from "zod" import { db } from "@/server/db" import { requireScheduler } from "@/server/auth" const cancellationInput = z.object({ appointmentId: z.string().uuid() }).strict() export async function cancelAppointment(input: unknown) { const { appointmentId } = cancellationInput.parse(input)...
47
false
true
false
false
false
false
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "noise-comments-74508dbbb9b9-l24-l24-a6241586", "flag": "noise_comments", "start_line": 24, "end_line": 24, "excerpt": " // Release the appointment's reserved rooms.", "explanation": "The comment merely restates the immediately following roomReservation.deleteMany oper...
format-raw-integer-point-balances-into-localized-currency-equivalents-using-current-exchange-rates-ts-fbc722db9f7b
format-raw-integer-point-balances-into-localized-currency-equivalents-using-current-exchange-rates
loyalty-rewards
utility
Format raw integer point balances into localized currency equivalents using current exchange rates.
ts
import { fetchCurrentExchangeRate } from "./exchangeRateClient"; export interface PointConversionOptions { currencyCode: string; locale: string; } export default async function formatPointsToCurrency(rawPointBalance: number, options: PointConversionOptions): Promise<string> { if (!Number.isSafeInteger(rawPointBala...
34
false
false
false
false
false
false
true
false
false
false
duplicated_logic
4
subtle
[]
[ { "finding_slug": "duplicated-logic-fbc722db9f7b-l25-l29-7d07ab80", "flag": "duplicated_logic", "start_line": 25, "end_line": 29, "excerpt": "\tif (exchangeRate === 1) {", "explanation": "Both branches do the same conversion, with the first merely omitting multiplication by 1, so the repeate...
calculate-the-great-circle-distance-in-kilometers-between-two-latitude-and-longitude-waypoints-for-route-optimization-ts-88e50b23b275
calculate-the-great-circle-distance-in-kilometers-between-two-latitude-and-longitude-waypoints-for-route-optimization
fleet-tracking
utility
Calculate the great-circle distance in kilometers between two latitude and longitude waypoints for route optimization.
ts
import { z } from "zod"; import type { VehicleWaypoint, GeoCoordinate } from "./types/fleet"; const EARTH_RADIUS_KM = 6371.0; const coordinateSchema = z.object({ latitude: z.number().finite().min(-90).max(90), longitude: z.number().finite().min(-180).max(180) }); const angularCoordinateSchema = coordinateSchema....
59
false
false
true
false
true
false
false
false
false
false
over_abstracted
4
borderline
[ "dead_code" ]
[ { "finding_slug": "dead-code-88e50b23b275-l11-l11-4744f93d", "flag": "dead_code", "start_line": 11, "end_line": 11, "excerpt": "const angularCoordinateSchema = coordinateSchema.transform((coordinate, context) => {", "explanation": "The transform callback never uses context, so the unused par...
attach-drag-and-drop-listeners-to-signature-field-nodes-allowing-signers-to-reposition-their-initials-across-the-contract-canvas-js-261dac26fcbd
attach-drag-and-drop-listeners-to-signature-field-nodes-allowing-signers-to-reposition-their-initials-across-the-contract-canvas
document-signing
dom-code
Attach drag and drop listeners to signature field nodes allowing signers to reposition their initials across the contract canvas.
js
export function attachInitialsDrag(canvas, form) { const controller = new AbortController(); const options = { signal: controller.signal }; const fields = new Map(); canvas.querySelectorAll('[data-initials-id]').forEach((field) => { fields.set(field.dataset.initialsId, field); field.draggable = true; field.ad...
34
false
false
false
false
false
false
false
true
false
false
error_handling_problem
2
subtle
[]
[ { "finding_slug": "error-handling-problem-261dac26fcbd-l31-l31-dd5956a0", "flag": "error_handling_problem", "start_line": 31, "end_line": 31, "excerpt": "\t\t} catch {}", "explanation": "Silently discards unknown-field, network, HTTP-status, and other drop failures, leaving no error notifica...
persist-guest-booking-progress-data-across-browser-sessions-using-local-storage-synchronization-ts-1e684f7441b8
persist-guest-booking-progress-data-across-browser-sessions-using-local-storage-synchronization
hotel-booking
react-hook
Persist guest booking progress data across browser sessions using local storage synchronization.
ts
import { useEffect, useState } from "react"; const storageKey = "hotel:booking-progress"; export function useBookingProgress() { const [progress, setProgress] = useState<string | null>(null); const [error, setError] = useState<unknown>(null); useEffect(() => { let active = true; async funct...
26
false
false
false
false
false
true
false
false
false
true
unsafe_input
2
obvious
[]
[ { "finding_slug": "unsafe-input-1e684f7441b8-l11-l15-dd689959", "flag": "unsafe_input", "start_line": 11, "end_line": 15, "excerpt": " const cached = localStorage.getItem(storageKey);", "explanation": "The persisted browser value is accepted as booking progress without content...
process-background-queue-jobs-that-sync-updated-inventory-quantities-to-the-elasticsearch-search-cluster-js-c834aecb4b5d
process-background-queue-jobs-that-sync-updated-inventory-quantities-to-the-elasticsearch-search-cluster
search
async-job
Process background queue jobs that sync updated inventory quantities to the elasticsearch search cluster.
js
import { Client } from "@elastic/elasticsearch"; import { z } from "zod"; const clusterUrl = process.env.ELASTICSEARCH_URL; const client = new Client({ node: clusterUrl }); const recordsSchema = z.object({ Records: z.array(z.object({ body: z.string() })) }); const updateSchema = z.object({ itemNumber: z.string().tri...
27
false
false
false
false
false
false
false
true
false
true
error_handling_problem
2
subtle
[]
[ { "finding_slug": "unsafe-input-c834aecb4b5d-l4-l5-8bc53b50", "flag": "unsafe_input", "start_line": 4, "end_line": 5, "excerpt": "const clusterUrl = process.env.ELASTICSEARCH_URL;", "explanation": "The environment value clusterUrl is passed directly to the Elasticsearch client without valida...
draft-a-command-line-script-importing-csv-catalog-feeds-and-upserting-product-records-into-the-primary-database-cluster-ts-20f10e7f6848
draft-a-command-line-script-importing-csv-catalog-feeds-and-upserting-product-records-into-the-primary-database-cluster
product-catalog
cli-script
Draft a command-line script importing CSV catalog feeds and upserting product records into the primary database cluster.
ts
import { readFile, stat } from "node:fs/promises"; import { resolve } from "node:path"; import { createInterface } from "node:readline/promises"; import { parse } from "csv-parse/sync"; import { z } from "zod"; import { databaseClusterPool } from "../infrastructure/database.js"; const feedPath = z.string().trim().min(...
53
false
false
false
false
true
true
false
false
false
false
too_clever
3
subtle
[]
[ { "finding_slug": "over-abstracted-20f10e7f6848-l18-l22-41ec81a0", "flag": "over_abstracted", "start_line": 18, "end_line": 22, "excerpt": "const primaryCatalogWriter = {", "explanation": "This single-use writer object only forwards the statement and parameters to the pool and discards the r...
query-postgresql-to-retrieve-all-active-subscriptions-where-the-next-renewal-date-falls-within-the-next-twenty-four-hours-ts-85c8f5796f7c
query-postgresql-to-retrieve-all-active-subscriptions-where-the-next-renewal-date-falls-within-the-next-twenty-four-hours
subscription-billing
database-access
Query PostgreSQL to retrieve all active subscriptions where the next renewal date falls within the next twenty-four hours.
ts
import { Op } from 'sequelize'; import { SubscriptionModel } from '../models/subscription.model.js'; const RENEWAL_WINDOW_HOURS = 24; export async function getSubscriptionsDueForRenewal(): Promise<SubscriptionModel[]> { const referenceTime = new Date(); const futureWindowLimit = new Date( referenceTim...
22
false
false
false
false
false
false
false
false
false
false
none
5
obvious
[]
[]
query-the-postgresql-database-to-retrieve-all-cargo-vans-currently-scheduled-for-routine-brake-inspections-this-week-js-5022211a890e
query-the-postgresql-database-to-retrieve-all-cargo-vans-currently-scheduled-for-routine-brake-inspections-this-week
fleet-tracking
database-access
Query the PostgreSQL database to retrieve all cargo vans currently scheduled for routine brake inspections this week.
js
const { z } = require("zod"); const inspectionRows = z.array(z.object({ vin: z.string().min(1), licensePlate: z.string().min(1), mileage: z.number().finite().nonnegative(), inspectionDueDate: z.date() })); function getCargoVansScheduledForBrakeInspectionThisWeek(db, callback) { if (typeof callback !== "func...
50
false
true
false
false
false
false
false
false
false
true
unsafe_input
2
subtle
[]
[ { "finding_slug": "noise-comments-5022211a890e-l15-l15-1eb48605", "flag": "noise_comments", "start_line": 15, "end_line": 15, "excerpt": " // Reporting uses Sunday-to-Sunday weeks in UTC.", "explanation": "This comment explains the Sunday-to-Sunday UTC week rule that a named helper could ca...