ronantakizawa/codereview-bench huggingface dataset:
Repository: louislam/uptime-kuma
File: test/backend-test/notification-providers/test-ntlm.js (JavaScript)

Code before:
const { describe, test } = require("node:test");
const assert = require("node:assert");

const hash = require("../../server/modules/axios-ntlm/lib/hash");

describe("createPseudoRandomValue()", () => {
    test("returns a hexadecimal string with the requested length", () => {
        for (const length of [ 0, 8, 16, 32, 64 ]) {
            const result = hash.createPseudoRandomValue(length);
            assert.strictEqual(typeof result, "string");
            assert.strictEqual(result.length, length);
            assert.ok(/^[0-9a-f]*$/.test(result));
        }
    });

    test("returns unique values across multiple calls with the same length", () => {
        const length = 16;
        const iterations = 10;
        const results = new Set();

        for (let i = 0; i < iterations; i++) {
            results.add(hash.createPseudoRandomValue(length));
        }

        assert.strictEqual(results.size, iterations);
    });
});


Review comment (suggestion):
```suggestion
const hash = require("../../../server/modules/axios-ntlm/lib/hash");
```

Code after:
const { describe, test } = require("node:test");
const assert = require("node:assert");

const hash = require("../../../server/modules/axios-ntlm/lib/hash");

describe("createPseudoRandomValue()", () => {
    test("returns a hexadecimal string with the requested length", () => {
        for (const length of [ 0, 8, 16, 32, 64 ]) {
            const result = hash.createPseudoRandomValue(length);
            assert.strictEqual(typeof result, "string");
            assert.strictEqual(result.length, length);
            assert.ok(/^[0-9a-f]*$/.test(result));
        }
    });

    test("returns unique values across multiple calls with the same length", () => {
        const length = 16;
        const iterations = 10;
        const results = new Set();

        for (let i = 0; i < iterations; i++) {
            results.add(hash.createPseudoRandomValue(length));
        }

        assert.strictEqual(results.size, iterations);
    });
});
Repository: louislam/uptime-kuma
File: server/notification-providers/HaloPSA.js (JavaScript)

Code before:
                timestamp: new Date().toISOString(),
                uptime_kuma_version: process.env.npm_package_version || "unknown"
            };

            // Send POST request to Halo PSA webhook
            const result = await axios.post(
                notification.halowebhookurl,
                payload,
                {
                    timeout: 10000,
                    headers: {
                        "Content-Type": "application/json",
                        "User-Agent": "Uptime-Kuma/HaloPSA"
                    }
                }
            );

            // Check for successful HTTP response
            if (result.status === 200 || result.status === 201 || result.status === 204) {
                return okMsg;
            }

            // Handle unexpected status codes
            this.throwGeneralAxiosError(result);
        } catch (error) {
            // Wrap all axios errors properly as required by CONTRIBUTING.md
            this.throwGeneralAxiosError(error);
        }
    }
}

module.exports = HaloPSA;


Review comment (suggestion):
There are a number of comments here that can be scrubbed without loosing details/ conext /...
-> Plese do one light scrubbing pass on this

```suggestion
```

Code after:
                timestamp: new Date().toISOString(),
                uptime_kuma_version: process.env.npm_package_version || "unknown"
            };

            // Send POST request to Halo PSA webhook
            let config = {
                headers: {
                    "Content-Type": "application/json",
                }
            };

            if (notification.haloUsername && notification.haloPassword) {
                const data = notification.haloUsername + ":" + notification.haloPassword;
                const base64data = Buffer.from(data).toString("base64");

                config.headers.Authorization = `Basic ${base64data}`;
            }

            config = this.getAxiosConfigWithProxy(config);

            const result = await axios.post(
                notification.halowebhookurl,
                payload,
                config
            );

            // Check for successful HTTP response
            if (result.status === 200 || result.status === 201 || result.status === 204) {
                return okMsg;
            }

            throw new Error(`Received unexpected status code ${result.status} from notification provider HaloPSA`);
        } catch (error) {
            this.throwGeneralAxiosError(error);
        }
    }
}

