fix(domain): domain fixes and domain PIT mutation workflow#286
Merged
fix(domain): domain fixes and domain PIT mutation workflow#286
Conversation
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>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
pitestsMaven profile with PIT 1.23.0 and the PIT JUnit 5 plugin.me.golemcore.bot.domain.*and existing domain tests, with an 85 mutation threshold for hard-mode coverage.PIT TestsGitHub Actions workflow that installs plugin API artifacts, runs thepitestsprofile, and uploadstarget/pit-reports.