!5191test-quality-mutation → develop8798df35f1

Curated security mutations: follow-ups on develop's runner

AI-generatedEverything on this page was written by an AI agent from the diff: the summaries, the narration, the diagrams, the flags and the glossary. It can be wrong or incomplete, so check it against the code before you rely on it.

15commits
6files
281lines changed
182lines to read
7 / 7mutants in fast set
1800 ssuite budget

Where the diff is

Tests1 files · 82 lines

…/scripts/tests/test_security_mutations.py+82 −0
1baselines pass2control survives37 mutants killed4exit 0

4-minute explainer

What changed

Mutants hit AddAttestation

Signature and replay mutants now guard the live gossip path.

ProcessAttestationtests onlyAddAttestation4 gossip handlersskip verifySignatureskip duplicate checkkilledkilled

One fast CI job

All seven mutants run on MRs; the scheduled deep job is gone.

5 fast+ chain halt+ signer count= 7 fast
skip: unchanged merge trainskip: fork MRsecurity-mutations-deep removed

One deadline

Lock wait and every go test fit inside start + budget.

deadlinestartlock waitbaselinescontrol + mutantseach timeout = min(per command, remaining) · flags ≥ 1 s

Kill the process group

go test runs in its own session; the whole group is killed.

  • timeout → killpg(SIGKILL)
  • Ctrl-C, exception → kill + reap
  • SIGTERM / SIGHUP → SystemExit → same cleanup
  • normal exit → group killed before lock release

Runner tests

Zero and negative durations exit 2; lock wait stops at budget.

--lock-wait 0 → exit 2-1 → exit 2soon → exit 2held lock, budget 2 s → exit 1 < 30 s

What's the record

The cited results snapshot isn't in the tree; the CI artifact is.

test-quality-reports/mutations-fast.jsonalso in draft !5181

State + upgrade

Runner flags

  • changed--seconds-per-commandany int (now ≥ 1) → 300
  • changed--lock-waitany int (now ≥ 1) → 600
  • changed--budget-secondsany int (now ≥ 1) → 1800
  • newTHORNODE_TEST_QUALITY_LOCK/tmp/thornode-test-quality-build.lock

Line by line · every changed logic line, narrated

6:16runtime
8code chapters
100%logic lines narrated (184/184)
4flagged spots
speed

Chapters

What to check

Ask an AI about this change

Chat assistantClaude, ChatGPT, … (reads a link)

Coding agentClaude Code, Cursor, … (reads the repo)

The context file is context.md. Use Copy with context for an AI that can't open links; it pastes the whole file in.

Glossary

AddAttestation
AttestationState.AddAttestation verifies a peer's signature on an observation and ignores a repeated one. Every gossip handler calls it. generic_attestation.go ↗
Anchor
The exact 'old' text a mutant replaces. It must occur exactly once in the file, or the mutant is marked invalid. scripts/test-security-mutations.json ↗
Build lock
A file lock (flock) at /tmp/thornode-test-quality-build.lock that serialises heavy test-quality runs on one machine. THORNODE_TEST_QUALITY_LOCK now overrides the path. scripts/test-security-mutations.py ↗
Fast / deep mode
The manifest marks each mutant fast or deep. After this MR all seven are fast, and the scheduled deep job is removed. scripts/TEST_QUALITY_CI.md ↗
Go overlay
go build's -overlay flag maps a source file to a replacement file, so the mutant compiles without editing the checkout. go help build ↗
Merge train
GitLab queues approved MRs and tests each merged with the ones ahead. This job, like unit-tests, skips a car whose develop base has not moved. GitLab merge trains ↗
Mutant
A copy of the source with one exact line swapped for a weaker one. It is killed when its named test fails, and survives when the test still passes. scripts/test-security-mutations.md ↗
Process group
A set of processes signalled together. go test runs in a new session, so killpg reaches its compilers and test binaries too. Python os.killpg ↗
tss-lib-private
A private THORChain TSS library the observer package imports; fork MRs can't fetch it, so the job skips them.
Weak control
TestMutationWeakUnanimity, a deliberately incomplete test run against the quorum mutant. It must survive, showing the runner doesn't count everything as killed. scripts/test-security-mutations.md ↗