[DRAFT] Persist identifiers in DB#2164
Draft
behnam-o wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
This is phase 7 of this proposal: PyRIT Unified Registry — Design & Rationale
this draft uses TargetIdentifier and their relationship with Conversation as example, if we concensus on the pattern, this will be extended to all identifiers.
Target identifiers weren't persisted as first-class, queryable data. Their configuration (endpoint, model, sampling params) and their composition (multi-targets wrapping inner targets) were only available inline, with no deduplication and no way to query across them.
Solution
Persist
TargetIdentifiers as content-addressed rows keyed by their content hash, so an identical identifier reused across many conversations maps to a single immutable row.Mechanisms:
identifier_json) is the immutable source of truth; frequently-queried fields are surfaced as denormalized columns (indexes into the blob, not a second source of truth).from_domain_modelseam — a uniform, per-entry converter defining how a domain model becomes a row, enforced on concrete subclasses at class-definition time.Why draft
Raising as a draft to validate the pattern (
DomainBackedEntry+ content-addressed store + recursive child graph) on target identifiers first. If it looks good, the same approach extends cleanly to the other identifier types.