module.exports = HaloPSA;
Repository: louislam/uptime-kuma
File: src/components/notifications/HaloPSA.vue (Vue)

Code before:
<template>
    <div class="mb-3">
        <label for="halopsa-webhook-url" class="form-label">
            {{ $t("Halo PSA Webhook URL") }}
        </label>
        <HiddenInput
            v-model="$parent.notification.halowebhookurl"
            :maxlength="500"
            placeholder="https://your-instance.halopsa.com/api/v1/webhook"
        />
        <div class="form-text">
            {{ $t("halopsa_webhook_url_desc") }}
        </div>
    </div>

    <div class="mb-3">
        <div class="form-check">
            <input
                id="halopsa-apply-existing"
                v-model="$parent.notification.apply_existing"
                type="checkbox"
                class="form-check-input"
            />
            <label class="form-check-label" for="halopsa-apply-existing">
                {{ $t("Apply on all existing monitors") }}
            </label>
        </div>
    </div>
</template>

<script>
/**
 * Halo PSA Notification Provider Vue Component
 */
import HiddenInput from "../HiddenInput.vue";

export default {

Review comment (security):
Seems rather sus to only use an url, since this is not encrypted in HTTP POST..
-> not secure against MITM

Is there a secure mechanism for authentificating against them?
If there is not, we need to at least add a warning to not consider these notifiations as tamper proof.

Code after:
<template>
    <div class="mb-3">
        <label for="halopsa-webhook-url" class="form-label">
            {{ $t("Halo PSA Webhook URL") }}<span class="test-danger">*</span>
        </label>
        <HiddenInput
            v-model="$parent.notification.halowebhookurl"
            :maxlength="500"
            placeholder="https://your-instance.halopsa.com/api/v1/webhook"
            autocomplete="off"
            required
        />
        <div class="form-text">
            {{ $t("halopsa_webhook_url_desc") }}
        </div>
    </div>

    <div class="mb-3">
        <label for="halopsa-username" class="form-label">
            {{ $t("Username") }}
        </label>
        <input
            id="halopsa-username"
            v-model="$parent.notification.haloUsername"
            type="text"
            class="form-control"
            autocomplete="off"
            :placeholder="$t('Username')"
        />
        <div class="form-text">
            {{ $t("halopsa_username_desc") }}
        </div>
    </div>

    <div class="mb-3">
        <label for="halopsa-password" class="form-label">
            {{ $t("Password") }}
Repository: louislam/uptime-kuma
File: server/notification-providers/HaloPSA.js (JavaScript)

Code before:
                monitor: monitorJSON?.name || "Unknown Monitor",
                message: msg,
                timestamp: new Date().toISOString(),
                uptime_kuma_version: process.env.npm_package_version || "unknown"
            };

            // Send POST request to Halo PSA webhook
            const result = await axios.post(
                notification.halowebhookurl,
                payload,
                {
                    timeout: 10000,
                    headers: {
                        "Content-Type": "application/json",
                        "User-Agent": "Uptime-Kuma/HaloPSA"
                    }
                }
            );

            // Check for successful HTTP response
            if (result.status === 200 || result.status === 201 || result.status === 204) {
                return okMsg;
            }

            // Handle unexpected status codes
            this.throwGeneralAxiosError(result);
        } catch (error) {
            // Wrap all axios errors properly as required by CONTRIBUTING.md
            this.throwGeneralAxiosError(error);
        }
    }
}

module.exports = HaloPSA;


Review comment (suggestion):
I think we want something like this instead

```suggestion
            throw new Error(`Recived unexpected status code ${result.status} from notification provider HaloPSA`);
```

Code after:
                monitor: monitorJSON?.name || "No Monitor",
                message: msg,
                timestamp: new Date().toISOString(),
                uptime_kuma_version: process.env.npm_package_version || "unknown"
            };

            // Send POST request to Halo PSA webhook
            let config = {
                headers: {
                    "Content-Type": "application/json",
                }
            };

            if (notification.haloUsername && notification.haloPassword) {
                const data = notification.haloUsername + ":" + notification.haloPassword;
                const base64data = Buffer.from(data).toString("base64");

                config.headers.Authorization = `Basic ${base64data}`;
            }

            config = this.getAxiosConfigWithProxy(config);

            const result = await axios.post(
                notification.halowebhookurl,
                payload,
                config
            );

            // Check for successful HTTP response
            if (result.status === 200 || result.status === 201 || result.status === 204) {
                return okMsg;
            }

            throw new Error(`Received unexpected status code ${result.status} from notification provider HaloPSA`);
        } catch (error) {
            this.throwGeneralAxiosError(error);
        }
    }
}

