worktree-controller 1.34.1__tar.gz → 1.34.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/PKG-INFO +1 -1
  2. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/pyproject.toml +1 -1
  3. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/pyproject.toml.orig +1 -1
  4. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/__init__.py +1 -1
  5. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/cli.py +6 -0
  6. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/lifecycle.py +29 -13
  7. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/record_updates.py +9 -1
  8. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/tool_cli_contract.json +2 -1
  9. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/tool_cli_contract.json +2 -1
  10. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/LICENSE +0 -0
  11. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/README.md +0 -0
  12. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/architecture.md +0 -0
  13. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/build-resources.md +0 -0
  14. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/client-integration.md +0 -0
  15. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/daily-workflow.md +0 -0
  16. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/first-change.md +0 -0
  17. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/getting-started.md +0 -0
  18. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/integration-boundaries.md +0 -0
  19. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/operations.md +0 -0
  20. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/publishing.md +0 -0
  21. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/reference.md +0 -0
  22. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/roadmap.md +0 -0
  23. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/docs/scope.md +0 -0
  24. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/examples/change_task.py +0 -0
  25. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/examples/client_continuation.py +0 -0
  26. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/examples/quickstart.py +0 -0
  27. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/activation_layout.py +0 -0
  28. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/branch_retirement.py +0 -0
  29. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/build_preservation.py +0 -0
  30. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/build_resources.py +0 -0
  31. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/canonical_refresh.py +0 -0
  32. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/canonical_transition.py +0 -0
  33. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/cleanup_attempts.py +0 -0
  34. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/cleanup_evidence.py +0 -0
  35. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/cleanup_recovery.py +0 -0
  36. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/controller.py +0 -0
  37. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/convergence.py +0 -0
  38. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/delivered_closeout.py +0 -0
  39. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/disposable.py +0 -0
  40. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/environment.py +0 -0
  41. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/frozen_recovery.py +0 -0
  42. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/git_backend.py +0 -0
  43. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/governance.py +0 -0
  44. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/hardlinks.py +0 -0
  45. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/integration_cleanup.py +0 -0
  46. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/integration_conflict.py +0 -0
  47. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/integration_retry.py +0 -0
  48. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/keyed_document_scope.py +0 -0
  49. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/lifecycle_history.py +0 -0
  50. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/lifecycle_observation.py +0 -0
  51. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/metadata_codec.py +0 -0
  52. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/metadata_relocation.py +0 -0
  53. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/models.py +0 -0
  54. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/mount_diagnostics.py +0 -0
  55. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/multiple_cleanup_recovery.py +0 -0
  56. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/namespace_migration.py +0 -0
  57. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/native_session_recovery.py +0 -0
  58. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/owner_actions.py +0 -0
  59. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/policy.py +0 -0
  60. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/preservation.py +0 -0
  61. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/preserved_cleanup.py +0 -0
  62. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/publication_execution.py +0 -0
  63. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/reconciler.py +0 -0
  64. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/recovery_guidance.py +0 -0
  65. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/registration_backfill.py +0 -0
  66. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/registration_prune.py +0 -0
  67. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/release_intents.py +0 -0
  68. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/rendering.py +0 -0
  69. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/resource_admission.py +0 -0
  70. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/retirement_adapters.py +0 -0
  71. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/retirement_execution.py +0 -0
  72. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/semantics.py +0 -0
  73. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/session.py +0 -0
  74. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/session_admission.py +0 -0
  75. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/source_cleanup.py +0 -0
  76. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/source_preservation.py +0 -0
  77. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/source_recovery.py +0 -0
  78. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/store.py +0 -0
  79. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/task_workflow.py +0 -0
  80. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/transaction_scope.py +0 -0
  81. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/writer_lease.py +0 -0
  82. {worktree_controller-1.34.1 → worktree_controller-1.34.2}/src/worktree_controller/writer_session.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: worktree-controller
3
- Version: 1.34.1
3
+ Version: 1.34.2
4
4
  Summary: Govern Git worktree budgets, authority, ownership, and lifecycle
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "worktree-controller"
7
- version = "1.34.1"
7
+ version = "1.34.2"
8
8
  description = "Govern Git worktree budgets, authority, ownership, and lifecycle"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12,<3.13"
