Skip to content

feat(sequencer): middleware.pii_mask op and boundary stack (#58) - #90

Merged
rosspeili merged 1 commit into
ARPAHLS:mainfrom
rosspeili:feat/issue-58-sequencer-pii-mask
Oct 11, 2026
Merged

rosspeili merged 1 commit into
ARPAHLS:mainfrom
rosspeili:feat/issue-58-sequencer-pii-mask

Conversation

@rosspeili

Copy link
Copy Markdown
Contributor

Description

Implements issue #58: sequencer middleware stack and middleware.pii_mask operation for automated data sanitization across agent execution pipelines.

Key Capabilities

  • Two-Tier Engine:
    • Tier 1 (Zero-dependency stdlib): High-throughput regex + algorithmic validation including Credit Card Luhn checksum verification, RFC 5322 emails, global international phones (E.164, UK/EU with trunk prefixes, compact format, NANP), SSNs, IPv4/IPv6, API keys/JWTs/UUIDs, and IBANs.
    • Tier 2 (Pluggable Provider Protocol): Protocol PiiMaskerProvider and callable functions for contextual NER models (Skillware NER, ARPA micro-f1-mask 270M, Presidio) with configurable on_error fault-tolerance (fallback, fail, pass).
  • Masking Strategies: redact (default, e.g. [EMAIL]), mask (partial obfuscation retaining operational shape & country code), and pseudonymize / tokenize (deterministic session-scoped pseudonym tokens <EMAIL_REF_...> preserving entity equivalence across multi-step agent reasoning).
  • Sequencer Integration: Both discrete step ops (type: op, ref: middleware.pii_mask) and step boundary interceptors (MiddlewarePolicy / MiddlewareStack at scope: per_step, inbound/outbound). Strict mode (strict: true) raises ConstraintViolation on detection.
  • Audit Spine & Telemetry: Emits middleware.applied containing detection metrics only (strictly zero raw PII on the spine). Audit report populates scorecard.middleware = {applied, pii_redactions} and surfaces the PII_MASKED finding (severity: info).
  • Runnable Example: Added examples/15-sequencer-pii-mask/ demonstrating step op sanitization and audit receipt generation.

Type

  • Bug fix
  • Core framework — session, spine, constraints, identity, audit report
  • CLI
  • Integration — sequencer, hosts, membrane, observers, exporters
  • Documentation
  • Examples
  • Packaging / CI

Checklist

  • Linked issue (Fixes #58)
  • pytest passes (284/284 passed in 47s)
  • black aura tests scripts examples — no diff (133 files unchanged)
  • flake8 aura tests scripts examples — clean (0 warnings)
  • CHANGELOG.md updated under [Unreleased] -> Added
  • Dedicated stress simulation (scripts/aura_pii_stress_sim.py) passing 5/5 scenarios

Test plan

  • pytest tests/test_sequencer_pii_mask.py tests/test_pii_stress_sim.py -v: 29 passed.
  • python scripts/aura_pii_stress_sim.py: 2,000 entities across deep trees sanitized in 26.8ms.
  • python examples/15-sequencer-pii-mask/main.py: verified pseudonymization and audit report scorecard/findings.
  • pytest: 284 passed in 47.54s (zero regressions).

- Introduce two-tier PII sanitization engine:
  - Tier 1 zero-dependency stdlib regex with algorithmic Luhn check for credit cards, RFC emails, global international phones (E.164, UK/EU, NANP, compact format), SSNs, IPv4/IPv6, API keys/JWTs/UUIDs, and IBAN.
  - Tier 2 pluggable PiiMaskerProvider protocol and callable support for contextual NER models (Skillware, micro-f1-mask, Presidio) with configurable on_error fault-tolerance (fallback, fail, pass).
- Support masking strategies: redact, mask (preserving country codes), and pseudonymize/tokenize with deterministic session-scoped tokens.
- Add SequencerRunner op middleware.pii_mask and MiddlewareStack per_step boundary interception (inbound/outbound) with strict mode.
- Emit middleware.applied on audit spine with zero raw PII leakage.
- Integrate audit report scorecard (scorecard.middleware) and surface PII_MASKED finding (severity: info).
- Add Example 15 (examples/15-sequencer-pii-mask/), stress simulation (scripts/aura_pii_stress_sim.py), 29 dedicated tests, and documentation.
@rosspeili
rosspeili merged commit 0e1a96f into ARPAHLS:main Oct 11, 2026
6 checks passed
@rosspeili
rosspeili deleted the feat/issue-58-sequencer-pii-mask branch October 11, 2026 16:19
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.

1 participant