feat(mutation): caseforge mutate command — HTTP boundary mutation testing (Phase 1 + Phase 2)#74
Merged
Conversation
Also fixes hurl.go JSON report parsing to match actual array-format output produced by hurl --report-json, and updates hurl_test.go to use the correct format.
…ix hurl report JSON format
Add Analyze() and BuildObservePrompt() to internal/mutation/feedback.go for OC-prompting survivor clusters via LLM. Expose --feedback, --auto-fix, and --yes flags on the mutate command; include runAutoFix stub for Task 9.
…, --auto-fix validation, error logging
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
caseforge mutatecommand that runs HTTP boundary mutations via a reverse proxy between hurl and a live API, identifies assertions that fail to catch mutations ("survivors"), and optionally uses LLM OC-prompting to suggest stronger assertions and patchindex.jsoninternal/runner/hurl.gowhere JSON report parsing used{"entries":[…]}but hurl emits a top-level array — silently zeroingPassed/FailedcountsWhat's included
Phase 1 — Engine + 12 operators + CLI
internal/mutation/proxy.go—MutationProxywrappinghttputil.ReverseProxyon a random local port;Registry()returning all 12 operatorsinternal/mutation/operator_body.go— 8 JSON body operators:field_drop,field_type_swap,array_to_null,null_to_array,pagination_off_by_one,empty_result_injection,date_format_swap,numeric_precision_loss(all deterministic via sorted key iteration)internal/mutation/operator_status.go— 4 status/header operators:status_swap_2xx,error_inflation,content_type_swap(usesstrings.HasPrefixfor robustness),header_dropinternal/mutation/engine.go—Run()orchestrates operators serially × cases concurrently (errgroup+ channel semaphore);runOncecopies a single.hurlto a temp dir and runsHurlRunnerinternal/mutation/report.go—TextSummary,WriteReport,Persist,ClusterSurvivors(groups survivors by case, computesRiskScore, sorts descending)cmd/mutate.go— CLI with--cases(required),--target(required),--output,--operator,--concurrency(default 4),--spec,--feedback,--auto-fix,--yes; exit code 6 when survivors > 0Phase 2 — LLM feedback + auto-fix
internal/mutation/feedback.go—Analyze()(OC-prompting per survivor cluster viallm.Retry),BuildObservePrompt(),PatchIndex()(patchesindex.json+ re-renders.hurlfiles via existingrender.HurlRenderer)--feedback: calls LLM per survivor cluster, prints diagnosis and suggested assertions; gracefully degrades when no provider configured--auto-fix: patchesindex.jsonwith suggested assertions and re-renders.hurlfiles; requires--feedback; prompts for confirmation unless--yesAcceptance tests
mutate --helpcontains "mutation"mutatewithout required flags exits non-zeromutation-report.json(skipped if hurl not installed)Usage
Test plan
go test -race ./...— all packages green./scripts/acceptance.sh— 259/259 passed including AT-401, AT-402, AT-403Acknowledgements
Mutation testing operator taxonomy inspired by established mutation testing literature (PIT, StrykerJS).