module.exports = HaloPSA;
Repository: louislam/uptime-kuma
File: src/components/notifications/HaloPSA.vue (Vue)

Code before:
<template>
    <div class="mb-3">
        <label for="halopsa-webhook-url" class="form-label">
            {{ $t("Halo PSA Webhook URL") }}
        </label>
        <HiddenInput
            v-model="$parent.notification.halowebhookurl"
            :maxlength="500"
            placeholder="https://your-instance.halopsa.com/api/v1/webhook"
        />
        <div class="form-text">
            {{ $t("halopsa_webhook_url_desc") }}
        </div>
    </div>

    <div class="mb-3">
        <label for="halopsa-auth-header" class="form-label">
            {{ $t("Authentication Header") }} ({{ $t("Optional") }})
        </label>
        <input
            id="halopsa-auth-header"
            v-model="$parent.notification.haloAuthHeader"
            type="text"
            class="form-control"
            placeholder="{'Authentication': 'Bearer your-token-here'}"
        />
        <div class="form-text">
            {{ $t("halopsa_auth_header_desc") }}
        </div>
    </div>
</template>

<script>
/**
 * Halo PSA Notification Provider Vue Component
 */
import HiddenInput from "../HiddenInput.vue";

export default {
    components: {
        HiddenInput,
    },
    mounted() {

Review comment (security):
please make this mandatory.
From my security POV, it is.

```suggestion
            {{ $t("Authentication Header") }}
```

Code after:
<template>
    <div class="mb-3">
        <label for="halopsa-webhook-url" class="form-label">
            {{ $t("Halo PSA Webhook URL") }}<span class="test-danger">*</span>
        </label>
        <HiddenInput
            v-model="$parent.notification.halowebhookurl"
            :maxlength="500"
            placeholder="https://your-instance.halopsa.com/api/v1/webhook"
            autocomplete="off"
            required
        />
        <div class="form-text">
            {{ $t("halopsa_webhook_url_desc") }}
        </div>
    </div>

    <div class="mb-3">
        <label for="halopsa-username" class="form-label">
            {{ $t("Username") }}
        </label>
        <input
            id="halopsa-username"
            v-model="$parent.notification.haloUsername"
            type="text"
            class="form-control"
            autocomplete="off"
            :placeholder="$t('Username')"
        />
        <div class="form-text">
            {{ $t("halopsa_username_desc") }}
        </div>
    </div>

    <div class="mb-3">
        <label for="halopsa-password" class="form-label">
            {{ $t("Password") }}
        </label>
        <input
            id="halopsa-password"
            v-model="$parent.notification.haloPassword"
            type="text"
            class="form-control"
Repository: louislam/uptime-kuma
File: db/knex_migrations/2026-01-05-0000-add-rss-title.js (JavaScript)

Code before:
exports.up = async function (knex) {
    // Check if column already exists (created by knex_init_db.js for fresh installs)
    const hasColumn = await knex.schema.hasColumn("status_page", "rss_title");
    if (!hasColumn) {
        await knex.schema.alterTable("status_page", function (table) {
            table.string("rss_title", 255);
        });
    }
};

exports.down = function (knex) {
    return knex.schema.alterTable("status_page", function (table) {
        table.dropColumn("rss_title");
    });
};


Review comment (suggestion):
```suggestion
    await knex.schema.alterTable("status_page", function (table) {
        table.string("rss_title", 255);
    });
```

Code after:
exports.up = async function (knex) {
    await knex.schema.alterTable("status_page", function (table) {
        table.string("rss_title", 255);
    });
};

exports.down = function (knex) {
    return knex.schema.alterTable("status_page", function (table) {
        table.dropColumn("rss_title");
    });
};
Repository: louislam/uptime-kuma
File: test/backend-test/notification-providers/test-notification-provider.js (JavaScript)

Code before:
                assert.ok(!thrown.message.startsWith("AggregateError"));
                assert.ok(thrown.message.includes("caused by:"));
                assert.ok(thrown.message.includes("127.0.0.1:443"));
                assert.ok(thrown.message.includes("::1:443"));
                assert.ok(thrown.message.includes("code=ECONNREFUSED"));
                return true;
            }
        );
    });

    test("expands AggregateError wrapped in error.cause", () => {
        let innerErr = new Error("connect ETIMEDOUT 10.0.0.1:443");
        innerErr.code = "ETIMEDOUT";

        let aggErr = new AggregateError([innerErr], "AggregateError");
        let outerErr = new Error("Request failed");
        outerErr.cause = aggErr;

        assert.throws(
            () => provider.throwGeneralAxiosError(outerErr),
            (thrown) => {
                assert.ok(thrown.message.includes("caused by:"));
                assert.ok(thrown.message.includes("ETIMEDOUT"));
                assert.ok(thrown.message.includes("10.0.0.1:443"));
                return true;
            }
        );
    });
});