@@ -4,7 +4,7 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "worktree-controller"
7
- version = "1.34.1"
7
+ version = "1.34.2"
8
8
  description = "Govern Git worktree budgets, authority, ownership, and lifecycle"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.12,<3.13"
@@ -1,3 +1,3 @@
1
1
  """Worktree lifecycle controller."""
2
2
 
3
- __version__ = "1.34.1"
3
+ __version__ = "1.34.2"
@@ -896,6 +896,10 @@ def build_parser() -> argparse.ArgumentParser:
896
896
  reopen_parser.add_argument("--path", type=Path, required=True)
897
897
  reopen_parser.add_argument("--expected-record-version", type=int, required=True)
898
898
  reopen_parser.add_argument("--owner", required=True)
899
+ reopen_parser.add_argument(
900
+ "--drifted-head",
901
+ help="exact observed HEAD of a frozen checkout that gained commits after its handoff",
902
+ )
899
903
 
900
904
  for recovery_command in ("recover-handoff", "recover-published"):
901
905
  recovery_parser = commands.add_parser(
@@ -1065,6 +1069,7 @@ def _main(argv: list[str] | None) -> int:
1065
1069
  "retained_typed_cleanup_version": 1,
1066
1070
  "aborted_integration_preserved_cleanup_version": 2,
1067
1071
  "aborted_integration_branch_retirement_version": 1,
1072
+ "drifted_handoff_reopen_version": 1,
1068
1073
  "terminal_preserved_cleanup_version": 1,
1069
1074
  "preservation_leaf_version": 1,
1070
1075
  "integration_publication_execution_version": 1,
@@ -1831,6 +1836,7 @@ def _main(argv: list[str] | None) -> int:
1831
1836
  target=parsed.path,
1832
1837
  expected_record_version=parsed.expected_record_version,
1833
1838
  owner=parsed.owner,
1839
+ drifted_head=parsed.drifted_head,
1834
1840
  )
1835
1841
  elif parsed.command in {"binding-add", "binding-remove", "binding-transfer"}:
1836
1842
  payload = update_external_binding(
@@ -3107,6 +3107,7 @@ def reopen(
3107
3107
  target: Path,
3108
3108
  expected_record_version: int,
3109
3109
  owner: str,
3110
+ drifted_head: str | None = None,
3110
3111
  ) -> dict[str, Any]:
3111
3112
  repository_initial = inventory(repository_path)
3112
3113
  store = MetadataStore(repository_initial.common_dir)
@@ -3139,19 +3140,33 @@ def reopen(
3139
3140
  raise ControllerError(
3140
3141
  "INTERRUPTED_TRANSACTION", "archive release transaction needs recovery"
3141
3142
  )
3142
- if not archived and (
3143
- record.handoff_commit is None
3144
- or record.task_commit is None
3145
- or record.finalizer_commit is None
3146
- or record.finalizer_record_id is None
3147
- or any(
3148
- identity != item.head
3149
- for identity in (
3150
- record.handoff_commit,
3151
- record.task_commit,
3152
- record.finalizer_commit,
3143
+ frozen_complete = (
3144
+ record.handoff_commit is not None
3145
+ and record.finalizer_record_id is not None
3146
+ and record.task_commit == record.handoff_commit
3147
+ and record.finalizer_commit == record.handoff_commit
3148
+ )
3149
+ drift_detail: dict[str, Any] | None = None
3150
+ if drifted_head is not None:
3151
+ # Commits made in a frozen checkout after its handoff: the owner names the
3152
+ # exact observed HEAD, which must strictly descend from the frozen identity.
3153
+ if archived or record.lifecycle != "HANDOFF_READY":
3154
+ raise ControllerError(
3155
+ "INVALID_LIFECYCLE", "drifted reopen requires a HANDOFF_READY allocation"
3153
3156
  )
3154
- )
3157
+ if (
3158
+ not frozen_complete
3159
+ or drifted_head != item.head
3160
+ or item.head == record.handoff_commit
3161
+ or not is_ancestor(repository.canonical_path, str(record.handoff_commit), item.head)
3162
+ ):
3163
+ raise ControllerError(
3164
+ "IDENTITY_MISMATCH",
3165
+ "drifted reopen requires the exact observed HEAD descending from the frozen handoff",
3166
+ )
3167
+ drift_detail = {"frozen_handoff_commit": record.handoff_commit, "observed_head": item.head}
3168
+ elif not archived and (
3169
+ not frozen_complete or record.handoff_commit != item.head
3155
3170
  ):
3156
3171
  raise ControllerError(
3157
3172
  "IDENTITY_MISMATCH", "reopen requires the exact frozen handoff identity"
@@ -3181,7 +3196,8 @@ def reopen(
3181
3196
  if archived
3182
3197
  else _updated_record(
3183
3198
  record,
3184
- "REOPENED",
3199
+ "REOPENED_AFTER_DRIFT" if drift_detail else "REOPENED",
3200
+ event_detail=drift_detail,
3185
3201
  lifecycle="ACTIVE",
3186
3202
  handoff_commit=None,
3187
3203
  finalizer_record_id=None,
@@ -14,7 +14,13 @@ from .models import IntegrationIntent, MetadataRecord
14
14
  from .store import now_iso
15
15
 
16
16
 
17
- def updated_record(record: MetadataRecord, event: str, **changes: Any) -> MetadataRecord:
17
+ def updated_record(
18
+ record: MetadataRecord,
19
+ event: str,
20
+ *,
21
+ event_detail: dict[str, Any] | None = None,
22
+ **changes: Any,
23
+ ) -> MetadataRecord:
18
24
  payload = record_to_dict(record)
19
25
  before = record.lifecycle
20
26
  timestamp = now_iso()
@@ -41,6 +47,8 @@ def updated_record(record: MetadataRecord, event: str, **changes: Any) -> Metada
41
47
  if len(changed) != 1:
42
48
  raise ValueError("a disposable resource event must identify exactly one transition")
43
49
  history[-1]["disposable_resource"] = dict(changed[0])
50
+ if event_detail:
51
+ history[-1].update(event_detail)
44
52
  payload["history"] = history
45
53
  return record_from_dict(payload)
46
54
 
@@ -1087,7 +1087,7 @@
1087
1087
  "session_launcher_entrypoint": "worktree-session",
1088
1088
  "session_entrypoint": "worktree-session-end",
1089
1089
  "tool_name": "worktree-controller",
1090
- "tool_version": "1.34.1",
1090
+ "tool_version": "1.34.2",
1091
1091
  "delivered_closeout_version": 1,
1092
1092
  "retained_archive_version": 1,
1093
1093
  "retention_convergence_version": 2,
@@ -1541,6 +1541,7 @@
1541
1541
  "retained_typed_cleanup_version": 1,
1542
1542
  "aborted_integration_preserved_cleanup_version": 2,
1543
1543
  "aborted_integration_branch_retirement_version": 1,
1544
+ "drifted_handoff_reopen_version": 1,
1544
1545
  "aborted_integration_preserved_cleanup_contract": {
1545
1546
  "contract": "aborted-integration-preserved-cleanup/v1",
1546
1547
  "entrypoints": ["integration-abort", "python -m worktree_controller.preservation", "resource-clean --typed", "release", "integration-claim"],
@@ -1087,7 +1087,7 @@
1087
1087
  "session_launcher_entrypoint": "worktree-session",
1088
1088
  "session_entrypoint": "worktree-session-end",
1089
1089
  "tool_name": "worktree-controller",
1090
- "tool_version": "1.34.1",
1090
+ "tool_version": "1.34.2",
1091
1091
  "delivered_closeout_version": 1,
1092
1092
  "retained_archive_version": 1,
1093
1093
  "retention_convergence_version": 2,
@@ -1541,6 +1541,7 @@
1541
1541
  "retained_typed_cleanup_version": 1,
1542
1542
  "aborted_integration_preserved_cleanup_version": 2,
1543
1543
  "aborted_integration_branch_retirement_version": 1,
1544
+ "drifted_handoff_reopen_version": 1,
1544
1545
  "aborted_integration_preserved_cleanup_contract": {
1545
1546
  "contract": "aborted-integration-preserved-cleanup/v1",
1546
1547
  "entrypoints": ["integration-abort", "python -m worktree_controller.preservation", "resource-clean --typed", "release", "integration-claim"],