Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 0 additions & 33 deletions AGENTS.md

This file was deleted.

18 changes: 18 additions & 0 deletions multiplex/approach/basic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Unguided/Basic Configuration

The unguided or `basic` configuration requires the `config.yml` file to contain the following:
Update the prompts for your chosen language.

```yaml
mutation:
approach: basic

system_prompts:
basic_generate_mutants: |
You are a code generator.
When given a Java method, re-implement it with a single small behavioral defect (a mutant).
Change exactly one thing: an operator, a boundary condition, a constant, or a returned value.
Include a concise code comment describing the injected defect.
Output the defective Java code only and nothing else.

```
43 changes: 43 additions & 0 deletions multiplex/approach/hazop/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# HAZOP Configuration

The HAZOP configuration requires the `config.yml` file to contain the following:
Update the prompts to suite your chosen language.

```yaml
mutation:
approach: hazop

system_prompts:
hazop_describe_process: |
When given a Java method, describe the intent of the code in a line-by-line manner, as concisely as possible.

Explain what the code does, not how it is written.
End each line with a comma and don't use commas anywhere else.
Break the explanation into line-numbered steps and return the line-numbered steps.
hazop_identify_deviations: |
For each numbered description, output one version of the string where one of the rules has changed.
The rule must be changed using one of the "guidewords" from HAZOP.
The guidewords and their interpretation is delimited by ###, in the form guideword - interpretation.
That is, everything before - is the guideword and everything after is the meaning.

###

No (not, none) - None of the design intent is achieved
More (more of, higher) - Quantitative increase in a parameter
Less (less of, lower) - Quantitative decrease in a parameter
As well as (more than) - An additional activity occurs
Part of - Only some of the design intention is achieved
Reverse - Logical opposite of the design intent occurs
Other than (other) - Complete substitution (another activity takes place or an unusual activity occurs or uncommon condition exists)

###

Please output each new rule, as a csv line, without headings in the format:
"number, original_rule, guideword (CAPITALIZED), changed_rule"
hazop_implement_deviations: |
You are a code generator.
When given a description, re-implement the method but with the incorrect behavior/defect as described in the description.

Include a concise code comment to describe the implemented defect.
Output the defective Java code only and nothing else.
```
14 changes: 14 additions & 0 deletions multiplex/approach/llmorpheus/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# LLMorpheus Configuration

The LLMorpheus configuration requires the `config.yml` file to contain the following:
Update the prompts for your chosen language.

```yaml
mutation:
approach: llmorpheus

system_prompts:
llmorpheus_system: |
You are an expert in mutation testing. Your job is to make small changes to a project's code in order to find weaknesses in its test suite.
If none of the tests fail after you make a change, that indicates that the tests may not be as effective as the developers might have hoped, and provide them with a starting point for improving their test suite.
```
43 changes: 43 additions & 0 deletions multiplex/approach/stpa/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# STPA Configuration

The STPA configuration requires the `config.yml` file to contain the following:
Update the prompts for your chosen language.

```yaml
mutation:
approach: stpa

system_prompts:
stpa_describe_control_flow: |
You describe Java methods as control flow diagrams.
When given a Java Method, create a written description in the DOT language used in GraphViz of the control structure.
Use human readable labels and descriptions for each node.
Output the control diagram only, and nothing else.
stpa_identify_ucas: |
Identify 10 different Unsafe Control Actions (UCAs) within the control diagram described in DOT language, referencing the code, using each of the guidewords delimited by ### below:

###
* provides
* does not provide
* too early
* too late
* out of order
* stopped too soon
* applied for too long

###

You must describe each UCA in the format: <Variable or Structure><ControlAction><Guideword><Context>

An example of this is:
variable x calculated out of order when sorting has not occurred.

Output the numbered list of UCAs with no empty lines, and nothing else.
stpa_implement_ucas: |
You are a code generator.
When given a description, re-implement the method but with the incorrect behavior/defect as described in the description.

Include a concise code comment to describe the implemented defect.
Output the defective Java code only and nothing else.

```
13 changes: 2 additions & 11 deletions multiplex/prompts.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
"""Resolve and validate system prompts for the selected mutation approach."""
"""Check prompts for the selected mutation approach."""

# Each approach uses only its own system prompts. Only the selected approach's
# keys are required for a run; unrelated keys may be omitted from the config.
# Adding an approach means adding its required prompt keys here.
APPROACH_PROMPT_KEYS = {
"basic": ["basic_generate_mutants"],
"hazop": [
Expand All @@ -21,13 +18,7 @@


def resolve_prompts(config, approach):
"""Return the system prompts required by ``approach``.

Only the keys the selected approach actually uses are read, so a config need
not define prompts for approaches it will not run. Raises ``SystemExit`` with
an actionable message if the approach is unknown or any required
``system_prompts`` key is missing or empty.
"""
"""Return the system prompts required by ``approach``."""
if approach not in APPROACH_PROMPT_KEYS:
valid = ", ".join(sorted(APPROACH_PROMPT_KEYS))
raise SystemExit(f"Invalid approach '{approach}'. Choose one of: {valid}")
Expand Down
Loading