Review comment (suggestion):
```suggestion
            {
                message: "caused by:... <- include this"
            }
```

Code after:
const { describe, test } = require("node:test");
const assert = require("node:assert");

const NotificationProvider = require("../../../server/notification-providers/notification-provider");

describe("NotificationProvider.throwGeneralAxiosError()", () => {
    const provider = new NotificationProvider();

    test("expands AggregateError causes", () => {
        let err1 = new Error("connect ECONNREFUSED 127.0.0.1:443");
        err1.code = "ECONNREFUSED";
        let err2 = new Error("connect ECONNREFUSED ::1:443");
        err2.code = "ECONNREFUSED";

        let aggErr = new AggregateError([err1, err2], "AggregateError");

        assert.throws(() => provider.throwGeneralAxiosError(aggErr), {
            message: /^AggregateError - caused by: .+/,
        });
    });

    test("expands AggregateError wrapped in error.cause", () => {
        let innerErr = new Error("connect ETIMEDOUT 10.0.0.1:443");
        innerErr.code = "ETIMEDOUT";

        let aggErr = new AggregateError([innerErr], "AggregateError");
        let outerErr = new Error("Request failed");
        outerErr.cause = aggErr;

        assert.throws(() => provider.throwGeneralAxiosError(outerErr), {
            message: /^Request failed - caused by: .+/,
        });
    });
});
Repository: louislam/uptime-kuma
File: src/components/MonitorList.vue (Vue)

Code before:
    border-radius: 10px 10px 0 0;
    margin: -10px;
    margin-bottom: 10px;
    padding: 10px;

    .dark & {
        background-color: $dark-header-bg;
        border-bottom: 0;
    }
}

.search-row {
    display: flex;
    padding: 10px;
    padding-bottom: 5px;
}

.header-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 10px;

    @media (max-width: 550px) {
        flex-wrap: wrap;
    }
}

.select-checkbox-wrapper {
    display: flex;
    align-items: center;

    .form-check-input {
        cursor: pointer;
        margin: 0;
    }
}

.header-filter {
    display: flex;
    align-items: center;
}

