Skip to content

fix(domain): domain fixes and domain PIT mutation workflow#286

Merged
alexk-dev merged 18 commits intomainfrom
test/pitests
Apr 15, 2026
Merged

fix(domain): domain fixes and domain PIT mutation workflow#286
alexk-dev merged 18 commits intomainfrom
test/pitests

Conversation

@alexk-dev
Copy link
Copy Markdown
Owner

@alexk-dev alexk-dev commented Apr 14, 2026

Summary

  • Add a CI-only pitests Maven profile with PIT 1.23.0 and the PIT JUnit 5 plugin.
  • Scope mutation testing to me.golemcore.bot.domain.* and existing domain tests, with an 85 mutation threshold for hard-mode coverage.
  • Add a separate PIT Tests GitHub Actions workflow that installs plugin API artifacts, runs the pitests profile, and uploads target/pit-reports.

@alexk-dev alexk-dev marked this pull request as ready for review April 15, 2026 01:45
alexk-dev and others added 17 commits April 14, 2026 21:48
Restrict mutation testing to the deterministic core of the domain
module (context pipeline, resolvers, memory diagnostics/orchestrator,
self-evolving run and promotion services, tool-loop view) so the 85%
mutation threshold is enforced against stable, well-covered code
rather than the full module at once.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replaces the duplicated `(int) Math.ceil(content.length() / 3.5)`
token heuristic inlined in every context layer with a single
TokenEstimator.estimate() helper. The helper handles null/empty
input explicitly so layers no longer need a ternary guard.

Adds a dedicated TokenEstimatorTest with exact numeric assertions
and boundary cases, plus MemoryLayer coverage for the runtime
fallback path (distinct budgets / topK values per knob), the
non-disabled memory preset branch, and the internal-message skip
in getLastUserMessageText() so they survive PIT mutation testing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add branch-coverage tests that exercise getLastUserMessageText null
returns, preset/runtime-config fallback paths, and hasToolMessages
short-circuit branches. Drop equivalent-mutant defensive null guards on
AgentContext in MemoryLayer since the pipeline never passes a null.
Add reflection-tier resolution tests spanning priority, skill-reflection,
runtime fallback, and user-pref fallback paths; cover the four
independently-negated isBlank checks and cloneCandidate list-preservation
branches in PromotionWorkflowStateService.
… branches

Add tests for findRun lambda with multiple cached runs, resolveAppliedTacticIds
mutable return, saveVerdict runId stamping, run/verdict cache population, and
completeRun persistence through findRun.
Add coverage for ACTIVE_SKILL_SOURCE so mutations in
formatActiveSkillSource and resolveExplicitSkillSource are killed, and
pin the session-state / non-string / missing-metadata branches of
readSessionActiveSkillName.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Drop dead `decision != null` checks in resolveTarget (unreachable — the
caller guards against null) and normalize decision.toState from the
resolved legacy state so all three PromotionTarget fields are observable.
Add tests for the null-decision, fully-populated, blank-candidate-id and
legacy-state synthesis paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
PMD's UnnecessaryFullyQualifiedName flagged the qualified reference in
the skip-null-and-blank-id test; List is already imported at the top of
the file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ache

Pin WebhookResponseSchemaLayer getName/getOrder, MemoryDiagnosticsAssembler
disabled-payload and basic-verbosity defaults, and PromotionWorkflowStore
cache-write/defensive-copy behavior so PIT return-value and removed-call
mutations are killed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pins the save(run) call on completeRun by counting journal interactions
directly, which kills the removed-call mutant that slipped past status
assertions when start/complete shared the same RunRecord reference.
Also drops an unreachable null guard in resolveAppliedTacticIds since
completeRun dereferences context before reaching it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Pins the NO_COVERAGE fallback line in MemoryLayer#isMemoryDisabled that
is taken when MemoryPresetService cannot resolve the configured preset
but the MEMORY_PRESET_ID attribute still points at "disabled". Uses a
mocked preset service so the lookup returns empty Optional and exercises
both the disabled and non-disabled fall-through outcomes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
buildTargetBundleId is only reached from execute(), which already
throws IllegalArgumentException when the candidate is null or has a
blank id, so the defensive branch inside the helper could never run.
Removing it kills the matching NO_COVERAGE mutants without loosening
any real invariant.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a plain-text session with null metadata so the builder exercises
the `return null` path in readPreviousModel and the matching null
branch in needsMasking. Distinguishes `null` from `""`, killing the
return-value mutant that otherwise survived with no coverage.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds direct coverage for MemoryLifecycleOrchestrator#upsertProceduralItem
so the normalization-and-persistence call is pinned and the early-return
guard (null item or memory disabled) is exercised without any
persistence side effects, killing the matching NO_COVERAGE/SURVIVED
mutants.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Removes the push and pull_request triggers from the PIT Tests workflow
so mutation analysis no longer runs on every PR/branch push. It now
only runs on-demand via the Actions UI or `gh workflow run`, keeping
it available for periodic quality audits without turning it into a
merge blocker.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@alexk-dev alexk-dev changed the title test: add domain PIT mutation workflow fix: domain fixes and domain PIT mutation workflow Apr 15, 2026
@alexk-dev alexk-dev changed the title fix: domain fixes and domain PIT mutation workflow fix(domain): domain fixes and domain PIT mutation workflow Apr 15, 2026
@sonarqubecloud
Copy link
Copy Markdown

@alexk-dev alexk-dev merged commit 0881f8e into main Apr 15, 2026
22 checks passed
@alexk-dev alexk-dev deleted the test/pitests branch April 15, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant