Skip to content

feat(adversary): support dict-style atomic_ordering steps with per-step metadata#3315

Open
deacon-mp wants to merge 17 commits into
masterfrom
feat/new-adversary-step-metadata
Open

feat(adversary): support dict-style atomic_ordering steps with per-step metadata#3315
deacon-mp wants to merge 17 commits into
masterfrom
feat/new-adversary-step-metadata

Conversation

@deacon-mp
Copy link
Copy Markdown
Contributor

Summary

  • Extends adversary atomic_ordering to accept dict entries of the form {ability_id, metadata: {executor_facts: {<platform>: [...]}}} alongside legacy plain-string ability IDs.
  • PlanningService extracts per-step executor_facts keyed by platform and injects them into link commands before execution, replacing #{trait} placeholders.
  • LogicalPlanner (atomic) selects the next link by step_idx first, then falls back to ability_id matching for backward compatibility with string-only profiles.
  • AdversarySchema now accepts ma.fields.Raw() entries in atomic_ordering so both strings and dicts pass validation.
  • update_adversary (PATCH) reads the raw JSON body directly before apispec processing to prevent atomic_ordering dicts from being stripped.
  • Cleaned up: removed debug print(), emoji-style comments (, 🧠), large commented-out post_load block, and sample AdversarySCHEMA.yml from repo root.
  • Config files (conf/default.yml, conf/agents.yml, conf/payloads.yml) restored to master defaults.

Test plan

  • tests/objects/test_adversary.py — 8 new TestAdversaryDictSteps cases: init, verify(), check_repeatable_abilities(), schema load/roundtrip, store() — all pass
  • tests/planners/test_atomic.py — 6 new TestAtomicDictSteps cases: step_idx selection, ordering fallback, full atomic() run — all pass
  • Existing TestAdversary (5) and TestAtomic (3) tests continue to pass (22 total, 0 failures)
  • Manual: create an adversary with dict-style steps via the API and verify facts are injected into the link command at runtime

David Hunt and others added 17 commits July 24, 2025 18:14
* updating submodule

* updating abilities
…ed per-step metadata

Allow adversary profiles to specify atomic_ordering entries as dicts
containing an ability_id plus a metadata block (e.g. executor_facts
keyed by platform).  Planning resolves facts from the embedded metadata
and injects them before building links; the atomic planner selects the
next link by step_idx first, then falls back to ability_id matching for
legacy string-only profiles.

Clean up debug artefacts: remove large commented-out post_load block,
drop debug print() from atomic planner, remove emoji comments from
base_api_manager, delete sample AdversarySCHEMA.yml from repo root, and
restore conf/ files to master defaults.

Add unit tests covering dict-step init, schema round-trip, verify(),
check_repeatable_abilities(), store(), and atomic planner step_idx /
fallback selection.
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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.

3 participants