.actions-wrapper {
    display: flex;
    align-items: center;

    .dropdown-toggle {
        white-space: nowrap;


Review comment (suggestion):
I don't know if you want to invest more time, but as a general preference, adding the boostrap eqivalents of this code would be much more maintainable.

If you don't want to make this change, that is fine too.

Code after:

.shadow-box {
    height: calc(100vh - 150px);
    position: sticky;
    top: 10px;
}

.small-padding {
    padding-left: 5px !important;
    padding-right: 5px !important;
}

.list-header {
    border-bottom: 1px solid #dee2e6;
    border-radius: 10px 10px 0 0;
    margin: -10px;
    margin-bottom: 10px;
    padding: 10px;

    .dark & {
        background-color: $dark-header-bg;
        border-bottom: 0;
    }
}

.search-row {
    display: flex;
    padding: 10px;
    padding-bottom: 5px;
}

.header-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 10px;

    @media (max-width: 549px), (min-width: 770px) and (max-width: 1149px), (min-width: 1200px) and (max-width: 1499px) {
        flex-wrap: wrap;
    }
}

.select-checkbox-wrapper {
    display: flex;
    align-items: center;

    .form-check-input {
        cursor: pointer;
        margin: 0;
    }
Repository: louislam/uptime-kuma
File: src/components/MonitorList.vue (Vue)

Code before:
    border-bottom: 1px solid #dee2e6;
    border-radius: 10px 10px 0 0;
    margin: -10px;
    margin-bottom: 10px;
    padding: 10px;

    .dark & {
        background-color: $dark-header-bg;
        border-bottom: 0;
    }
}

.search-row {
    display: flex;
    padding: 10px;
    padding-bottom: 5px;
}

.header-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 10px;

    @media (max-width: 550px) {
        flex-wrap: wrap;
    }
}

.select-checkbox-wrapper {
    display: flex;
    align-items: center;

    .form-check-input {
        cursor: pointer;
        margin: 0;
    }
}

.header-filter {
    display: flex;
    align-items: center;
}

.actions-wrapper {
    display: flex;
    align-items: center;

    .dropdown-toggle {
        white-space: nowrap;

Review comment (suggestion):
due to how our UI does responsivitiy, I think the flat 550 you used here is a bit too flat after checking it out

I think this works in these fairly specific ranges only, so adusting the added media queries as such should do the trick
- 550..769
- 1150..1199
- 1500...

Code after:
@import "../assets/vars.scss";

.shadow-box {
    height: calc(100vh - 150px);
    position: sticky;
    top: 10px;
}

.small-padding {
    padding-left: 5px !important;
    padding-right: 5px !important;
}

.list-header {
    border-bottom: 1px solid #dee2e6;
    border-radius: 10px 10px 0 0;
    margin: -10px;
    margin-bottom: 10px;
    padding: 10px;

    .dark & {
        background-color: $dark-header-bg;
        border-bottom: 0;
    }
}

.search-row {
    display: flex;
    padding: 10px;
    padding-bottom: 5px;
}

.header-top {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 10px;

    @media (max-width: 549px), (min-width: 770px) and (max-width: 1149px), (min-width: 1200px) and (max-width: 1499px) {
        flex-wrap: wrap;
    }
}

.select-checkbox-wrapper {
    display: flex;
    align-items: center;

    .form-check-input {
        cursor: pointer;
        margin: 0;
Repository: louislam/uptime-kuma
File: src/components/MonitorList.vue (Vue)

Code before:
    padding-right: 30px;

    @media (min-width: 550px) and (max-width: 769px), (min-width: 1150px) and (max-width: 1199px), (min-width: 1500px) {
        max-width: 100%;
        width: 100%;
    }
}

.monitor-item {
    width: 100%;
}

.tags {
    margin-top: 4px;
    padding-left: 67px;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.bottom-style {
    padding-left: 67px;
    margin-top: 5px;
}

@media (max-width: 550px) {
    .selection-controls {
        .selected-count {
            margin-left: 0;
            width: 100%;
            margin-top: 0.25rem;
        }
    }
}
</style>


Review comment (suggestion):
```suggestion
@media (max-width: 549px), (min-width: 770px) and (max-width: 1149px),(min-width: 1200px) and (max-width: 1499px) {
```

Code after:
    padding-right: 30px;

    @media (max-width: 549px), (min-width: 770px) and (max-width: 1149px), (min-width: 1200px) and (max-width: 1499px) {
        max-width: 100%;
        width: 100%;
    }
}

.monitor-item {
    width: 100%;
}

.tags {
    margin-top: 4px;
    padding-left: 67px;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.bottom-style {
    padding-left: 67px;
    margin-top: 5px;
}

@media (max-width: 549px), (min-width: 770px) and (max-width: 1149px), (min-width: 1200px) and (max-width: 1499px) {
    .selection-controls {
        .selected-count {
            margin-left: 0;
            width: 100%;
            margin-top: 0.25rem;
        }
    }
}
</style>