Skip to content

feat/masking - use normal middleware state - #136

Merged
schiwekM merged 1 commit into
feat/maskingfrom
feat/masking-changes
Sep 22, 2026
Merged

schiwekM merged 1 commit into
feat/maskingfrom
feat/masking-changes

Conversation

@Akatuoro

Copy link
Copy Markdown
Contributor

Small update to #71 ...

Instead of manually integrating into langchains graph state, we can simply use the middleware state to persist our pseudonym data.

@Akatuoro
Akatuoro requested a review from schiwekM September 21, 2026 20:30
@Akatuoro
Akatuoro requested review from a team as code owners September 21, 2026 20:30
@hyperspace-pr-bot

Copy link
Copy Markdown

Summary

The following content is AI-generated and provides a summary of the pull request:


Title: Persist pseudonymization with middleware state

Category

Refactor

Summary

This PR simplifies pseudonymization state handling by using LangChain middleware state directly instead of manually integrating pseudonym data into graph checkpoint channels.

Changes

  • Adds a middleware stateSchema for pseudonymization data:
    • per-run seed
    • hashToOriginal mapping
  • Initializes PseudoSession from middleware state in beforeAgent.
  • Persists updated pseudonymization state by returning a LangGraph Command from wrapToolCall.
  • Removes custom pseudonymization checkpoint channel handling from the checkpoint saver.
  • Simplifies PseudoSession by removing thread-based loading, caching, and graph-state lookup logic.
  • Removes the custom pseudonymization thread-id helper, since state persistence is now handled by middleware.

Impact

Pseudonym data is now persisted through the standard LangChain middleware state mechanism, reducing custom checkpointing logic and keeping masking behavior aligned with the framework’s intended state handling.

Related: #71

Have you...

  • Added relevant entry to the change log?

  • 🔄 Regenerate and Update Summary
  • ✏️ Insert as PR Description (deletes this comment)
  • 🗑️ Delete comment
PR Bot Information

Version: 1.31.43

  • Output Template: Repository PR Template
  • File Content Strategy: Full file content
  • Event Trigger: pull_request.opened
  • LLM: gpt-5.5
  • Correlation ID: 54fa8900-b5fb-11f1-9af4-14ce24118e2b
  • Summary Prompt: Default Prompt
  • GithubContextProvider: feat: masking of PII #71

@Akatuoro Akatuoro changed the title use normal middleware state feat/masking - use normal middleware state Sep 21, 2026
@schiwekM
schiwekM merged commit 3290f71 into feat/masking Sep 22, 2026
1 check failed
@schiwekM
schiwekM deleted the feat/masking-changes branch September 22, 2026 06:24
schiwekM added a commit that referenced this pull request Sep 23, 2026
* Adding DPP masking

* Fix tool tracing masking

* Prettier

* fix

* Switch to standard annotation

* Update CHANGELOG.md

* fix

* Fixes

* Adjust hash to match DPI

* Fixes

* Update schema.cds

* Fix

* Fix

* Use graph state for mappings

* Fix

* Update pseudonymization.test.js

* Better span masking

* Update agent-card.json

* Update agent-card.json

* Fix

* Fix for path expressions

* Adjust masking tag

* Correctly handle masking

* Test & fix

* fix

* Cleanup

* Better structure

* More fixes

* Handles types

* Fix for remote mcp

* use normal middleware state (#136)

* Cleanup

* Update CHANGELOG.md

* Default false for the time being

* Review

* Update bookshop.eval.test.js

* Fixes

* Lint

---------

Co-authored-by: Johannes Vogt <j.vogt@sap.com>
schiwekM added a commit that referenced this pull request Sep 23, 2026
* Adding DPP masking

* Fix tool tracing masking

* Prettier

* fix

* Switch to standard annotation

* Update CHANGELOG.md

* fix

* Pseudonymization via DPI

* Fixes

* Add HANA level pseudonymization

* Update unstructuredText-hana.js

* Update data-privacy.md

* Fix

* Fixes

* Adjust hash to match DPI

* Fixes

* Update schema.cds

* Fix

* Fix

* Use graph state for mappings

* Fix

* Update pseudonymization.test.js

* Better span masking

* Update agent-card.json

* Update agent-card.json

* Fix

* Update graph-executor.js

* Fix

* Fix for path expressions

* Adjust structure

* Adjust masking tag

* Correctly handle masking

* Test & fix

* fix

* Cleanup

* Better structure

* More fixes

* Handles types

* Fix for remote mcp

* Cleanup

* Update entities.cds

* Update package.json

* use normal middleware state (#136)

* Cleanup

* Update CHANGELOG.md

* Default false for the time being

* Review

* Cleanup

* Update bookshop.eval.test.js

* fixes

* Update dpi.js

* Fixes

* Lint

* Lint

* Fix

* Fixes

* Update hana.js

* Update hana.js

* Restructure to ensure resolving tags

* Fixes

* Fix

* Fixes

* Fixes

* Small cleanup

* Cleanup

* Cleanup state

* Update prompt-injection-shield.test.js

---------

Co-authored-by: Johannes Vogt <j.vogt@sap.com>
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.

2 participants