Repository navigation
DecGuard v0.1 Step 2: metamorphic fuzzing, regression diff, replay - #2
Merged
Merged
Conversation
… replay
- Contract sections `properties`, `fuzz` and `regression` (schema 0.1, unreleased).
- Metamorphic engine:
- choice: option_order;
- all types: label_format, irrelevant_context, repeated_context, whitespace,
paraphrase;
- noul: inversion; score: monotonic.
Options are sent as shown and mapped back to contract labels before comparison.
- Distribution-aware comparisons (TV, JS, max abs delta, confidence delta, flip, rank
change, expected level) with per-case limits and aggregate violation/flip rates.
- Deterministic SHA-256 seeding per (seed, property, case), greedy failure minimization,
and skipped cases recorded with reasons.
- Paraphrase providers: identity, file, and an optional OpenAI-compatible provider;
plugins via the `decguard.paraphrasers` entry-point group.
- Reports gain `mode` and a `properties` section, verified against the stored results
on load; `report --contract` re-applies edited limits.
- CLI: `fuzz`, `test --all`, `replay` (reproduce stored failures and check seed
regeneration) and `diff` (flips, shifts, calibration/latency/error deltas, segments,
regression gates).
- Mock `position_bias` defect; the mock understands reordered and reformatted options.
- Examples, docs (properties, regression, CI), CHANGELOG, context, and a CI step that
shows a property violation failing with exit 1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
Author
|
Step 2 replay semantics are finalized in deab7c0.
Verification: Ruff lint/format, strict mypy, 246 passed + 1 opt-in external test skipped, clean-wheel smoke, Syngraphe context check, and all 8 GitHub Actions jobs passed. |
Owner
Author
|
Final replay edge case fixed in 15ad26f: synthetic original_error pairs remain recorded and counted by property error gates, but are excluded from PropertyRun.failures() and default replay selection. Real transformed backend errors and property violations remain replayable. Verification: Ruff lint/format, strict mypy, 247 passed + 1 opt-in external test skipped, Syngraphe context check, and all 8 GitHub Actions jobs passed. |
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.
Implements Step 2 of
.context/state/DECGUARD_V0.1_CODEX_PLAN.md.What's new
propertiesandfuzzsections, with eight properties:option_order;label_format,irrelevant_context,repeated_context,whitespace,paraphrase;inversion(the answer must swap);monotonic.identity,file, an optional OpenAI-compatible provider, and entry-point plugins.modeand apropertiessection. Stored comparisons and violations are checked on load, andreport --contractre-applies edited limits.fuzzandtest --all;replayre-sends stored failures, checks that the seed regenerates them, and exits 1 if a failure reproduces;diffreports flips, confidence and distribution shifts, calibration/latency/error deltas and segments, and appliesregressiongates with an implicitmax_error_rate_increase: 0.position_biassimulates an order-sensitive model.docs/properties.md,docs/regression.mdanddocs/ci.md. There is also a decision record for the engine design.Step 2 acceptance criteria
test_option_permutation_catches_an_order_sensitive_backend, theorder_sensitiveexample backend, and over HTTP).test_probability_drift_is_measured,test_distribution.py).test_regression.py,test_diff_catches_a_regression).test_stored_failures_replay, plus a CI step).test_fuzzing_is_deterministic_under_a_fixed_seed, pinned RNG).test_examples_pass_all_checks, inversion and monotonic tests).Verification
ruff check,ruff format --check,mypy(strict) andpytest: 245 passed, 1 skipped (the opt-in external test).validate,test,test --all,fuzz(exit 1 on the flawed backend),replay(exit 1) anddiffall run.🤖 Generated with Claude Code