🐛 Fix broken change detection
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 25 Oct 2021 19:28:11 +0000 (21:28 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Mon, 25 Oct 2021 19:28:11 +0000 (21:28 +0200)
commit00e49489dcbb093895a9a7bfb252b7392b341138
treeef4537f8485fc8cb65b644a49609aea01949590e
parentb304bea61c03505fea7c288164ead3233ef36655
🐛 Fix broken change detection

Wow, this was a mess. Two days after the last deploy with a working change
detection I changed some code around the triggers and broke the detection. I
didn’t realize until over a year later because I have never deployed the broken
version until I made some unrelated changes.

I never liked the particular solution around the triggers keeping state and not
being pure functions. So now there are no more triggers; instead, the merging
of the states (which was done by the triggers — great misnomer there) is now
done by a merger, and the state is responsible for exposing whether it contains
a noteworthy change. The Merger and the State for a particular thing (like a
comic, or a torrent file) have to work together hand in hand here but they also
needed to do that before and it’s not really like you would use an X-Merger
with a Y-State.

The resulting changes touch pretty much everything but due to the Watcher
“shortcut” of chain creation, all .json files that only reference a Watcher do
not need to be touched which should make transition rather seamless.
61 files changed:
README.md
src/main/java/net/pterodactylus/rhynodge/Action.java
src/main/java/net/pterodactylus/rhynodge/Filter.java
src/main/java/net/pterodactylus/rhynodge/Reaction.java
src/main/java/net/pterodactylus/rhynodge/State.java
src/main/java/net/pterodactylus/rhynodge/Trigger.java [deleted file]
src/main/java/net/pterodactylus/rhynodge/Watcher.java
src/main/java/net/pterodactylus/rhynodge/engine/ReactionRunner.java
src/main/java/net/pterodactylus/rhynodge/loader/Chain.java
src/main/java/net/pterodactylus/rhynodge/loader/ChainWatcher.java
src/main/java/net/pterodactylus/rhynodge/loader/ReactionLoader.java
src/main/java/net/pterodactylus/rhynodge/mergers/ComicMerger.java [new file with mode: 0644]
src/main/java/net/pterodactylus/rhynodge/mergers/EpisodeMerger.java [new file with mode: 0644]
src/main/java/net/pterodactylus/rhynodge/mergers/TorrentMerger.java [new file with mode: 0644]
src/main/java/net/pterodactylus/rhynodge/output/Output.java
src/main/java/net/pterodactylus/rhynodge/package-info.java
src/main/java/net/pterodactylus/rhynodge/states/ComicState.java
src/main/java/net/pterodactylus/rhynodge/states/EpisodeState.java
src/main/java/net/pterodactylus/rhynodge/states/TorrentState.java
src/main/java/net/pterodactylus/rhynodge/triggers/AlwaysTrigger.java [deleted file]
src/main/java/net/pterodactylus/rhynodge/triggers/NewComicTrigger.java [deleted file]
src/main/java/net/pterodactylus/rhynodge/triggers/NewEpisodeTrigger.java [deleted file]
src/main/java/net/pterodactylus/rhynodge/triggers/NewTorrentTrigger.java [deleted file]
src/main/java/net/pterodactylus/rhynodge/watchers/AbstruseGooseWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/Collar6Watcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/CtrlAltDelWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/CyanideAndHappinessWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/DefaultWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/DrugsAndWiresWatcher.kt
src/main/java/net/pterodactylus/rhynodge/watchers/GeneralProtectionFaultWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/GirlGeniusWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/HeldentageWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/KevinAndKellWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/KickAssTorrentsEpisodeWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/KickAssTorrentsWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/LeastICouldDoWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/PirateBayEpisodeWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/PirateBayWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/PoorlyDrawnLinesWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/SaturdayMorningBreakfastCerealWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/SavoyTicketWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/ScandinaviaAndTheWorldWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/SinfestWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/TorrentHoundEpisodeWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/TorrentHoundWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/TorrentzEuEpisodeWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/TorrentzEuWatcher.java
src/main/java/net/pterodactylus/rhynodge/watchers/XkcdWatcher.java
src/main/kotlin/net/pterodactylus/rhynodge/Merger.kt [new file with mode: 0644]
src/main/kotlin/net/pterodactylus/rhynodge/mergers/LastStateMerger.kt [new file with mode: 0644]
src/main/kotlin/net/pterodactylus/rhynodge/watchers/BusinessCatWatcher.kt
src/main/kotlin/net/pterodactylus/rhynodge/watchers/QuestionableContentWatcher.kt
src/main/kotlin/net/pterodactylus/rhynodge/watchers/SoggyCardboardWatcher.kt
src/main/kotlin/net/pterodactylus/rhynodge/watchers/TheMonsterUnderTheBedWatcher.kt
src/main/resources/chains/kickasstorrents-example.json
src/main/resources/chains/thepiratebay-example.json
src/test/java/net/pterodactylus/rhynodge/ReactionTest.java
src/test/kotlin/net/pterodactylus/rhynodge/mergers/ComicMergerTest.kt [new file with mode: 0644]
src/test/kotlin/net/pterodactylus/rhynodge/mergers/LastStateMergerTest.kt [new file with mode: 0644]
src/test/kotlin/net/pterodactylus/rhynodge/triggers/AlwaysTriggerTest.kt [deleted file]
src/test/kotlin/net/pterodactylus/rhynodge/triggers/NewComicTriggerTest.kt [deleted file]