Hacker News new | ask | show | jobs
by Carrok 699 days ago
I eagerly await your proposal on how to undo arbitrary cli commands.
4 comments

Run the code backwards!

    $ man mr
    MR(1)

    NAME
      mr, relink - restore directory entries

    $ mr -fr /  # restore a filesystem root after deleting it (recursively, forced restore)
I can’t believe I just learned about this. So many lost files

Edit: lies!

Wait until you discover sl
I wonder how long until <insert favorite llm> picks this up and thinks it's a real command
What he's saying is that everything should be idempotent, which may be possible for local only calls and filesystem snapshots, but anything doing a network call is outside the realm of this possibility. Such a system would need to spin up a local, accurate backend for any network call, execute the call, verify the results are not catastrophic and retry with a real call, but then we also introduce time caused uncertainty as the real system may drift enough from the expected state during the local validation. A fun thought experiment but science fiction IMHO.
nit: that's not what idempotent means
dang, I think you're right, my mind branched off somewhere it seems. I was thinking of how operations can be executed multiple times (verification + actual result run) with effect being applied only once.

    import timetravel

    from timetravel import Delorean
    
    d = Delorean(color="SILVER")
    if d.power_gw >= 1.21:
        d.flux_compensator.charge()
        print("Great Scott!")
CoW filesystems with frequent snapshotting, which suffices save for CoWFS-specific commands.

Spinning up a VM for testing is another Very Good Practice.