hub + installer (unreleased): fixes after an independent review of the night's code — per-thing mail cooldown, a box's input bounded and checked, both off-site account types on a reset, a quiet first run, strict-mode installer

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
admin committed 2026-11-14 19:08:55 +01:00
1 parent a044eb8c16
commit f618c591eb
31 files changed
+796 -88

No files matched your search

@@ -0,0 +1,69 @@
== MUTATION: the trust move writes agent.json without the shared lock
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
FAIL gitea.dooplex.hu/admin/felhom-agent/cmd/felhom-agent [build failed]
1 mutations, 1 not a red-proof
== MUTATION: a give-up stays reported after onboot is switched off
RED on the mutant, GREEN on the real file
--- FAIL: TestGuestPower_GiveUpEndsWhenTheGuestIsNoLongerOurs (0.00s)
guestpower_test.go:315: onboot switched off: the give-up is still reported: [{VMID:9201 Since:2026-11-14T02:30:00Z Attempts:3}]
== MUTATION: a give-up stays reported for a locked guest
RED on the mutant, GREEN on the real file
--- FAIL: TestGuestPower_GiveUpEndsWhenTheGuestIsNoLongerOurs (0.00s)
guestpower_test.go:315: locked by another operation: the give-up is still reported: [{VMID:9201 Since:2026-11-14T02:30:00Z Attempts:3}]
== MUTATION: a give-up stays reported for a destroyed guest
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
FAIL gitea.dooplex.hu/admin/felhom-agent/internal/localapi [build failed]
internal/localapi/guestpower.go:162:6: declared and not used: vmid
3 mutations, 1 not a red-proof
== MUTATION: the two tokens come from two reads of the init
RED on the mutant, GREEN on the real file
--- FAIL: TestGuestBootKey_AClockStepDoesNotMoveIt (0.00s)
guest_boot_key_test.go:84: GuestBootTokens = "1794112550-4242", "5b1f6c1e-8f0a-4c56-9d1c-0a8c3b7d2e11-4242" after 2 read(s) of the init — want both tokens from ONE read
1 mutations, 0 not a red-proof
== MUTATION: the stanza knows the last refresh only from the record file (root-only on a box)
RED on the mutant, GREEN on the real file
--- FAIL: TestProfileRefreshStanza_RecordAndLastAsk (0.00s)
profilerefresh_test.go:139: stanza after an agent restart (the wrapper's answer, no detail) = {"last_ask":"not_needed","last_ask_at":"2026-11-14T14:30:11Z"}
== MUTATION: a refresh by this process is not remembered
RED on the mutant, GREEN on the real file
--- FAIL: TestProfileRefreshStanza_RecordAndLastAsk (0.00s)
profilerefresh_test.go:123: stanza after a refresh, record file unreadable = {"last_ask":"refreshed","last_ask_at":"2026-11-14T11:30:11Z"}
== MUTATION: a readable record does not add the detail back
RED on the mutant, GREEN on the real file
--- FAIL: TestProfileRefreshStanza_RecordAndLastAsk (0.00s)
profilerefresh_test.go:150: stanza with a readable record = {"kernel":"7.0.14-28-pve","at":"2026-11-14T11:30:11Z","last_ask":"not_needed","last_ask_at":"2026-11-14T14:30:11Z"}
3 mutations, 0 not a red-proof
== MUTATION: the trust move writes agent.json without the shared lock — done again (the first mutant left an import unused)
RED on the mutant, GREEN on the real file
--- FAIL: TestAgentJSONWritersTakeTheSharedLock (0.00s)
config_writers_lock_test.go:55: ../../internal/pvetrust/pvetrust.go writeConfig: must start with config.FileMu.Lock() and defer config.FileMu.Unlock()
1 mutations, 0 not a red-proof
== MUTATION: a give-up stays reported for a destroyed guest — done again (the first mutant left a variable unused)
RED on the mutant, GREEN on the real file
--- FAIL: TestGuestPower_GiveUpEndsWhenTheGuestIsNoLongerOurs (0.00s)
guestpower_test.go:315: destroyed: the give-up is still reported: [{VMID:9201 Since:2026-11-14T02:30:00Z Attempts:3}]
1 mutations, 0 not a red-proof
== MUTATION: the copy's previous certificate is thrown away at a change (the old behaviour: no root verifies the served certificate after a restart)
RED on the mutant: 3 failing line(s)
FAIL: test_a_renewed_ca_refreshes_the_copy (__main__.PVECACopy.test_a_renewed_ca_refreshes_the_copy)
AssertionError: Lists differ: [b'--[86 chars]----'] != [b'--[86 chars]----', b'-----BEGIN CERTIFICATE-----\nQUJDREVG[52 chars]---']
FAILED (failures=1)
== MUTATION: the same source is written again at every run
RED on the mutant: 5 failing line(s)
FAIL: test_a_renewed_ca_refreshes_the_copy (__main__.PVECACopy.test_a_renewed_ca_refreshes_the_copy)
AssertionError: Tuples differ: (0, 'written', [('/etc/felhom-agent/pve-root-c[108 chars]20)]) != (0, 'same', [])
FAIL: test_the_same_copy_is_not_written_again (__main__.PVECACopy.test_the_same_copy_is_not_written_again)
== MUTATION: the copy grows by one certificate at every change
RED on the mutant: 3 failing line(s)
FAIL: test_a_renewed_ca_refreshes_the_copy (__main__.PVECACopy.test_a_renewed_ca_refreshes_the_copy)
AssertionError: Lists differ: [b'--[183 chars]----', b'-----BEGIN CERTIFICATE-----\nQUJDREVG[52 chars]---'] != [b'--[183 chars]----']
FAILED (failures=1)
the real file: 0 failing line(s)
3 mutations, 0 not a red-proof
@@ -0,0 +1,10 @@
== MUTATION: every certificate in the store is reported, also for a name the box no longer serves
RED on the mutant, GREEN on the real file
--- FAIL: TestWebCertsForReport_PathFieldAndBrokenStore (0.00s)
web_certs_report_test.go:62: a certificate for ANOTHER domain was reported: [{Domain:*.example.hu NotAfter:2027-01-19T01:46:00Z Issuer:*.example.hu}]
== MUTATION: the domain is matched as a plain suffix
RED on the mutant, GREEN on the real file
--- FAIL: TestWebCertsForReport_PathFieldAndBrokenStore (0.00s)
web_certs_report_test.go:65: a domain that only ENDS the same way matched: [{Domain:*.example.hu NotAfter:2027-01-19T01:46:00Z Issuer:*.example.hu}]
2 mutations, 0 not a red-proof
@@ -0,0 +1,104 @@
== MUTATION: the cooldown key has no subject (the second token of the day is never mailed)
RED on the mutant, GREEN on the real file
--- FAIL: TestSubjectCooldown_TwoThingsTwoMails (0.04s)
subject_cooldown_test.go:24: mails = 1, want two (one per token) and none for the repeat: ["Customer: \nEvent: operator_token_ends_soon\nSeverity: warning\nTime: 2026-11-14 19:02 CET\nMessage: token A ends\nDetails: {\"su
== MUTATION: every event type gets the subject suffix (other types' keys change)
RED on the mutant, GREEN on the real file
--- FAIL: TestSubjectCooldown_TwoThingsTwoMails (0.04s)
subject_cooldown_test.go:37: backup_failed: its cooldown key changed (":x") — only the listed types may
subject_cooldown_test.go:37: app_start_failed: its cooldown key changed (":x") — only the listed types may
subject_cooldown_test.go:37: tunnel_down: its cooldown key changed (":x") — only the listed types may
2 mutations, 0 not a red-proof
== MUTATION: the box's mode word reaches the event unchecked
*** NOT A RED-PROOF *** (mutant rc=1 built=False real rc=0)
FAIL gitea.dooplex.hu/admin/felhom-hub/internal/api [build failed]
== MUTATION: the box's date text reaches the event unchecked
RED on the mutant, GREEN on the real file
--- FAIL: TestProxmoxTrust_OnlyClosedWordsReachTheEvent (0.08s)
review_fixes_test.go:25: the box's own text "send money" reached the event: Trust in Proxmox on h1: a cause this hub does not know (mode: other). The root CA copy ends in 3 day(s) (send money to X). Design: `03` §12a.{"ca_not_afte
review_fixes_test.go:29: unknown words must read as other / empty: Trust in Proxmox on h1: a cause this hub does not know (mode: other). The root CA copy ends in 3 day(s) (send money to X). Design: `03` §12a.{"ca_not_after":"send
== MUTATION: no cap on a box's give-up marks
RED on the mutant, GREEN on the real file
--- FAIL: TestGuestPowerGaveUp_ABoxCannotFillTheSettings (0.05s)
review_fixes_test.go:63: round 0: 16 give-up marks for one box, want at most 8
== MUTATION: a mark for a guest the box no longer lists stays for ever
RED on the mutant, GREEN on the real file
--- FAIL: TestGuestPowerGaveUp_ABoxCannotFillTheSettings (0.04s)
review_fixes_test.go:72: marks for guests the box no longer lists: 8 (rows 8), want 0
4 mutations, 1 not a red-proof
== MUTATION: a cleared alarm leaves an empty row
*** NOT A RED-PROOF *** (mutant rc=0 built=True real rc=0)
== MUTATION: the key list matches with LIKE-style prefix of another id (no exact prefix)
RED on the mutant, GREEN on the real file
--- FAIL: TestD73_PurgeRemovesTheHouseholdsRows_JournalStays (0.05s)
d73_gone_rows_test.go:168: web-certificate marks of cust-a: 2, want 0
d73_gone_rows_test.go:168: web-certificate marks of cust-b: 2, want 1
2 mutations, 1 not a red-proof
== MUTATION: a household's web-certificate marks outlive it
RED on the mutant, GREEN on the real file
--- FAIL: TestD73_PurgeRemovesTheHouseholdsRows_JournalStays (0.05s)
d73_gone_rows_test.go:168: web-certificate marks of cust-a: 1, want 0
== MUTATION: the purge also removes the marks of a household whose id starts the same way
RED on the mutant, GREEN on the real file
--- FAIL: TestD73_PurgeRemovesTheHouseholdsRows_JournalStays (0.05s)
d73_gone_rows_test.go:168: web-certificate marks of cust-a2: 0, want 1
2 mutations, 0 not a red-proof
== MUTATION: a first run mails ENDED for a token that ended before the deploy
RED on the mutant, GREEN on the real file
--- FAIL: TestEndDates_FirstRunAndABoxCannotMintMarks (0.00s)
end_dates_test.go:173: the first run: [|operator_token_ends_soon|error|The operator access token „replaced” ENDED on 2026-11-11 and is not revoked: every script that still uses it gets 401. Do: if it was replaced, revoke it on the
== MUTATION: a box gets a new mail for every new end date
RED on the mutant, GREEN on the real file
--- FAIL: TestEndDates_FirstRunAndABoxCannotMintMarks (0.00s)
end_dates_test.go:195: a box that moves its end date by a minute each hour got 48 mails in two days (want at most a few: a new mail needs a date a day later)
== MUTATION: no cap on a household's web-certificate marks
RED on the mutant, GREEN on the real file
--- FAIL: TestEndDates_FirstRunAndABoxCannotMintMarks (0.00s)
end_dates_test.go:208: 192 invented names made 192 marks, want at most 24 for one household
3 mutations, 0 not a red-proof
== MUTATION: a tick with the other type drops the first account's record
RED on the mutant, GREEN on the real file
--- FAIL: TestKeepAccountRecord_FourCases (0.00s)
account_record_test.go:47: unticked shared, then ticked as DEDICATED: the shared account's record stays: record <nil>, want user u1-sub3 unticked_at 2026-11-01T00:00:00Z ({"offsite":{"enabled":true,"type":"dedicated","user":"u9","
account_record_test.go:47: switched from shared to dedicated in ONE save: the shared account gets a record: record <nil>, want user u1-sub3 unticked_at 2026-11-14T20:00:00Z ({"offsite":{"enabled":true,"type":"dedicated","user":"u9
1 mutations, 0 not a red-proof
== MUTATION: the record is dropped also when the provider leg was skipped
RED on the mutant, GREEN on the real file
--- FAIL: TestD71_RecordSurvivesASkippedLeg_AndBothTypesGo (0.05s)
d71_offsite_account_record_test.go:193: the provider leg was SKIPPED and the account's record is gone: {}
== MUTATION: the RESET takes down only the first account type
RED on the mutant, GREEN on the real file
--- FAIL: TestD71_RecordSurvivesASkippedLeg_AndBothTypesGo (0.05s)
d71_offsite_account_record_test.go:197: a household with a dedicated tier AND a kept shared record: the RESET would take down [dedicated], want both
== MUTATION: the record is never dropped after a real takedown
RED on the mutant, GREEN on the real file
--- FAIL: TestD71_UntickKeepsTheAccountAndItsRecord_ResetTakesItDown (0.06s)
d71_offsite_account_record_test.go:131: the record outlived the account: {"logging":{"level":"debug"},"offsite_account":{"type":"shared","user":"u629193-sub1000","host":"u629193-sub1000.your-storagebox.de","unticked_at":"2026-11-1
3 mutations, 0 not a red-proof
== MUTATION: a mail that failed in this process is told as lost
RED on the mutant, GREEN on the real file
--- FAIL: TestLostOperatorMail_AMailThatFailedInThisProcessIsNotLost (0.04s)
lost_operator_mail_test.go:109: a mail that failed AFTER this process started was told as lost (1)
1 mutations, 0 not a red-proof
== MUTATION: a cleared alarm leaves an empty row — done again: the first run was GREEN (the test read through a function that hides empty rows; a test that counts the rows was added)
RED on the mutant, GREEN on the real file
--- FAIL: TestOSAlarm_AClearedMarkLeavesNoRow (0.04s)
d73_gone_rows_test.go:253: a cleared mark left 1 row(s)
1 mutations, 0 not a red-proof
== MUTATION: the box's mode word reaches the event unchecked — done again (the first mutant did not compile)
RED on the mutant, GREEN on the real file
--- FAIL: TestProxmoxTrust_OnlyClosedWordsReachTheEvent (0.08s)
review_fixes_test.go:25: the box's own text "MODE" reached the event: Trust in Proxmox on h1: a cause this hub does not know (mode: <b>MODE</b> call +36…). The root CA copy ends in 3 day(s) (). Design: `03` §12a.{"ca_not_after":""
review_fixes_test.go:25: the box's own text "<b>" reached the event: Trust in Proxmox on h1: a cause this hub does not know (mode: <b>MODE</b> call +36…). The root CA copy ends in 3 day(s) (). Design: `03` §12a.{"ca_not_after":"",
review_fixes_test.go:29: unknown words must read as other / empty: Trust in Proxmox on h1: a cause this hub does not know (mode: <b>MODE</b> call +36…). The root CA copy ends in 3 day(s) (). Design: `03` §12a.{"ca_not_after":"","c
1 mutations, 0 not a red-proof
@@ -0,0 +1,9 @@
== MUTATION: a failed fingerprint read ends the installer (the old line)
RED on the mutant: 1 failing line(s)
FAIL test_pve_trust_no_answer_from_proxmox_does_not_end_the_installer --
== MUTATION: the proof is a pipe into grep -q again (a good copy can read as not verified under pipefail)
*** NOT A RED-PROOF ***: 0 failing line(s)
the real file: 0 failing line(s)
2 mutations, 1 not a red-proof
NOTE: the second mutation is NOT a red-proof and is left here on purpose. The defect it models (grep -q closes the pipe while s_client still writes; pipefail then fails the pipeline for a good copy) was reasoned by the reviewer and could not be reproduced in this test in 2 runs. The fix (read the answer whole, search after) removes the pipe, so the question does not arise; it is NOT proven that the old line ever failed.