Apply at most one idempotent write and turn the accepted and skipped counts into a commit, skip, or retry remediation action.

Call Once Remediation Report

call_once_remediation_report.cpp
#include <iostream>
#include <string>

int main() {
    int writes = ;
    int accepted = 0;
    int skipped = 0;

    for (int i = 0; i < writes; ++i) {
        if (accepted == 0) {
            accepted += 1;
        } else {
            skipped += 1;
        }
    }

    std::string action;
    if (accepted == 0) {
        action = "retry";
    } else if (skipped > 0) {
        action = "skip";
    } else {
        action = "commit";
    }

    std::cout << "writes=" << writes
              << " accepted=" << accepted
              << " skipped=" << skipped
              << " " << action << std::endl;
    return 0;
}
#include <iostream>
#include <string>

int main() {
    int writes = ;
    int accepted = 0;
    int skipped = 0;

    for (int i = 0; i < writes; ++i) {
        if (accepted == 0) {
            accepted += 1;
        } else {
            skipped += 1;
        }
    }

    std::string action;
    if (accepted == 0) {
        action = "retry";
    } else if (skipped > 0) {
        action = "skip";
    } else {
        action = "commit";
    }

    std::cout << "writes=" << writes
              << " accepted=" << accepted
              << " skipped=" << skipped
              << " " << action << std::endl;
    return 0;
}
#include <iostream>
#include <string>

int main() {
    int writes = ;
    int accepted = 0;
    int skipped = 0;

    for (int i = 0; i < writes; ++i) {
        if (accepted == 0) {
            accepted += 1;
        } else {
            skipped += 1;
        }
    }

    std::string action;
    if (accepted == 0) {
        action = "retry";
    } else if (skipped > 0) {
        action = "skip";
    } else {
        action = "commit";
    }

    std::cout << "writes=" << writes
              << " accepted=" << accepted
              << " skipped=" << skipped
              << " " << action << std::endl;
    return 0;
}
idempotent write Only the first write is accepted and later writes are counted as skipped, so the remediation action is reproducible without a live one-shot call guard.