-
Notifications
You must be signed in to change notification settings - Fork 2
fix(storage): close acquired blob references #3816
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3eb131d
fix(storage): close acquired blob references
Sinity 7243d4b
fix(storage): align closure attachment ownership
Sinity a62fee3
fix(storage): align closure append ownership
Sinity a25704d
fix(storage): normalize duplicate message exclusions
Sinity c9b8e02
fix(storage): close append identity ownership gaps
Sinity ffd7b4b
fix(storage): preserve attachment closure identity
Sinity b72b9fe
fix(storage): close blob reference identity gaps
Sinity 775fb5c
merge: reconcile blob closure with current archive gates
Sinity 7174f41
docs(demo): refresh generated archive evidence
Sinity ba02494
merge: sync blob closure with current master
Sinity 58f53e5
fix(storage): close blob repair review gaps
Sinity 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
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
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
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
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
63 changes: 63 additions & 0 deletions
63
polylogue/cli/commands/maintenance/_blob_reference_closure.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,63 @@ | ||
| """CLI adapter for acquired blob-reference closure repair.""" | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import json | ||
| from pathlib import Path | ||
|
|
||
| import click | ||
|
|
||
| from polylogue.paths import archive_root | ||
|
|
||
|
|
||
| @click.command("blob-reference-closure") | ||
| @click.option("--apply", "apply_changes", is_flag=True, help="Apply only deterministic exact reference repairs.") | ||
| @click.option( | ||
| "--backup-manifest", | ||
| type=click.Path(dir_okay=False, path_type=Path), | ||
| default=None, | ||
| help="Verified manifest covering source.db and index.db; required with --apply.", | ||
| ) | ||
| @click.option( | ||
| "--receipt-file", | ||
| type=click.Path(dir_okay=False, path_type=Path), | ||
| default=None, | ||
| help="New immutable receipt path; required with --apply.", | ||
| ) | ||
| @click.option("--output-format", type=click.Choice(["plain", "json"]), default="plain", show_default=True) | ||
| def blob_reference_closure_command( | ||
| apply_changes: bool, | ||
| backup_manifest: Path | None, | ||
| receipt_file: Path | None, | ||
| output_format: str, | ||
| ) -> None: | ||
| """Audit closure, or repair exact refs from existing source evidence.""" | ||
| from polylogue.maintenance.blob_reference_closure import ( | ||
| BlobReferenceClosureError, | ||
| reconcile_blob_reference_closure, | ||
| ) | ||
|
|
||
| try: | ||
| report = reconcile_blob_reference_closure( | ||
| archive_root(), | ||
| backup_manifest=backup_manifest, | ||
| receipt_path=receipt_file, | ||
| dry_run=not apply_changes, | ||
| ) | ||
| except BlobReferenceClosureError as exc: | ||
| raise click.ClickException(str(exc)) from exc | ||
|
|
||
| payload = {"mode": "blob_reference_closure", **report.to_dict()} | ||
| if output_format == "json": | ||
| click.echo(json.dumps(payload, indent=2, sort_keys=True)) | ||
| return | ||
| click.echo("Blob-reference closure") | ||
| click.echo(f"Mode: {'apply' if report.applied else 'dry-run'}") | ||
| click.echo(f"Raw repair: {report.raw_repaired_count:,}") | ||
| click.echo(f"Attachment: {report.attachment_repaired_count:,}") | ||
| click.echo(f"Blockers: {len(report.plan.blockers):,}") | ||
| for blocker in report.plan.blockers: | ||
| click.echo(f" blocker [{blocker.kind.value}] {blocker.object_id}: {blocker.detail}") | ||
|
|
||
|
|
||
| __all__ = ["blob_reference_closure_command"] |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: Sinity/polylogue
Length of output: 838
🏁 Script executed:
Repository: Sinity/polylogue
Length of output: 50373
🏁 Script executed:
Repository: Sinity/polylogue
Length of output: 44447
Normalize native IDs before building message identity strings.
message_local_id()acceptsnative_id.strip()but embeds the unstrippednative_id; this helper only has call sites inmessage_id(), so normalization can live inmessage_id()/writers, butarchive_tiers_specs.pyregeneratesmessage_idfrom the storednative_idwithout stripping. Match the Python and generated SQL forms so"n:" + " msg-1 "and"n:" + "msg-1"cannot diverge.🤖 Prompt for AI Agents