03 §12a item 7: a cut write of the agent's config is repaired at start (R-1380); red-proofs
gates / gates (push) Successful in 2m7s

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-15 08:20:49 +01:00
1 parent fffbb40ce0
commit bbecdd9195
2 files changed
+82 -3

No files matched your search

@@ -0,0 +1,66 @@
== MUTATION: the journal is not written before the truncate
RED on the mutant, GREEN on the real file
--- FAIL: TestRecoverCutWrite_AfterACutAtEveryStepTheConfigIsWholeAndLoads (0.00s)
cutwrite_test.go:76: the repair saw no journal — a cut write would stay broken
cutwrite_test.go:76: the repair saw no journal — a cut write would stay broken
cutwrite_test.go:76: the repair saw no journal — a cut write would stay broken
== MUTATION: the start does not put the old bytes back
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
FAIL gitea.dooplex.hu/admin/felhom-agent/internal/config [build failed]
internal/config/cutwrite.go:121:2: declared and not used: perm
== MUTATION: the start puts the OLD file over a whole NEW file
RED on the mutant, GREEN on the real file
--- FAIL: TestRecoverCutWrite_AfterACutAtEveryStepTheConfigIsWholeAndLoads (0.00s)
cutwrite_test.go:79: after a cut at synced and the repair the config is "{\"proxmox\":{\"tls\":{\"fingerprint\":\"AA:BB\"}},\"keep\":\"me\"}", want "{\"proxmox\":{\"tls\":{\"ca_file\":\"/etc/felhom-agent/pve-root-ca.pem\",\"finger
== MUTATION: the journal stays after a whole write
RED on the mutant, GREEN on the real file
--- FAIL: TestReplaceInPlace_AWholeWriteLeavesTheNewFileAndNoJournal (0.00s)
cutwrite_test.go:102: the journal stayed after a whole write: <nil>
== MUTATION: a write goes on with no journal folder
*** NOT A RED-PROOF *** (mutant rc=0 built=True real rc=0)
== MUTATION: the repair writes mode 644
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
FAIL gitea.dooplex.hu/admin/felhom-agent/internal/config [build failed]
internal/config/cutwrite.go:122:5: declared and not used: st
6 mutations, 3 not a red-proof
== MUTATION: main does not call the repair
RED on the mutant, GREEN on the real file
--- FAIL: TestMainCallsTheConfigRepairBeforeItLoadsTheConfig (0.01s)
config_cutwrite_test.go:84: main: repair call found=false, config.Load found=true
== MUTATION: the repair seam does nothing
RED on the mutant, GREEN on the real file
--- FAIL: TestMainRecoversACutConfigWrite (0.00s)
config_cutwrite_test.go:39: note="" err=<nil>
2 mutations, 0 not a red-proof
== MUTATION: the trust move writes the config by hand again
RED on the mutant, GREEN on the real file
--- FAIL: TestAgentJSONWritersUseTheJournalledWrite (0.00s)
config_cutwrite_test.go:131: ../../internal/pvetrust/pvetrust.go writeConfig: 0 call(s) to config.ReplaceInPlace, want 1
1 mutations, 0 not a red-proof
## three mutants redone (the first two did not compile, the third was equal to the real code: the folder check failed first)
== MUTATION: the start does not put the old bytes back
RED on the mutant, GREEN on the real file
--- FAIL: TestRecoverCutWrite_AfterACutAtEveryStepTheConfigIsWholeAndLoads (0.00s)
cutwrite_test.go:79: after a cut at half-written and the repair the config is "{\"proxmox\":{\"tls\":{\"ca_file\":\"/etc/felhom-agent/", want "{\"proxmox\":{\"tls\":{\"fingerprint\":\"AA:BB\"}},\"keep\":\"me\"}"
cutwrite_test.go:79: after a cut at truncated and the repair the config is "", want "{\"proxmox\":{\"tls\":{\"fingerprint\":\"AA:BB\"}},\"keep\":\"me\"}"
== MUTATION: a write goes on when the journal cannot be made
RED on the mutant, GREEN on the real file
--- FAIL: TestReplaceInPlace_WithoutAJournalNothingIsWritten (0.00s)
cutwrite_test.go:120: the write went on with no journal
== MUTATION: the repair writes mode 644
*** NOT A RED-PROOF *** (mutant rc=0 built=True real rc=0)
3 mutations, 1 not a red-proof
## the mode test was REMOVED, not kept: the repair writes into the existing file and cannot change its mode, so no mutant could make the test red. The mode argument was dead code and went with it.
== MUTATION: the start does not put the old bytes back (after the simplification)
RED on the mutant, GREEN on the real file
--- FAIL: TestRecoverCutWrite_AfterACutAtEveryStepTheConfigIsWholeAndLoads (0.00s)
cutwrite_test.go:79: after a cut at truncated and the repair the config is "", want "{\"proxmox\":{\"tls\":{\"fingerprint\":\"AA:BB\"}},\"keep\":\"me\"}"
cutwrite_test.go:79: after a cut at half-written and the repair the config is "{\"proxmox\":{\"tls\":{\"ca_file\":\"/etc/felhom-agent/", want "{\"proxmox\":{\"tls\":{\"fingerprint\":\"AA:BB\"}},\"keep\":\"me\"}"
1 mutations, 0 not a red-proof