"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.rank = rank;
/**
 * Rank actions by simulated score improvement, descending.
 *
 * Zero-delta actions are kept (still may be hygienic). Negative-delta actions
 * are filtered out (shouldn't occur — indicates a bug in the action's patch).
 */
function rank(actions, metrics, scorer) {
    const baseline = scorer(metrics).score;
    const ranked = [];
    for (const action of actions) {
        const projected = scorer(action.patch(metrics)).score;
        const delta = projected - baseline;
        if (delta < 0)
            continue;
        ranked.push({
            ...action,
            scoreDelta: delta,
            baselineScore: baseline,
            projectedScore: projected,
        });
    }
    ranked.sort((a, b) => b.scoreDelta - a.scoreDelta);
    return ranked;
}
//# sourceMappingURL=remediation.js.map