Repository navigation
Commit 329a744
feat(pii_filter): OpenTelemetry trace context + gated metrics on result.metadata (#128)
* feat(pii_filter): accept extensions and read trace_id at the Rust hook boundary
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* fix(pii_filter): silence unused trace_id warning; remove misapplied stub-gen attrs
Fixes clippy -D warnings failure in handle_nested_stage and a
misapplied #[cfg_attr(feature = "stub-gen", gen_stub_pymethods)]
duplicated on 4 individual methods (already correctly applied at
the impl-block level).
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* chore: untrack docs/ and .memsearch/ accidentally swept into prior commit
The Task A1 review-fix commit staged these via a broad add; they are
unrelated to the pii_filter Rust change and were never intended to be
tracked in this commit. Files remain on disk, untracked.
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* feat(pii_filter): forward optional extensions through the Python shim
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* feat(pii_filter): emit gated counts/types metrics on result.metadata; drop context.metadata writes
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* chore(framework_bridge): bump to 0.1.2 for build_framework_object_dyn addition
Per the plan's Versioning note: adding a shared framework_bridge
helper requires bumping the crate's own version.
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* feat(pii_filter): add metric-schema contract; S1 leakage + S3 bounds tests
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* test(pii_filter): migrate remaining metadata assertions to result.metadata channel
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* chore(pii_filter): regen stubs, bump to 0.3.6, document extensions/metrics
- Update PLUGIN_CORE_CLASS_DEF hardcoded stub signatures to include optional extensions parameter
- Bump version: 0.3.5 -> 0.3.6 in Cargo.toml and plugin-manifest.yaml
- Document extensions hook parameter in README.md
- Document trace-in/metrics-out convention in repo AGENTS.md (trace context OpenTelemetry integration)
- Note: stub regeneration skipped (make stub-gen is broken by pre-existing pyo3-stub-gen/pyo3 incompatibility)
Closes #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* style(pii_filter): apply cargo fmt
Formatting-only, no behavior change. Was produced but not committed
during Task A6's fmt-check run.
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* docs(pii_filter): fix fabricated metrics schema in README/AGENTS
The prior doc commit invented per-type count keys
(detected_email_count etc.) and listed trace_id as an output field.
Neither exists in the actual build_pii_metrics implementation — the
real schema is total_detections/total_masked/detection_types/stage,
and trace_id is an input only (extensions.request.trace_id).
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* docs: record replication checklist for remaining plugins
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* docs(pii_filter): correct include_detection_details claims; add 0.3.6 migration note
include_detection_details no longer gates anything (Task A3 removed its
only consumer) -- OTel metrics on result.metadata["pii_filter"] gate
solely on extensions.request.trace_id presence, per the chosen spec.
Corrected README/detector.rs doc comments to match, and added a 0.3.6
Migration Note for the context.metadata -> result.metadata channel move.
Refs #27
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* fix(ci): close mutation-testing gaps and unblock stale CI checks
- Add a Rust unit test exercising handle_nested_stage's masked
(non-blocking) detection path end to end, killing the two mutants
cargo-mutants flagged in the OTel metadata diff: the `!detections.is_empty()`
guard around the masked-detection log call, and the push_metrics_kwarg
no-op mutant on the same path.
- Regenerate .secrets.baseline and audit the two new "Secret Keyword"
false positives (a test-fixture variable literally named `secret`)
as not-a-secret.
- Bump the RUSTSEC-2026-0176/0177 advisory-ignore expiry dates in
deny.toml; they lapsed on 2026-06-29 and were failing the repo's
time-boxed advisory-ignore test on every PR, unrelated to this change.
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* fix(pii_filter): address review feedback on PR #128
- Extract build_blocked_result to collapse duplicated blocked-path
construction in prompt_post_fetch and handle_nested_stage
- Gate push_metrics_kwarg on trace_id before sorting/collecting
detection types, so untraced requests skip the allocation;
prompt_post_fetch now accumulates a HashMap across messages
instead of pre-sorting per message
- Drop unused _context param from handle_nested_stage; callers
keep context (required by the hook signature) but mark it
unused with let _ = &context
- Clarify metrics-schema doc: prompt_post_fetch's blocked path
reports only the message that triggered the block, not the
whole payload
- Remove misleading include_detection_details=True from a test
(the field is a no-op)
Addresses non-blocking suggestions from @lucarlig's review.
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
* fix(ci): bump crossbeam-epoch to clear RUSTSEC-2026-0204
security-policy check started failing on this PR after RUSTSEC-2026-0204
was published against crossbeam-epoch 0.9.18 (invalid pointer dereference
in fmt::Pointer), pulled in transitively via criterion's rayon dev-dep
across every plugin crate. Unrelated to this PR's changes -- would have
failed on main too. cargo update -p crossbeam-epoch --precise 0.9.20
clears the advisory; verified with cargo deny check advisories.
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
---------
Signed-off-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>
Co-authored-by: Suresh Kumar Moharajan <suresh.kumar.m@ibm.com>1 parent 6819576 commit 329a744
17 files changed
Lines changed: 1530 additions & 183 deletions
File tree
- crates/framework_bridge
- src
- docs/superpowers
- contracts
- plans
- plugins
- rust/python-package/pii_filter
- cpex_pii_filter
- src
- bin
- tests
- pii_filter
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
25 | 42 | | |
26 | 43 | | |
27 | 44 | | |
| |||
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
122 | 171 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
| 8 | + | |
| 9 | + | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
0 commit comments