-
Notifications
You must be signed in to change notification settings - Fork 1
feat(data): add bounded tenant provenance portability #1497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
seonghobae
wants to merge
42
commits into
codex/pdf-dom-upload-64m
Choose a base branch
from
feat/tenant-provenance-roundtrip
base: codex/pdf-dom-upload-64m
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
c1e0cd5
feat: add deterministic provenance archive envelope
seonghobae 55da6e2
fix: harden provenance archive validation
seonghobae dfc2caf
fix: enforce provenance archive profile bounds
seonghobae 80f2fe3
fix: reject provenance archive interior gaps
seonghobae 3fd36a5
feat: round trip tenant provenance closure
seonghobae 236423f
fix: preserve provenance citation closure
seonghobae 67be568
fix: harden provenance bundle validation
seonghobae 832798e
fix: classify compound provenance secrets
seonghobae 9d78942
fix: tokenize provenance metadata keys
seonghobae aca3f3a
feat(data): add signed provenance bundle API
seonghobae b848a39
fix(data): require authoritative provenance scope
seonghobae e1c9978
test: align bootstrap smoke with current schema
seonghobae 7a19950
docs: record bounded provenance portability slice
seonghobae 1809fc6
fix: skip legacy email index on fresh bootstrap
seonghobae eaade6e
docs: record fresh bootstrap verification
seonghobae 63ec9f3
fix(provenance): scope portable identity mappings
seonghobae 7576977
fix(provenance): harden scoped identity imports
seonghobae 4fbac3d
fix(provenance): preserve untyped metadata strings
seonghobae 73f1740
fix(provenance): require verified archive membership
seonghobae 092e393
fix(provenance): export mixed identity origins
seonghobae 9da29fd
fix(provenance): reject foreign segment citations
seonghobae 4bd6589
fix(provenance): compose import transactions
seonghobae 26c8513
fix(provenance): bind citations to selected records
seonghobae 176540c
fix(provenance): allow anchored segment edges
seonghobae c53703a
fix(provenance): serialize shared email imports
seonghobae 4b3ae1a
fix: validate imported provenance citation anchors
seonghobae 03de223
fix(provenance): lock overlapping email imports
seonghobae d855dc7
fix: require canonical provenance timestamps
seonghobae 42795bd
fix(provenance): reuse complete identity mappings
seonghobae fe0ad99
fix: canonicalize provenance activity timestamps
seonghobae 66443a9
fix(provenance): remap typed edge endpoints
seonghobae 473ab32
fix(provenance): validate nullable edge endpoints
seonghobae 8ae8bd5
fix: bind provenance bundle identities to content
seonghobae c7ca74d
fix(provenance): bound export row loading
seonghobae 053b406
fix(provenance): preserve portable import origins
seonghobae 69ab128
fix(provenance): serialize portable identity imports
seonghobae 0034213
fix(data): preserve incremental provenance imports
seonghobae e2968cd
test(db): fail on post-connect backfill errors
seonghobae 152d199
test(db): dispose pool after close failures
seonghobae 705d8ec
Merge branch 'codex/pdf-dom-upload-64m' of https://github.com/Context…
seonghobae 7ee6e68
fix(provenance): integrate owner migrations and retain restore identi…
seonghobae 69f50ae
fix(provenance): integrate full-document storage without losing ident…
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
59 changes: 59 additions & 0 deletions
59
backend/alembic/versions/0018_provenance_identity_mappings.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| """Add scoped portable-to-database provenance identity mappings.""" | ||
|
|
||
| from alembic import op | ||
| import sqlalchemy as sa | ||
|
|
||
|
|
||
| revision = "0018_provenance_identity" | ||
| down_revision = "0017_merge_newsdom_carddav_heads" | ||
| branch_labels = None | ||
| depends_on = None | ||
| _MAPPING_TABLE = "provenance_identity_mappings" | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| inspector = sa.inspect(op.get_bind()) | ||
| if not inspector.has_table(_MAPPING_TABLE): | ||
| op.create_table( | ||
| _MAPPING_TABLE, | ||
| sa.Column("provenance_identity_id", sa.Integer(), primary_key=True), | ||
| sa.Column("target_user_id", sa.String(), nullable=False), | ||
| sa.Column("target_organization_id", sa.String(), nullable=False), | ||
| sa.Column("target_workspace_id", sa.String(), nullable=False), | ||
| sa.Column("source_user_uid", sa.String(length=64), nullable=False), | ||
| sa.Column("source_organization_uid", sa.String(), nullable=False), | ||
| sa.Column("source_workspace_uid", sa.String(), nullable=False), | ||
| sa.Column("entity_kind", sa.String(length=64), nullable=False), | ||
| sa.Column("portable_uid", sa.String(length=256), nullable=False), | ||
| sa.Column("target_database_uid", sa.String(length=96), nullable=False), | ||
| sa.UniqueConstraint( | ||
| "target_user_id", | ||
| "target_organization_id", | ||
| "target_workspace_id", | ||
| "source_user_uid", | ||
| "source_organization_uid", | ||
| "source_workspace_uid", | ||
| "entity_kind", | ||
| "portable_uid", | ||
| name="uq_provenance_identity_source_target", | ||
| ), | ||
| sa.UniqueConstraint( | ||
| "entity_kind", | ||
| "target_database_uid", | ||
| name="uq_provenance_identity_target_uid", | ||
| ), | ||
| ) | ||
| op.create_index( | ||
| "ix_provenance_identity_target_scope", | ||
| _MAPPING_TABLE, | ||
| ["target_user_id", "target_organization_id", "target_workspace_id"], | ||
| if_not_exists=True, | ||
| ) | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| """Preserve imported identity mappings when application code is rolled back.""" | ||
| # The table may predate this revision via 0001's live metadata bootstrap. | ||
| # Its portable identity history is not rebuildable from remapped records. | ||
| # Destructive retirement requires a separate, explicitly governed operation. | ||
| return None | ||
16 changes: 16 additions & 0 deletions
16
backend/alembic/versions/0021_merge_provenance_workspace.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| """Join provenance identity and workspace repair histories without rewriting either.""" | ||
|
|
||
| revision = "0021_merge_provenance_workspace" | ||
| down_revision = ("0018_provenance_identity", "0020_search_trigram_storage") | ||
| branch_labels = None | ||
| depends_on = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| """Require both existing branches before recording the unified head.""" | ||
| return None | ||
|
|
||
|
|
||
| def downgrade() -> None: | ||
| """Reopen the two revision heads without changing customer records.""" | ||
| return None |
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.