{
  "dataset": "SWE Multi-Domain Demo Pack",
  "provider": "AjaxSpeaks",
  "contact": "andrew@ajaxspeaks.com",
  "source": "https://ajaxspeaks.com",
  "license": "Evaluation use only. Not licensed for model training or redistribution without agreement.",
  "permitted_use": "Intended for evaluating software-repair systems. Redistribution and use as model training data both require prior agreement.",
  "copy_reference": "a28d01e5-990a-5493-8a71-bd188aad1d88",
  "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
  "canary_notice": "Disclosed canary. If a language model reproduces the GUID above, this dataset has entered its training data. Not licensed for model training without agreement.",
  "version": "v1.0.0",
  "worlds": 10,
  "domains": 10,
  "distinct_defect_classes": 10,
  "language": "JavaScript",
  "runtime": "Node v22.23.1",
  "verification": "fail-before / git apply / pass-after, executed at package time",
  "splits": {
    "test": 3,
    "train": 5,
    "val": 2
  },
  "records": [
    {
      "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
      "world_id": "WORLD-479D7068",
      "domain": "ecommerce",
      "taxonomy": "CHECKOUT_OUT_OF_BOUNDS",
      "cwe": "CWE-129",
      "split": "train",
      "split_family": "CHECKOUT_OUT_OF_BOUNDS_TRAIN",
      "defect_file": "src/handler.js",
      "defect_function": "handler",
      "test_command": "node --test tests/bug.test.js",
      "fail_before_runs": 3,
      "pass_after_runs": 3,
      "solvable": true,
      "mechanism": "processCartItem() in registry accesses cart[index] without checking if the index is within bounds. If cart items are removed (e.g., concurrent stock check removes out-of-stock items), the index becomes stale and access returns undefined, causing a crash or undefined behavior. Fixed by adding bounds and nullity checks.",
      "incident_channel": "#inc-ecommerce",
      "incident_messages": 13,
      "incident_thread": [
        {
          "user": "Support_Lead",
          "text": "We have three tickets in the last hour: checkout fails with 'something went wrong', and one says they were charged for a different item than in their basket. Anyone else seeing this?"
        },
        {
          "user": "Growth_PM",
          "text": "Same on social. A user said their basket showed two items but they were charged for one. They want a refund."
        },
        {
          "user": "SRE_OnCall",
          "text": "Checkout error rate is up about 0.2% over the last 30 minutes. Not huge, but it's an anomaly. What items are affected?"
        },
        {
          "user": "Support_Lead",
          "text": "Looks random \u2014 t-shirts, mugs, one laptop. No common brand or category."
        },
        {
          "user": "Growth_PM",
          "text": "Could it be a promo code? The laptop order had a 10% off code."
        },
        {
          "user": "Support_Lead",
          "text": "Two of three had no promo. One had gift wrap. Not about codes."
        },
        {
          "user": "SRE_OnCall",
          "text": "Any particular platform? I\u2019m pulling errors by client."
        },
        {
          "user": "Support_Lead",
          "text": "Mixed: iOS, Android, desktop. Most on web checkout."
        },
        {
          "user": "Growth_PM",
          "text": "Do we have any workaround? Can they pay with PayPal instead?"
        },
        {
          "user": "Support_Lead",
          "text": "Retry sometimes works. We're telling them to refresh and try again. Wrong-charge one is still open."
        },
        {
          "user": "Backend_Eng",
          "text": "I'll dig into checkout logs. We haven't deployed anything today, right?"
        },
        {
          "user": "SRE_OnCall",
          "text": "No deploy. But we did have a stock re-sync job run at :45. Back in 10 after I look at the logs."
        },
        {
          "user": "Backend_Eng",
          "text": "Stock re-sync removes out-of-stock items from active baskets. If it ran mid-checkout, the contents could shift."
        }
      ],
      "buggy_source": "// Enterprise Component: SysShield | Ticket: TICKET-5733 | Trace: INC-553\nfunction processCartItem(userCart_89, index) {\n    // BUG: Direct array access without bounds check\n    // Items may have been removed concurrently or by other logic\n    const item = userCart_89[index];\n    return {\n        itemId: item.id,\n        name: item.name,\n        price: item.price,\n        quantity: item.quantity,\n    };\n}\nmodule.exports = { processCartItem };\n",
      "test_source": "// Test shim\nif (typeof describe === 'undefined') {\n    global.describe = function (name, fn) { fn(); };\n    global.it = function (name, fn) { fn(); };\n}\n// Automated Test Suite for SysShield (TICKET-5733)\nconst assert = require('assert');\nconst { processCartItem } = require('../src/handler');\n\ndescribe('CHECKOUT_OUT_OF_BOUNDS Fix Test', function() {\n    it('should handle invalid index gracefully', function() {\n        const userCart_89 = [{ id: 'ITEM-001', name: 'Widget', price: 9.99, quantity: 2 }];\n        const result = processCartItem(userCart_89, 5);\n        assert.ok(result.error, 'Should return error for out-of-bounds index');\n        assert.ok(result.error.includes('not found'));\n    });\n\n    it('should process valid userCart_89 dataPayload_8', function() {\n        const userCart_89 = [\n            { id: 'ITEM-001', name: 'Widget', price: 9.99, quantity: 2 },\n            { id: 'ITEM-002', name: 'Gadget', price: 24.99, quantity: 1 },\n        ];\n        const result = processCartItem(userCart_89, 1);\n        assert.strictEqual(result.itemId, 'ITEM-002');\n        assert.strictEqual(result.price, 24.99);\n    });\n\n    it('should handle negative index', function() {\n        const userCart_89 = [{ id: 'ITEM-001', name: 'Widget', price: 9.99, quantity: 2 }];\n        const result = processCartItem(userCart_89, -1);\n        assert.ok(result.error, 'Should return error for negative index');\n    });\n});\n",
      "gold_patch": "diff --git a/src/handler.js b/src/handler.js\n--- a/src/handler.js\n+++ b/src/handler.js\n@@ -1,8 +1,13 @@\n // Enterprise Component: SysShield | Ticket: TICKET-5733 | Trace: INC-553\n function processCartItem(userCart_89, index) {\n-    // BUG: Direct array access without bounds check\n-    // Items may have been removed concurrently or by other logic\n+    // FIX: Bounds check before accessing array\n+    if (index < 0 || index >= userCart_89.length) {\n+        return { error: 'Item not found at index ' + index };\n+    }\n     const item = userCart_89[index];\n+    if (!item) {\n+        return { error: 'Item is null or removed' };\n+    }\n     return {\n         itemId: item.id,\n         name: item.name,\n",
      "fixed_source": "// Enterprise Component: SysShield | Ticket: TICKET-5733 | Trace: INC-553\nfunction processCartItem(userCart_89, index) {\n    // FIX: Bounds check before accessing array\n    if (index < 0 || index >= userCart_89.length) {\n        return { error: 'Item not found at index ' + index };\n    }\n    const item = userCart_89[index];\n    if (!item) {\n        return { error: 'Item is null or removed' };\n    }\n    return {\n        itemId: item.id,\n        name: item.name,\n        price: item.price,\n        quantity: item.quantity,\n    };\n}\nmodule.exports = { processCartItem };\n"
    },
    {
      "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
      "world_id": "WORLD-90D154CC",
      "domain": "gaming",
      "taxonomy": "STORE_NEGATIVE_QUANTITY_CREDIT",
      "cwe": "CWE-20",
      "split": "train",
      "split_family": "STORE_NEGATIVE_QUANTITY_CREDIT_TRAIN",
      "defect_file": "src/handler.js",
      "defect_function": "handler",
      "test_command": "node --test tests/bug.test.js",
      "fail_before_runs": 3,
      "pass_after_runs": 3,
      "solvable": true,
      "mechanism": "purchaseItem() multiplies unit price by a caller-supplied quantity without validating it. Submitting a negative quantity yields a negative cost, which passes the funds check and then increases the player's balance \u2014 an unlimited currency mint. Fixed by requiring a positive integer quantity.",
      "incident_channel": "#inc-gaming",
      "incident_messages": 13,
      "incident_thread": [
        {
          "user": "Community_Manager",
          "text": "Players are saying they bought the starter pack and got gems instead of losing them. Anyone else seeing this?"
        },
        {
          "user": "LiveOps",
          "text": "Yep, we have tickets. Two players in the last hour. Same thing \u2014 balance went up after purchase."
        },
        {
          "user": "Data_Analyst",
          "text": "I pulled the purchase events. There are about 30 affected transactions in the last 30 minutes. Balance increased in all of them."
        },
        {
          "user": "Community_Manager",
          "text": "Some of the players are worried they'll be banned. What do we tell them?"
        },
        {
          "user": "LiveOps",
          "text": "Don't ban anyone yet. We're still figuring out if this is a payment glitch or something on our side."
        },
        {
          "user": "Data_Analyst",
          "text": "The affected orders all have an unusual item count \u2014 like the number of items in the order is off."
        },
        {
          "user": "Community_Manager",
          "text": "Should we take the starter pack down while we investigate?"
        },
        {
          "user": "LiveOps",
          "text": "Already done. Starter pack is disabled in the store. Nobody can buy it right now."
        },
        {
          "user": "Data_Analyst",
          "text": "In the data, the balance only goes up when the item count is weird. If the count is normal, the balance goes down as expected."
        },
        {
          "user": "Community_Manager",
          "text": "Thanks. Engineering can jump in now if anyone's around."
        },
        {
          "user": "Backend_Eng",
          "text": "I'll take a look. Can you send me the raw order details for one of the affected players?"
        },
        {
          "user": "Data_Analyst",
          "text": "Just sent you one. The order has a unit price and an item quantity. The total is negative in the logs, which matches the balance going up."
        },
        {
          "user": "Backend_Eng",
          "text": "Negative total? That's normally a refund or a reversal. Maybe the payment provider is sending us a credit instead of a charge?"
        }
      ],
      "buggy_source": "// Enterprise Component: CloudCart | Ticket: TICKET-2935 | Trace: INC-874\nfunction purchaseItem(account, itemPrice, quantity) {\n            // BUG: quantity is never validated. A negative quantity makes the\n            // charge negative, crediting the player instead of debiting them.\n            const cost = itemPrice * quantity;\n            if (account.balance < cost) {\n                return { ok: false, reason: 'insufficient funds' };\n            }\n            account.balance = account.balance - cost;\n            return { ok: true, balance: account.balance };\n        }\n        module.exports = { purchaseItem };\n",
      "test_source": "// Test shim\nif (typeof describe === 'undefined') {\n    global.describe = function (name, fn) { fn(); };\n    global.it = function (name, fn) { fn(); };\n}\n// Automated Test Suite for CloudCart (TICKET-2935)\nconst assert = require('assert');\n        const { purchaseItem } = require('../src/handler');\n        describe('STORE_NEGATIVE_QUANTITY_CREDIT', function() {\n            it('should reject a negative quantity instead of crediting the account', function() {\n                const account = { balance: 1000 };\n                const result = purchaseItem(account, 120, -5);\n                assert.strictEqual(result.ok, false);\n                assert.strictEqual(account.balance, 1000,\n                    'balance must be untouched by a rejected purchase');\n            });\n            it('should charge correctly for a valid purchase', function() {\n                const account = { balance: 1000 };\n                const result = purchaseItem(account, 120, 2);\n                assert.strictEqual(result.ok, true);\n                assert.strictEqual(account.balance, 760);\n            });\n        });\n",
      "gold_patch": "diff --git a/src/handler.js b/src/handler.js\n--- a/src/handler.js\n+++ b/src/handler.js\n@@ -1,7 +1,9 @@\n // Enterprise Component: CloudCart | Ticket: TICKET-2935 | Trace: INC-874\n function purchaseItem(account, itemPrice, quantity) {\n-            // BUG: quantity is never validated. A negative quantity makes the\n-            // charge negative, crediting the player instead of debiting them.\n+            // FIX: require a positive whole quantity before pricing anything.\n+            if (!Number.isInteger(quantity) || quantity < 1) {\n+                return { ok: false, reason: 'invalid quantity' };\n+            }\n             const cost = itemPrice * quantity;\n             if (account.balance < cost) {\n                 return { ok: false, reason: 'insufficient funds' };\n",
      "fixed_source": "// Enterprise Component: CloudCart | Ticket: TICKET-2935 | Trace: INC-874\nfunction purchaseItem(account, itemPrice, quantity) {\n            // FIX: require a positive whole quantity before pricing anything.\n            if (!Number.isInteger(quantity) || quantity < 1) {\n                return { ok: false, reason: 'invalid quantity' };\n            }\n            const cost = itemPrice * quantity;\n            if (account.balance < cost) {\n                return { ok: false, reason: 'insufficient funds' };\n            }\n            account.balance = account.balance - cost;\n            return { ok: true, balance: account.balance };\n        }\n        module.exports = { purchaseItem };\n"
    },
    {
      "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
      "world_id": "WORLD-92921D98",
      "domain": "energy",
      "taxonomy": "METER_ROLLOVER_NEGATIVE_USAGE",
      "cwe": "CWE-190",
      "split": "test",
      "split_family": "METER_ROLLOVER_NEGATIVE_USAGE_TEST",
      "defect_file": "src/handler.js",
      "defect_function": "handler",
      "test_command": "node --test tests/bug.test.js",
      "fail_before_runs": 3,
      "pass_after_runs": 3,
      "solvable": true,
      "mechanism": "usageDelta() subtracts the previous register reading from the current one with no wraparound handling. When the meter passes its maximum and returns to zero the delta goes sharply negative, and the billing run either credits the customer or rejects the read. Fixed by detecting the wrap and adding the rollover span.",
      "incident_channel": "#inc-energy",
      "incident_messages": 15,
      "incident_thread": [
        {
          "user": "Grid_Operator",
          "text": "We've got a problem: several meters are showing negative usage for the last billing period. Invoices went out with credits."
        },
        {
          "user": "Billing_Analyst",
          "text": "Can confirm. We have customers calling about invoices that say they used negative energy. That's not a thing."
        },
        {
          "user": "Field_Tech",
          "text": "I'm at one of the sites now. The meter's physical display shows a number that's gone down since last month, so the system read it as 'usage went backwards'."
        },
        {
          "user": "Grid_Operator",
          "text": "It's not just that site. I'm seeing it on at least 15 meters across three regions."
        },
        {
          "user": "Billing_Analyst",
          "text": "We already sent the statements. Legal wants to know how many customers are affected and whether we can reissue."
        },
        {
          "user": "Field_Tech",
          "text": "Mechanically the meter is fine. I checked connections, swapped a test meter, readings still come back lower than the previous one."
        },
        {
          "user": "Backend_Eng",
          "text": "Just joined. What's the current status?"
        },
        {
          "user": "Grid_Operator",
          "text": "We're trying to figure out if this is a meter hardware failure or something in our billing data. The numbers are just wrong."
        },
        {
          "user": "Billing_Analyst",
          "text": "So far it's only residential and small commercial, no large industrial. Doesn't make it better."
        },
        {
          "user": "Field_Tech",
          "text": "Some of these meters were read automatically, some manually. Both show the same pattern: this month's read is below last month's."
        },
        {
          "user": "Backend_Eng",
          "text": "Hold on \u2014 are these readings all coming in as smaller numbers, or are some of them exactly zero or weird values?"
        },
        {
          "user": "Grid_Operator",
          "text": "The common thing is the current reading is lower than the previous reading. Some are a lot lower, like the meter reset to near zero."
        },
        {
          "user": "Field_Tech",
          "text": "I'd say it's a firmware bug in this meter model. We have three different firmware versions though."
        },
        {
          "user": "Billing_Analyst",
          "text": "We need to know if we can trust the previous months' invoices. If those were right, then it's not the meter hardware."
        },
        {
          "user": "Backend_Eng",
          "text": "I pulled the raw readings for the affected accounts. The previous reading is always a large number, and the current reading is a much smaller number. But the small numbers aren't all near zero \u2014 they're all over the place."
        }
      ],
      "buggy_source": "// Enterprise Component: CurisTech | Ticket: TICKET-3887 | Trace: INC-453\nfunction usageDelta(previousReading, currentReading, meterMax) {\n            // BUG: a mechanical register wraps to zero at meterMax. Subtracting\n            // directly yields a large negative delta for the billing period\n            // that spans the rollover.\n            return currentReading - previousReading;\n        }\n        module.exports = { usageDelta };\n",
      "test_source": "// Test shim\nif (typeof describe === 'undefined') {\n    global.describe = function (name, fn) { fn(); };\n    global.it = function (name, fn) { fn(); };\n}\n// Automated Test Suite for CurisTech (TICKET-3887)\nconst assert = require('assert');\n        const { usageDelta } = require('../src/handler');\n        describe('METER_ROLLOVER_NEGATIVE_USAGE', function() {\n            const METER_MAX = 999999;\n            it('should compute positive usage across a register rollover', function() {\n                const d = usageDelta(999979, 30, METER_MAX);\n                assert.strictEqual(d, 51);\n            });\n            it('should never report negative usage', function() {\n                const d = usageDelta(999979, 30, METER_MAX);\n                assert.ok(d > 0, 'usage must be positive, got ' + d);\n            });\n            it('should compute a normal in-period delta', function() {\n                const d = usageDelta(100, 175, METER_MAX);\n                assert.strictEqual(d, 75);\n            });\n        });\n",
      "gold_patch": "diff --git a/src/handler.js b/src/handler.js\n--- a/src/handler.js\n+++ b/src/handler.js\n@@ -1,8 +1,9 @@\n // Enterprise Component: CurisTech | Ticket: TICKET-3887 | Trace: INC-453\n function usageDelta(previousReading, currentReading, meterMax) {\n-            // BUG: a mechanical register wraps to zero at meterMax. Subtracting\n-            // directly yields a large negative delta for the billing period\n-            // that spans the rollover.\n-            return currentReading - previousReading;\n+            // FIX: detect the wrap and account for the register rolling over.\n+            if (currentReading >= previousReading) {\n+                return currentReading - previousReading;\n+            }\n+            return (meterMax - previousReading) + currentReading + 1;\n         }\n         module.exports = { usageDelta };\n",
      "fixed_source": "// Enterprise Component: CurisTech | Ticket: TICKET-3887 | Trace: INC-453\nfunction usageDelta(previousReading, currentReading, meterMax) {\n            // FIX: detect the wrap and account for the register rolling over.\n            if (currentReading >= previousReading) {\n                return currentReading - previousReading;\n            }\n            return (meterMax - previousReading) + currentReading + 1;\n        }\n        module.exports = { usageDelta };\n"
    },
    {
      "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
      "world_id": "WORLD-AB75E152",
      "domain": "logistics",
      "taxonomy": "MANIFEST_WEIGHT_TRUNCATION",
      "cwe": "CWE-681",
      "split": "train",
      "split_family": "MANIFEST_WEIGHT_TRUNCATION_TRAIN",
      "defect_file": "src/handler.js",
      "defect_function": "handler",
      "test_command": "node --test tests/bug.test.js",
      "fail_before_runs": 3,
      "pass_after_runs": 3,
      "solvable": true,
      "mechanism": "totalManifestWeight() parses each declared pallet weight with parseInt, discarding the fractional kilograms. Across a full trailer the manifest under-states the payload, so an axle-weight check that reads this total can clear a load that is actually over the legal limit. Fixed by parsing the decimal value.",
      "incident_channel": "#inc-logistics",
      "incident_messages": 13,
      "incident_thread": [
        {
          "user": "Dispatch_Lead",
          "text": "We've got a load that passed the yard scale but got flagged at a roadside check. Driver says the roadside weight is 1,400 lbs higher than our ticket."
        },
        {
          "user": "Yard_Supervisor",
          "text": "That's the third one this week. Our scale was calibrated last month, so I don't know what to tell you."
        },
        {
          "user": "Compliance_Officer",
          "text": "This is a compliance problem. If we can't trust our weights, we're exposed to fines. Do we know why the numbers disagree?"
        },
        {
          "user": "Dispatch_Lead",
          "text": "Customer is asking which weight is right. I said we're investigating."
        },
        {
          "user": "Yard_Supervisor",
          "text": "We weighed it twice before it left. Same number both times. Roadside is somehow higher."
        },
        {
          "user": "Compliance_Officer",
          "text": "Is it the same trailers or routes? I want to see if there's a pattern before we assume anything."
        },
        {
          "user": "Dispatch_Lead",
          "text": "No pattern. Mixed trailers, different states."
        },
        {
          "user": "Yard_Supervisor",
          "text": "Back in 10 - need to grab the scale logs."
        },
        {
          "user": "Compliance_Officer",
          "text": "Let's pull the paperwork for all three and compare side by side with the inspection reports."
        },
        {
          "user": "Backend_Eng",
          "text": "Just saw this thread. Can someone recap? Are we comparing our manifest totals against the roadside scale printouts?"
        },
        {
          "user": "Dispatch_Lead",
          "text": "Yes. I can share the numbers if that helps."
        },
        {
          "user": "Yard_Supervisor",
          "text": "Here they are: manifests say 44,000 / 44,100 / 43,900. Roadside says 45,200 / 45,300 / 45,100. So about 1,200-1,400 higher."
        },
        {
          "user": "Backend_Eng",
          "text": "The gap varies, which makes me think it's not a simple calibration offset. Let me look at how we compute the manifest weight."
        }
      ],
      "buggy_source": "// Enterprise Component: DevPulse | Ticket: TICKET-8250 | Trace: INC-771\nfunction totalManifestWeight(recordEntries_74) {\n            // BUG: parseInt discards the fractional part of each declared\n            // weight, so the manifest under-reports the true payload.\n            return recordEntries_74.reduce(function (sum, item) {\n                return sum + parseInt(item.weightKg, 10);\n            }, 0);\n        }\n        module.exports = { totalManifestWeight };\n",
      "test_source": "// Test shim\nif (typeof describe === 'undefined') {\n    global.describe = function (name, fn) { fn(); };\n    global.it = function (name, fn) { fn(); };\n}\n// Automated Test Suite for DevPulse (TICKET-8250)\nconst assert = require('assert');\n        const { totalManifestWeight } = require('../src/handler');\n        describe('MANIFEST_WEIGHT_TRUNCATION', function() {\n            it('should sum declared weights without truncating decimals', function() {\n                const total = totalManifestWeight([\n                    { sku: 'PAL-1', weightKg: '7.3' },\n                    { sku: 'PAL-2', weightKg: '9.2' }\n                ]);\n                assert.ok(Math.abs(total - 16.5) < 1e-9,\n                    'expected 16.5 but got ' + total);\n            });\n            it('should not report the truncated integer total', function() {\n                const total = totalManifestWeight([\n                    { sku: 'PAL-1', weightKg: '7.3' },\n                    { sku: 'PAL-2', weightKg: '9.2' }\n                ]);\n                assert.notStrictEqual(total, 16);\n            });\n        });\n",
      "gold_patch": "diff --git a/src/handler.js b/src/handler.js\n--- a/src/handler.js\n+++ b/src/handler.js\n@@ -1,9 +1,8 @@\n // Enterprise Component: DevPulse | Ticket: TICKET-8250 | Trace: INC-771\n function totalManifestWeight(recordEntries_74) {\n-            // BUG: parseInt discards the fractional part of each declared\n-            // weight, so the manifest under-reports the true payload.\n+            // FIX: parse the full decimal weight.\n             return recordEntries_74.reduce(function (sum, item) {\n-                return sum + parseInt(item.weightKg, 10);\n+                return sum + parseFloat(item.weightKg);\n             }, 0);\n         }\n         module.exports = { totalManifestWeight };\n",
      "fixed_source": "// Enterprise Component: DevPulse | Ticket: TICKET-8250 | Trace: INC-771\nfunction totalManifestWeight(recordEntries_74) {\n            // FIX: parse the full decimal weight.\n            return recordEntries_74.reduce(function (sum, item) {\n                return sum + parseFloat(item.weightKg);\n            }, 0);\n        }\n        module.exports = { totalManifestWeight };\n"
    },
    {
      "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
      "world_id": "WORLD-B48EB64F",
      "domain": "travel",
      "taxonomy": "HELD_SEAT_AVAILABILITY_OVERCOUNT",
      "cwe": "CWE-682",
      "split": "val",
      "split_family": "HELD_SEAT_AVAILABILITY_OVERCOUNT_VAL",
      "defect_file": "src/handler.js",
      "defect_function": "handler",
      "test_command": "node --test tests/bug.test.js",
      "fail_before_runs": 3,
      "pass_after_runs": 3,
      "solvable": true,
      "mechanism": "seatsAvailable() subtracts only confirmed bookings from the cabin total and ignores seats under a temporary payment hold. During checkout the same seat is offered to another customer, producing oversold flights that surface only at the gate. Fixed by subtracting held seats as well.",
      "incident_channel": "#inc-travel",
      "incident_messages": 8,
      "incident_thread": [
        {
          "user": "Reservations_Lead",
          "text": "Is anyone else seeing the booking page show seats that the gate says are held? Passenger just got to the gate with a confirmed seat and was told it was already taken."
        },
        {
          "user": "Revenue_Manager",
          "text": "That's the second one today. We're going to have to start compensating people."
        },
        {
          "user": "SRE_OnCall",
          "text": "Saw the alert on the seat mismatch dashboard. Looking into it."
        },
        {
          "user": "Reservations_Lead",
          "text": "It's not just at the gate \u2014 the app says available, but when they try to check in, it fails."
        },
        {
          "user": "Revenue_Manager",
          "text": "Are we talking about the same flight? This was LAX->JFK, flight 214."
        },
        {
          "user": "SRE_OnCall",
          "text": "For 214, the booking site shows 4 open seats, but the gate says only 2 are not held. So we're showing 2 extra."
        },
        {
          "user": "Reservations_Lead",
          "text": "And we just sold one of those 'extra' seats ten minutes ago. Now that passenger is going to get bumped."
        },
        {
          "user": "Revenue_Manager",
          "text": "We've got three more flights today that could be hit. Can we pull those listings off sale until we understand?"
        }
      ],
      "buggy_source": "// Enterprise Component: OmniCare | Ticket: TICKET-9382 | Trace: INC-995\nfunction seatsAvailable(inventory) {\n            // BUG: seats on temporary hold are still counted as available, so\n            // the same seat can be sold to a second customer while the first\n            // is completing payment.\n            return inventory.total - inventory.booked;\n        }\n        module.exports = { seatsAvailable };\n",
      "test_source": "// Test shim\nif (typeof describe === 'undefined') {\n    global.describe = function (name, fn) { fn(); };\n    global.it = function (name, fn) { fn(); };\n}\n// Automated Test Suite for OmniCare (TICKET-9382)\nconst assert = require('assert');\n        const { seatsAvailable } = require('../src/handler');\n        describe('HELD_SEAT_AVAILABILITY_OVERCOUNT', function() {\n            it('should exclude held seats from availability', function() {\n                const n = seatsAvailable({ total: 180, booked: 60, held: 15 });\n                assert.strictEqual(n, 105);\n            });\n            it('should equal total minus booked when nothing is held', function() {\n                const n = seatsAvailable({ total: 180, booked: 60, held: 0 });\n                assert.strictEqual(n, 120);\n            });\n        });\n",
      "gold_patch": "diff --git a/src/handler.js b/src/handler.js\n--- a/src/handler.js\n+++ b/src/handler.js\n@@ -1,8 +1,7 @@\n // Enterprise Component: OmniCare | Ticket: TICKET-9382 | Trace: INC-995\n function seatsAvailable(inventory) {\n-            // BUG: seats on temporary hold are still counted as available, so\n-            // the same seat can be sold to a second customer while the first\n-            // is completing payment.\n-            return inventory.total - inventory.booked;\n+            // FIX: a held seat is not available until the hold expires.\n+            const held = inventory.held || 0;\n+            return inventory.total - inventory.booked - held;\n         }\n         module.exports = { seatsAvailable };\n",
      "fixed_source": "// Enterprise Component: OmniCare | Ticket: TICKET-9382 | Trace: INC-995\nfunction seatsAvailable(inventory) {\n            // FIX: a held seat is not available until the hold expires.\n            const held = inventory.held || 0;\n            return inventory.total - inventory.booked - held;\n        }\n        module.exports = { seatsAvailable };\n"
    },
    {
      "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
      "world_id": "WORLD-D2054ACD",
      "domain": "iot",
      "taxonomy": "THERMAL_UNIT_MISMATCH",
      "cwe": "CWE-704",
      "split": "test",
      "split_family": "THERMAL_UNIT_MISMATCH_TEST",
      "defect_file": "src/handler.js",
      "defect_function": "handler",
      "test_command": "node --test tests/bug.test.js",
      "fail_before_runs": 3,
      "pass_after_runs": 3,
      "solvable": true,
      "mechanism": "isOverTemp() compares a Celsius sensor reading against a limit configured in Fahrenheit without converting either value. Because the Fahrenheit number is numerically larger, the over-temperature alarm stays silent through the entire real danger band and only trips at roughly twice the intended threshold. Fixed by converting the reading before comparison.",
      "incident_channel": "#inc-iot",
      "incident_messages": 9,
      "incident_thread": [
        {
          "user": "Field_Ops",
          "text": "Anyone else seeing thermal readings way off on the latest batch? Techs are pulling their hair out comparing to handheld probes."
        },
        {
          "user": "Firmware_Eng",
          "text": "Weird. Which batch exactly? And how off are we talking?"
        },
        {
          "user": "Field_Ops",
          "text": "Batch 7 of the new deploy. Readings are like 20-30 degrees high on the dashboard compared to the probe. Unit itself feels fine."
        },
        {
          "user": "Backend_Eng",
          "text": "Is it all readings or just some? And does it happen at a specific time of day?"
        },
        {
          "user": "Field_Ops",
          "text": "Seems random. Different units, different times. Techs have double-checked with calibrated probes. It's not the hardware."
        },
        {
          "user": "Safety_Officer",
          "text": "This is a safety concern if over-temp alarms aren't firing. Are those affected too?"
        },
        {
          "user": "Field_Ops",
          "text": "Not sure yet. The alarm thresholds haven't triggered on any of these units, but they're not near the limit anyway."
        },
        {
          "user": "Backend_Eng",
          "text": "Are we logging the raw sensor values anywhere? I want to compare what the device sends vs what the dashboard shows."
        },
        {
          "user": "Field_Ops",
          "text": "Logs just show the same numbers as the dashboard. So the discrepancy is between device and probe, not app and backend."
        }
      ],
      "buggy_source": "// Enterprise Component: ApexHealth | Ticket: TICKET-8101 | Trace: INC-619\nfunction isOverTemp(readingCelsius, limitFahrenheit) {\n            // BUG: the sensor reports Celsius but the configured alarm limit is\n            // Fahrenheit. Comparing them directly means the alarm only fires\n            // far past the real threshold.\n            return readingCelsius > limitFahrenheit;\n        }\n        module.exports = { isOverTemp };\n",
      "test_source": "// Test shim\nif (typeof describe === 'undefined') {\n    global.describe = function (name, fn) { fn(); };\n    global.it = function (name, fn) { fn(); };\n}\n// Automated Test Suite for ApexHealth (TICKET-8101)\nconst assert = require('assert');\n        const { isOverTemp } = require('../src/handler');\n        describe('THERMAL_UNIT_MISMATCH', function() {\n            const LIMIT_F = 122;\n            it('should raise the alarm for a Celsius reading above the limit', function() {\n                assert.strictEqual(isOverTemp(55, LIMIT_F), true);\n            });\n            it('should stay silent for a reading well below the limit', function() {\n                assert.strictEqual(isOverTemp(30, LIMIT_F), false);\n            });\n        });\n",
      "gold_patch": "diff --git a/src/handler.js b/src/handler.js\n--- a/src/handler.js\n+++ b/src/handler.js\n@@ -1,8 +1,7 @@\n // Enterprise Component: ApexHealth | Ticket: TICKET-8101 | Trace: INC-619\n function isOverTemp(readingCelsius, limitFahrenheit) {\n-            // BUG: the sensor reports Celsius but the configured alarm limit is\n-            // Fahrenheit. Comparing them directly means the alarm only fires\n-            // far past the real threshold.\n-            return readingCelsius > limitFahrenheit;\n+            // FIX: convert the reading to the limit's unit before comparing.\n+            const readingFahrenheit = (readingCelsius * 9 / 5) + 32;\n+            return readingFahrenheit > limitFahrenheit;\n         }\n         module.exports = { isOverTemp };\n",
      "fixed_source": "// Enterprise Component: ApexHealth | Ticket: TICKET-8101 | Trace: INC-619\nfunction isOverTemp(readingCelsius, limitFahrenheit) {\n            // FIX: convert the reading to the limit's unit before comparing.\n            const readingFahrenheit = (readingCelsius * 9 / 5) + 32;\n            return readingFahrenheit > limitFahrenheit;\n        }\n        module.exports = { isOverTemp };\n"
    },
    {
      "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
      "world_id": "WORLD-D94CC98C",
      "domain": "edtech",
      "taxonomy": "PASS_MARK_BOUNDARY_EXCLUSION",
      "cwe": "CWE-697",
      "split": "val",
      "split_family": "PASS_MARK_BOUNDARY_EXCLUSION_VAL",
      "defect_file": "src/handler.js",
      "defect_function": "handler",
      "test_command": "node --test tests/bug.test.js",
      "fail_before_runs": 3,
      "pass_after_runs": 3,
      "solvable": true,
      "mechanism": "gradeSubmission() compares the score with strict greater-than against the pass mark, so a student scoring exactly the published threshold is graded as a fail. Every cohort loses the boundary band, and the error is invisible in aggregate pass-rate reporting. Fixed by using an inclusive comparison.",
      "incident_channel": "#inc-edtech",
      "incident_messages": 12,
      "incident_thread": [
        {
          "user": "Registrar",
          "text": "Just had a student come to me \u2014 transcript says Fail, but they scored exactly the pass mark. Is this just one case?"
        },
        {
          "user": "Support_Lead",
          "text": "No, we've had at least five tickets just this morning. Same story: 'I passed, my transcript says failed.'"
        },
        {
          "user": "Product_Owner",
          "text": "How widespread? Is it one course or all?"
        },
        {
          "user": "Registrar",
          "text": "I checked the last two cohorts. Every student at the pass mark shows Fail on their transcript."
        },
        {
          "user": "Support_Lead",
          "text": "So a 70 shows as fail and a 71 shows as pass? That's what one student told me."
        },
        {
          "user": "Registrar",
          "text": "Yes. The gradebook has the correct result, but the transcript disagrees. Consistently."
        },
        {
          "user": "Product_Owner",
          "text": "OK, that's a serious issue. These students can't apply to jobs or further study with a fail on their record."
        },
        {
          "user": "Support_Lead",
          "text": "We're running manual transcript reviews for anyone who appeals. But we don't know who else is affected unless they notice."
        },
        {
          "user": "Backend_Eng",
          "text": "Can you send me the course details and some student IDs? I'll investigate."
        },
        {
          "user": "Registrar",
          "text": "I've forwarded the list. The pattern is exact: score equals threshold, transcript says fail. No exceptions."
        },
        {
          "user": "Backend_Eng",
          "text": "I've been looking at the transcript generation service. The pass mark in the database looks correct for these courses. My first guess is that the transcript is pulling grades from a different table, so I'm tracing the data flow."
        },
        {
          "user": "Product_Owner",
          "text": "Please keep us posted. We need to decide whether to send a campus-wide email or handle these quietly with appeals."
        }
      ],
      "buggy_source": "// Enterprise Component: SysShield | Ticket: TICKET-5109 | Trace: INC-137\nfunction gradeSubmission(score, passMark) {\n            // BUG: strict greater-than excludes the boundary, so a student who\n            // scores exactly the pass mark is recorded as a fail.\n            if (score > passMark) {\n                return { passed: true, band: 'pass' };\n            }\n            return { passed: false, band: 'fail' };\n        }\n        module.exports = { gradeSubmission };\n",
      "test_source": "// Test shim\nif (typeof describe === 'undefined') {\n    global.describe = function (name, fn) { fn(); };\n    global.it = function (name, fn) { fn(); };\n}\n// Automated Test Suite for SysShield (TICKET-5109)\nconst assert = require('assert');\n        const { gradeSubmission } = require('../src/handler');\n        describe('PASS_MARK_BOUNDARY_EXCLUSION', function() {\n            const PASS_MARK = 50;\n            it('should pass a submission scoring exactly the pass mark', function() {\n                const r = gradeSubmission(PASS_MARK, PASS_MARK);\n                assert.strictEqual(r.passed, true);\n            });\n            it('should fail a submission one point below the pass mark', function() {\n                const r = gradeSubmission(PASS_MARK - 1, PASS_MARK);\n                assert.strictEqual(r.passed, false);\n            });\n            it('should pass a submission above the pass mark', function() {\n                const r = gradeSubmission(PASS_MARK + 10, PASS_MARK);\n                assert.strictEqual(r.passed, true);\n            });\n        });\n",
      "gold_patch": "diff --git a/src/handler.js b/src/handler.js\n--- a/src/handler.js\n+++ b/src/handler.js\n@@ -1,8 +1,7 @@\n // Enterprise Component: SysShield | Ticket: TICKET-5109 | Trace: INC-137\n function gradeSubmission(score, passMark) {\n-            // BUG: strict greater-than excludes the boundary, so a student who\n-            // scores exactly the pass mark is recorded as a fail.\n-            if (score > passMark) {\n+            // FIX: the pass mark itself is a passing score.\n+            if (score >= passMark) {\n                 return { passed: true, band: 'pass' };\n             }\n             return { passed: false, band: 'fail' };\n",
      "fixed_source": "// Enterprise Component: SysShield | Ticket: TICKET-5109 | Trace: INC-137\nfunction gradeSubmission(score, passMark) {\n            // FIX: the pass mark itself is a passing score.\n            if (score >= passMark) {\n                return { passed: true, band: 'pass' };\n            }\n            return { passed: false, band: 'fail' };\n        }\n        module.exports = { gradeSubmission };\n"
    },
    {
      "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
      "world_id": "WORLD-F7095CF5",
      "domain": "fintech",
      "taxonomy": "PAYMENT_AMOUNT_OVERFLOW",
      "cwe": "CWE-190",
      "split": "train",
      "split_family": "PAYMENT_AMOUNT_OVERFLOW_TRAIN",
      "defect_file": "src/handler.js",
      "defect_function": "handler",
      "test_command": "node --test tests/bug.test.js",
      "fail_before_runs": 3,
      "pass_after_runs": 3,
      "solvable": true,
      "mechanism": "calculateTotal() uses Number multiplication (dispatch service), which overflows for values above Number.MAX_SAFE_INTEGER (9,007,199,254,740,991). When processing large USD amounts, the product silently loses precision. Fixed by using BigInt arithmetic.",
      "incident_channel": "#inc-fintech",
      "incident_messages": 16,
      "incident_thread": [
        {
          "user": "Ops_Analyst",
          "text": "Daily settlement total is off from ledger again. Only for a handful of large payments, but the amounts don't match what we expect."
        },
        {
          "user": "Risk_Lead",
          "text": "Which payments? Are these the ones above the normal threshold?"
        },
        {
          "user": "Ops_Analyst",
          "text": "Yes, all high-value. The ledger shows the correct gross, but the settlement total we're sending to the bank is slightly different."
        },
        {
          "user": "SRE_OnCall",
          "text": "Is this blocking the payout run? Need to know if we should hold."
        },
        {
          "user": "Ops_Analyst",
          "text": "We paused the run until we confirm. Bank hasn't received the file yet."
        },
        {
          "user": "Risk_Lead",
          "text": "We need to quantify exposure. How many transactions, and total delta?"
        },
        {
          "user": "Ops_Analyst",
          "text": "Six payments. Combined delta is under a hundred dollars, but each one is off in a different direction."
        },
        {
          "user": "Risk_Lead",
          "text": "Different directions? That's odd. Usually if it's a cutoff issue it's consistently one way."
        },
        {
          "user": "SRE_OnCall",
          "text": "Is there a pattern with currencies? Mixing FX rates could cause small variances."
        },
        {
          "user": "Ops_Analyst",
          "text": "All USD. And it's not a timing thing \u2014 the ledger entries are posted, and the settlement total just doesn't add up."
        },
        {
          "user": "Backend_Eng",
          "text": "Just saw the alert. Recap? What are we comparing against?"
        },
        {
          "user": "Ops_Analyst",
          "text": "Settlement total from our dispatch service vs ledger postings. Only large USD payments are off."
        },
        {
          "user": "Risk_Lead",
          "text": "We ruled out FX and timing because all same currency and ledger is final."
        },
        {
          "user": "Backend_Eng",
          "text": "I'm going to pull the actual inputs for those six payments and run the same math locally to see where it diverges."
        },
        {
          "user": "SRE_OnCall",
          "text": "Back in 10. Taking the payout file generation down meanwhile."
        },
        {
          "user": "Backend_Eng",
          "text": "Reproduced. If I take the payment amount and quantity from the dispatch payload and compute the total the way the service does, I get the wrong result. The ledger uses a different method and is right."
        }
      ],
      "buggy_source": "// Enterprise Component: PrimeStore | Ticket: TICKET-5155 | Trace: INC-131\nfunction calculateTotal(unitPrice, quantity) {\n    // BUG: Number multiplication can overflow for large money values\n    // Example: 9999999999 * 9999999999 overflows Number.MAX_SAFE_INTEGER\n    return unitPrice * quantity;\n}\nmodule.exports = { calculateTotal };\n",
      "test_source": "// Test shim\nif (typeof describe === 'undefined') {\n    global.describe = function (name, fn) { fn(); };\n    global.it = function (name, fn) { fn(); };\n}\n// Automated Test Suite for PrimeStore (TICKET-5155)\nconst assert = require('assert');\nconst { calculateTotal } = require('../src/handler');\n\ndescribe('PAYMENT_AMOUNT_OVERFLOW Fix Test', function() {\n    it('should handle large payment amounts without overflow', function() {\n        const result = calculateTotal(9999999999, 9999999999);\n        // Number.MAX_SAFE_INTEGER = 9007199254740991\n        // BigInt result = 99999999980000000001n \u2014 overflows with Number\n        const expected = BigInt(9999999999) * BigInt(9999999999);\n        assert.strictEqual(result, expected);\n    });\n\n    it('should handle normal amounts correctly', function() {\n        const result = calculateTotal(100, 5);\n        assert.strictEqual(result, 500n);\n    });\n});\n",
      "gold_patch": "diff --git a/src/handler.js b/src/handler.js\n--- a/src/handler.js\n+++ b/src/handler.js\n@@ -1,7 +1,7 @@\n // Enterprise Component: PrimeStore | Ticket: TICKET-5155 | Trace: INC-131\n function calculateTotal(unitPrice, quantity) {\n-    // BUG: Number multiplication can overflow for large money values\n-    // Example: 9999999999 * 9999999999 overflows Number.MAX_SAFE_INTEGER\n-    return unitPrice * quantity;\n+    // FIX: Use BigInt for large money calculations to prevent overflow\n+    const total = BigInt(unitPrice) * BigInt(quantity);\n+    return total;\n }\n module.exports = { calculateTotal };\n",
      "fixed_source": "// Enterprise Component: PrimeStore | Ticket: TICKET-5155 | Trace: INC-131\nfunction calculateTotal(unitPrice, quantity) {\n    // FIX: Use BigInt for large money calculations to prevent overflow\n    const total = BigInt(unitPrice) * BigInt(quantity);\n    return total;\n}\nmodule.exports = { calculateTotal };\n"
    },
    {
      "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
      "world_id": "WORLD-F867DE27",
      "domain": "devops",
      "taxonomy": "CERT_EXPIRY_SILENT",
      "cwe": "CWE-703",
      "split": "train",
      "split_family": "CERT_EXPIRY_SILENT_TRAIN",
      "defect_file": "src/handler.js",
      "defect_function": "handler",
      "test_command": "node --test tests/bug.test.js",
      "fail_before_runs": 3,
      "pass_after_runs": 3,
      "solvable": true,
      "mechanism": "checkCertExpiry() in ledger uses >= instead of >, so a certificate whose validity window ends exactly at the current instant is still reported valid and the expiry passes silently. Fixed by requiring validTo strictly greater than now.",
      "incident_channel": "#inc-devops",
      "incident_messages": 14,
      "incident_thread": [
        {
          "user": "SRE_OnCall",
          "text": "Missed page on the payment-settlement service last night. It was supposed to stop serving at 02:00 and page us. It didn't. We killed it at 02:45."
        },
        {
          "user": "Eng_Manager",
          "text": "Did customers see any issues during that time?"
        },
        {
          "user": "SRE_OnCall",
          "text": "No. Requests kept succeeding the whole time. That's actually the annoying part \u2014 nothing looked wrong externally."
        },
        {
          "user": "Platform_Eng",
          "text": "So the system kept working after it was supposed to be out of service. What does the runbook say about 02:00?"
        },
        {
          "user": "SRE_OnCall",
          "text": "Runbook says at 02:00 it should raise a critical alert, stop taking traffic, and page the on-call. None of that happened."
        },
        {
          "user": "Security_Eng",
          "text": "We need to know what was served in that window. If it served after allowed hours, we might have to disclose."
        },
        {
          "user": "SRE_OnCall",
          "text": "All the logs show normal traffic. No errors, no rejects. It just refused to acknowledge that the window had closed."
        },
        {
          "user": "Eng_Manager",
          "text": "So the only problem is that the automated alert didn't fire. The service itself was fine."
        },
        {
          "user": "SRE_OnCall",
          "text": "Right. And the status page kept saying 'all systems operational' until we manually updated it at 02:45."
        },
        {
          "user": "Platform_Eng",
          "text": "I'm going to look into why the page never went out. Back in 10."
        },
        {
          "user": "Platform_Eng",
          "text": "Found something. The alert definition is correct: it's supposed to trigger at 02:00. The evaluation log shows it ran at exactly 02:00:00 and the result was 'valid'."
        },
        {
          "user": "SRE_OnCall",
          "text": "How can it be valid at 02:00:00? The window was supposed to be over."
        },
        {
          "user": "Security_Eng",
          "text": "Could the evaluation be using a different timezone? If the rule runs in UTC but the window end was local, that would shift the result."
        },
        {
          "user": "Platform_Eng",
          "text": "No, that was my first guess too. The timestamps all line up. The window end is 02:00:00 UTC and the evaluation ran at 02:00:00 UTC."
        }
      ],
      "buggy_source": "// Enterprise Component: InfraVault | Ticket: TICKET-7677 | Trace: INC-784\nfunction checkCertExpiry(sslCert_84, now) {\n            const t = (typeof now === 'number') ? now : Date.now();\n            if (sslCert_84.validTo >= t)\n                return { valid: true, expiresIn: sslCert_84.validTo - t };\n            return { valid: false, reason: 'Certificate expired' };\n        }\n        module.exports = { checkCertExpiry };\n",
      "test_source": "// Test shim\nif (typeof describe === 'undefined') {\n    global.describe = function (name, fn) { fn(); };\n    global.it = function (name, fn) { fn(); };\n}\n// Automated Test Suite for InfraVault (TICKET-7677)\nconst assert = require('assert');\n        const { checkCertExpiry } = require('../src/handler');\n        describe('CERT_EXPIRY', function() {\n            // A fixed clock is injected so the boundary case is deterministic;\n            // reading Date.now() twice made this test race against itself.\n            const NOW = 1750000000000;\n            it('should reject sslCert_84 whose validity ends exactly now', function() {\n                const r = checkCertExpiry({ validTo: NOW }, NOW);\n                assert.strictEqual(r.valid, false);\n            });\n            it('should accept valid sslCert_84', function() {\n                const r = checkCertExpiry({ validTo: NOW + 86400000 }, NOW);\n                assert.strictEqual(r.valid, true);\n            });\n        });\n",
      "gold_patch": "diff --git a/src/handler.js b/src/handler.js\n--- a/src/handler.js\n+++ b/src/handler.js\n@@ -1,7 +1,7 @@\n // Enterprise Component: InfraVault | Ticket: TICKET-7677 | Trace: INC-784\n function checkCertExpiry(sslCert_84, now) {\n             const t = (typeof now === 'number') ? now : Date.now();\n-            if (sslCert_84.validTo >= t)\n+            if (sslCert_84.validTo > t)\n                 return { valid: true, expiresIn: sslCert_84.validTo - t };\n             return { valid: false, reason: 'Certificate expired' };\n         }\n",
      "fixed_source": "// Enterprise Component: InfraVault | Ticket: TICKET-7677 | Trace: INC-784\nfunction checkCertExpiry(sslCert_84, now) {\n            const t = (typeof now === 'number') ? now : Date.now();\n            if (sslCert_84.validTo > t)\n                return { valid: true, expiresIn: sslCert_84.validTo - t };\n            return { valid: false, reason: 'Certificate expired' };\n        }\n        module.exports = { checkCertExpiry };\n"
    },
    {
      "dataset_canary": "e52fc5be-d91b-4b52-b410-287271e9c420",
      "world_id": "WORLD_HC_0475",
      "domain": "healthcare",
      "taxonomy": "AMBULANCE_GPS_STALE_DATA",
      "cwe": "CWE-668",
      "split": "test",
      "split_family": "",
      "defect_file": "src/serviceHandler.js",
      "defect_function": "",
      "test_command": "node tests/bug.test.js",
      "fail_before_runs": 3,
      "pass_after_runs": 3,
      "solvable": true,
      "mechanism": "Dispatch position lookup falls back to an arbitrary cached fix from the shared telemetry map when the requested ambulance unit has no recent GPS report, returning another vehicle's coordinates to the wrong dispatch sphere and omitting any staleness evaluation against the maximum fix age window.",
      "incident_channel": "#inc-healthcare",
      "incident_messages": 15,
      "incident_thread": [
        {
          "user": "Dispatch_Coord",
          "text": "Weird. Unit 7 is showing at 5th and Oak on my screen, but the crew just radioed they cleared that call 20 minutes ago and are en route to St. Mary's."
        },
        {
          "user": "Charge_Nurse",
          "text": "That's a big discrepancy. We're expecting a STEMI patient."
        },
        {
          "user": "Clinical_Safety",
          "text": "If dispatch loses track of the rig, we can't prep the cath lab properly. Was the radio transmission clear?"
        },
        {
          "user": "Dispatch_Coord",
          "text": "Crystal clear. They said 'left scene, heading to your ER, ETA 15.' That was 20 minutes ago."
        },
        {
          "user": "Charge_Nurse",
          "text": "So where does the system think they are? Still at the scene?"
        },
        {
          "user": "Dispatch_Coord",
          "text": "Yes, shows them exactly at the scene location. Not moving."
        },
        {
          "user": "Clinical_Safety",
          "text": "Could the crew have forgotten to mark themselves en route on the console?"
        },
        {
          "user": "Dispatch_Coord",
          "text": "I asked \u2013 they did press 'En Route' when they left. The CAD shows the status as en route, but the map dot is still at the old spot."
        },
        {
          "user": "Charge_Nurse",
          "text": "We need a workaround. Can you give me a manual ETA based on the crew's call?"
        },
        {
          "user": "Dispatch_Coord",
          "text": "Yes, I'll use the radio ETA and flag the map position as stale. Meanwhile, can someone look into why the map didn't update?"
        },
        {
          "user": "Backend_Eng",
          "text": "Just joined \u2013 saw the thread. What are we seeing exactly? The unit status says en route but the map position stays at the previous scene?"
        },
        {
          "user": "Dispatch_Coord",
          "text": "Correct. And the dot hasn't moved for at least 20 minutes, but crew says they're on the highway."
        },
        {
          "user": "Backend_Eng",
          "text": "Could be a GPS blackout zone, but the highway is pretty open. Let me pull the raw telemetry for that unit."
        },
        {
          "user": "Charge_Nurse",
          "text": "While you do that, we're using the radio ETA. But this is the second time this month. We need a fix."
        },
        {
          "user": "Backend_Eng",
          "text": "I pulled the telemetry stream. That unit is reporting GPS every 10 seconds, no gaps. So the vehicle data is fine."
        }
      ],
      "buggy_source": "// svc-ambulance-gps-stale-data \u2014 clinical service module\n// build world_sample\n\nconst _positionCache = {};\n\nfunction reportPosition(unitId, lat, lon, timestampMs) {\n    _positionCache[unitId] = { lat, lon, timestampMs };\n    return true;\n}\n\nfunction getDispatchPosition(unitId, nowMs) {\n    const hit = _positionCache[unitId];\n    if (hit) return { unitId, lat: hit.lat, lon: hit.lon, stale: false };\n    const anyKey = Object.keys(_positionCache)[0];\n    if (anyKey) {\n        const other = _positionCache[anyKey];\n        return { unitId, lat: other.lat, lon: other.lon, stale: false };\n    }\n    return null;\n}\n\nmodule.exports = { reportPosition, getDispatchPosition, MAX_FIX_AGE_MS: 90000 };",
      "test_source": "const assert = require('assert');\n\nconst { reportPosition, getDispatchPosition } = require('../src/serviceHandler');\n\nreportPosition('MEDIC-345', 40.6782, -73.9442, 1000);\n\n// A unit with no fix of its own must never receive another unit's coordinates.\nconst foreign = getDispatchPosition('MEDIC-978', 1200);\nassert.strictEqual(foreign, null,\n    'unit with no GPS fix received another ambulance position (CWE-668)');\n\n// A fix older than the max age must be reported stale, not as live position.\nreportPosition('MEDIC-978', 40.7002, -73.9200, 1000);\nconst stale = getDispatchPosition('MEDIC-978', 1000 + 90000 + 1);\nassert.strictEqual(stale.stale, true, 'expired GPS fix reported as live');\nassert.strictEqual(stale.lat, null, 'stale fix still exposed coordinates');\n\nconst fresh = getDispatchPosition('MEDIC-345', 1100);\nassert.strictEqual(fresh.stale, false);\nassert.strictEqual(fresh.lat, 40.6782);\nconsole.log('ok ambulance dispatch position scoping');\n\nconst _mod = require('../src/serviceHandler');\nassert(typeof _mod === 'object' && Object.keys(_mod).length > 0,\n    'service module exported nothing');\n",
      "gold_patch": "diff --git a/src/serviceHandler.js b/src/serviceHandler.js\nindex 9a6f1c8..e89d6b9 100644\n--- a/src/serviceHandler.js\n+++ b/src/serviceHandler.js\n@@ -1,7 +1,8 @@\n-// svc-ambulance-gps-stale-data \u2014 clinical service module\n-// build world_sample\n+// svc-ambulance-gps-stale-data \u2014 AMBULANCE_GPS_STALE_DATA (CWE-668: Exposure of Resource to Wrong Sphere in Dispatch Tracking)\n+// world=world_sample\n \n const _positionCache = {};\n+const MAX_FIX_AGE_MS = 90000;\n \n function reportPosition(unitId, lat, lon, timestampMs) {\n     _positionCache[unitId] = { lat, lon, timestampMs };\n@@ -10,13 +11,11 @@ function reportPosition(unitId, lat, lon, timestampMs) {\n \n function getDispatchPosition(unitId, nowMs) {\n     const hit = _positionCache[unitId];\n-    if (hit) return { unitId, lat: hit.lat, lon: hit.lon, stale: false };\n-    const anyKey = Object.keys(_positionCache)[0];\n-    if (anyKey) {\n-        const other = _positionCache[anyKey];\n-        return { unitId, lat: other.lat, lon: other.lon, stale: false };\n+    if (!hit) return null;\n+    if (nowMs - hit.timestampMs > MAX_FIX_AGE_MS) {\n+        return { unitId, lat: null, lon: null, stale: true };\n     }\n-    return null;\n+    return { unitId, lat: hit.lat, lon: hit.lon, stale: false };\n }\n \n-module.exports = { reportPosition, getDispatchPosition, MAX_FIX_AGE_MS: 90000 };\n\\ No newline at end of file\n+module.exports = { reportPosition, getDispatchPosition, MAX_FIX_AGE_MS };\n",
      "fixed_source": "// svc-ambulance-gps-stale-data \u2014 AMBULANCE_GPS_STALE_DATA (CWE-668: Exposure of Resource to Wrong Sphere in Dispatch Tracking)\n// world=world_sample\n\nconst _positionCache = {};\nconst MAX_FIX_AGE_MS = 90000;\n\nfunction reportPosition(unitId, lat, lon, timestampMs) {\n    _positionCache[unitId] = { lat, lon, timestampMs };\n    return true;\n}\n\nfunction getDispatchPosition(unitId, nowMs) {\n    const hit = _positionCache[unitId];\n    if (!hit) return null;\n    if (nowMs - hit.timestampMs > MAX_FIX_AGE_MS) {\n        return { unitId, lat: null, lon: null, stale: true };\n    }\n    return { unitId, lat: hit.lat, lon: hit.lon, stale: false };\n}\n\nmodule.exports = { reportPosition, getDispatchPosition, MAX_FIX_AGE_MS };\n"
    }
  ]
}
