paper_trail_diff 0.16.0 → 0.17.1

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 (206) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +581 -1
  3. data/README.md +42 -7
  4. data/docs/architecture.md +7 -5
  5. data/docs/performance.md +86 -38
  6. data/docs/reference.md +309 -92
  7. data/docs/testing.md +240 -32
  8. data/lib/paper_trail_diff/activity_belongs_to_event_applier.rb +2 -16
  9. data/lib/paper_trail_diff/activity_boundary.rb +55 -34
  10. data/lib/paper_trail_diff/activity_child_candidate_loader.rb +46 -57
  11. data/lib/paper_trail_diff/activity_collection_event_applier.rb +3 -13
  12. data/lib/paper_trail_diff/activity_collection_route_updater.rb +1 -1
  13. data/lib/paper_trail_diff/activity_event.rb +33 -21
  14. data/lib/paper_trail_diff/activity_event_record_resolver.rb +16 -116
  15. data/lib/paper_trail_diff/activity_event_route_finder.rb +29 -29
  16. data/lib/paper_trail_diff/activity_event_snapshot_refresher.rb +2 -7
  17. data/lib/paper_trail_diff/activity_history.rb +90 -49
  18. data/lib/paper_trail_diff/activity_range.rb +9 -35
  19. data/lib/paper_trail_diff/activity_root_snapshot_refresher.rb +74 -40
  20. data/lib/paper_trail_diff/activity_root_steps.rb +10 -13
  21. data/lib/paper_trail_diff/activity_scope_filter.rb +77 -0
  22. data/lib/paper_trail_diff/activity_snapshot_delta.rb +12 -15
  23. data/lib/paper_trail_diff/activity_snapshot_sequence.rb +37 -15
  24. data/lib/paper_trail_diff/activity_target_candidate_loader.rb +35 -43
  25. data/lib/paper_trail_diff/activity_timeline_builder.rb +194 -249
  26. data/lib/paper_trail_diff/activity_transaction_grouper.rb +3 -1
  27. data/lib/paper_trail_diff/activity_tree_filter.rb +54 -13
  28. data/lib/paper_trail_diff/activity_version_collector.rb +72 -138
  29. data/lib/paper_trail_diff/activity_view.rb +22 -11
  30. data/lib/paper_trail_diff/analysis.rb +19 -5
  31. data/lib/paper_trail_diff/analysis_batch.rb +16 -58
  32. data/lib/paper_trail_diff/approximate_paths.rb +4 -8
  33. data/lib/paper_trail_diff/association_activity_edge.rb +5 -24
  34. data/lib/paper_trail_diff/association_activity_selection.rb +10 -18
  35. data/lib/paper_trail_diff/association_discovery.rb +1 -6
  36. data/lib/paper_trail_diff/association_key.rb +9 -6
  37. data/lib/paper_trail_diff/association_traversal.rb +49 -6
  38. data/lib/paper_trail_diff/batch_boundary_resolver.rb +33 -42
  39. data/lib/paper_trail_diff/batch_preload.rb +2 -12
  40. data/lib/paper_trail_diff/batched_root_analyses.rb +72 -0
  41. data/lib/paper_trail_diff/batched_root_analyzer.rb +16 -14
  42. data/lib/paper_trail_diff/batched_root_versions.rb +25 -20
  43. data/lib/paper_trail_diff/branch_snapshot_refresher.rb +27 -31
  44. data/lib/paper_trail_diff/change_attribution.rb +329 -0
  45. data/lib/paper_trail_diff/change_row.rb +30 -10
  46. data/lib/paper_trail_diff/comparison_batch.rb +3 -4
  47. data/lib/paper_trail_diff/configuration.rb +1 -1
  48. data/lib/paper_trail_diff/deleted_analysis_batch.rb +22 -37
  49. data/lib/paper_trail_diff/deleted_root_filter.rb +3 -6
  50. data/lib/paper_trail_diff/deprecation.rb +4 -43
  51. data/lib/paper_trail_diff/diagnostics.rb +1 -2
  52. data/lib/paper_trail_diff/direct_record_state_loader.rb +8 -1
  53. data/lib/paper_trail_diff/endpoint.rb +78 -44
  54. data/lib/paper_trail_diff/errors.rb +2 -9
  55. data/lib/paper_trail_diff/fallback_paths.rb +2 -5
  56. data/lib/paper_trail_diff/habtm_transaction_owners.rb +5 -3
  57. data/lib/paper_trail_diff/historical_association_reifier.rb +3 -1
  58. data/lib/paper_trail_diff/historical_filter.rb +40 -15
  59. data/lib/paper_trail_diff/historical_snapshot_store.rb +80 -38
  60. data/lib/paper_trail_diff/instrumentation.rb +0 -8
  61. data/lib/paper_trail_diff/live_endpoint_batch_loader.rb +11 -7
  62. data/lib/paper_trail_diff/live_endpoint_provider.rb +7 -23
  63. data/lib/paper_trail_diff/live_graph_collector.rb +3 -3
  64. data/lib/paper_trail_diff/nested_comparator.rb +46 -19
  65. data/lib/paper_trail_diff/net_change.rb +276 -0
  66. data/lib/paper_trail_diff/own_window.rb +35 -0
  67. data/lib/paper_trail_diff/paper_trail_adapter.rb +40 -45
  68. data/lib/paper_trail_diff/prepared_activity_index.rb +197 -45
  69. data/lib/paper_trail_diff/prepared_child_candidates.rb +58 -0
  70. data/lib/paper_trail_diff/prepared_edge_loader.rb +43 -107
  71. data/lib/paper_trail_diff/prepared_history.rb +20 -31
  72. data/lib/paper_trail_diff/prepared_history_loader.rb +46 -9
  73. data/lib/paper_trail_diff/prepared_record_index.rb +137 -47
  74. data/lib/paper_trail_diff/prepared_snapshot_builder.rb +16 -0
  75. data/lib/paper_trail_diff/prepared_state_association_reader.rb +17 -19
  76. data/lib/paper_trail_diff/read_snapshot.rb +41 -19
  77. data/lib/paper_trail_diff/recorded_changes.rb +10 -11
  78. data/lib/paper_trail_diff/recorded_changes_reader.rb +60 -0
  79. data/lib/paper_trail_diff/recorded_class.rb +14 -19
  80. data/lib/paper_trail_diff/recorded_columns.rb +33 -0
  81. data/lib/paper_trail_diff/root_version_plan.rb +20 -22
  82. data/lib/paper_trail_diff/root_version_selection.rb +39 -29
  83. data/lib/paper_trail_diff/scope_condition.rb +7 -17
  84. data/lib/paper_trail_diff/scope_ranking.rb +16 -22
  85. data/lib/paper_trail_diff/scoped_analysis.rb +27 -4
  86. data/lib/paper_trail_diff/scoped_analysis_builder.rb +4 -3
  87. data/lib/paper_trail_diff/scoped_root_selection.rb +60 -41
  88. data/lib/paper_trail_diff/snapshot_normalizer.rb +18 -3
  89. data/lib/paper_trail_diff/stored_json_values.rb +52 -0
  90. data/lib/paper_trail_diff/stored_time_precision.rb +30 -18
  91. data/lib/paper_trail_diff/stored_values.rb +20 -0
  92. data/lib/paper_trail_diff/support.rb +185 -35
  93. data/lib/paper_trail_diff/time_of_day.rb +39 -0
  94. data/lib/paper_trail_diff/time_range.rb +37 -20
  95. data/lib/paper_trail_diff/time_version_range.rb +5 -10
  96. data/lib/paper_trail_diff/timeline_builder.rb +3 -3
  97. data/lib/paper_trail_diff/timeline_range.rb +18 -12
  98. data/lib/paper_trail_diff/timeline_snapshot_provider.rb +1 -1
  99. data/lib/paper_trail_diff/total_order.rb +55 -0
  100. data/lib/paper_trail_diff/transaction_cut.rb +192 -91
  101. data/lib/paper_trail_diff/traversal_preparer.rb +5 -8
  102. data/lib/paper_trail_diff/value_objects.rb +8 -4
  103. data/lib/paper_trail_diff/version.rb +1 -1
  104. data/lib/paper_trail_diff/version_association_candidate_scope.rb +27 -16
  105. data/lib/paper_trail_diff/version_boundary.rb +37 -21
  106. data/lib/paper_trail_diff/version_query.rb +25 -25
  107. data/lib/paper_trail_diff/version_range.rb +12 -16
  108. data/lib/paper_trail_diff/version_sequence_diagnostics.rb +32 -0
  109. data/lib/paper_trail_diff/version_table.rb +12 -8
  110. data/lib/paper_trail_diff.rb +28 -42
  111. data/sig/generated/paper_trail_diff/activity_belongs_to_event_applier.rbs +0 -8
  112. data/sig/generated/paper_trail_diff/activity_boundary.rbs +39 -17
  113. data/sig/generated/paper_trail_diff/activity_child_candidate_loader.rbs +19 -22
  114. data/sig/generated/paper_trail_diff/activity_collection_event_applier.rbs +0 -5
  115. data/sig/generated/paper_trail_diff/activity_event.rbs +25 -9
  116. data/sig/generated/paper_trail_diff/activity_event_record_resolver.rbs +6 -34
  117. data/sig/generated/paper_trail_diff/activity_event_route_finder.rbs +11 -4
  118. data/sig/generated/paper_trail_diff/activity_event_snapshot_refresher.rbs +0 -3
  119. data/sig/generated/paper_trail_diff/activity_history.rbs +54 -19
  120. data/sig/generated/paper_trail_diff/activity_range.rbs +6 -20
  121. data/sig/generated/paper_trail_diff/activity_root_snapshot_refresher.rbs +36 -2
  122. data/sig/generated/paper_trail_diff/activity_root_steps.rbs +6 -6
  123. data/sig/generated/paper_trail_diff/activity_scope_filter.rbs +51 -0
  124. data/sig/generated/paper_trail_diff/activity_snapshot_delta.rbs +5 -3
  125. data/sig/generated/paper_trail_diff/activity_snapshot_sequence.rbs +21 -3
  126. data/sig/generated/paper_trail_diff/activity_target_candidate_loader.rbs +19 -24
  127. data/sig/generated/paper_trail_diff/activity_timeline_builder.rbs +121 -127
  128. data/sig/generated/paper_trail_diff/activity_tree_filter.rbs +41 -8
  129. data/sig/generated/paper_trail_diff/activity_version_collector.rbs +42 -35
  130. data/sig/generated/paper_trail_diff/activity_view.rbs +16 -8
  131. data/sig/generated/paper_trail_diff/analysis.rbs +15 -6
  132. data/sig/generated/paper_trail_diff/analysis_batch.rbs +6 -24
  133. data/sig/generated/paper_trail_diff/association_activity_edge.rbs +0 -13
  134. data/sig/generated/paper_trail_diff/association_activity_selection.rbs +6 -9
  135. data/sig/generated/paper_trail_diff/association_discovery.rbs +0 -3
  136. data/sig/generated/paper_trail_diff/association_key.rbs +5 -0
  137. data/sig/generated/paper_trail_diff/association_traversal.rbs +26 -2
  138. data/sig/generated/paper_trail_diff/batch_boundary_resolver.rbs +17 -17
  139. data/sig/generated/paper_trail_diff/batch_preload.rbs +0 -4
  140. data/sig/generated/paper_trail_diff/batched_root_analyses.rbs +47 -0
  141. data/sig/generated/paper_trail_diff/batched_root_analyzer.rbs +9 -8
  142. data/sig/generated/paper_trail_diff/batched_root_versions.rbs +10 -6
  143. data/sig/generated/paper_trail_diff/branch_snapshot_refresher.rbs +11 -5
  144. data/sig/generated/paper_trail_diff/change_attribution.rbs +194 -0
  145. data/sig/generated/paper_trail_diff/change_row.rbs +22 -7
  146. data/sig/generated/paper_trail_diff/deleted_analysis_batch.rbs +11 -12
  147. data/sig/generated/paper_trail_diff/deleted_root_filter.rbs +0 -2
  148. data/sig/generated/paper_trail_diff/deprecation.rbs +4 -24
  149. data/sig/generated/paper_trail_diff/direct_record_state_loader.rbs +4 -0
  150. data/sig/generated/paper_trail_diff/endpoint.rbs +40 -16
  151. data/sig/generated/paper_trail_diff/errors.rbs +2 -11
  152. data/sig/generated/paper_trail_diff/habtm_transaction_owners.rbs +2 -1
  153. data/sig/generated/paper_trail_diff/historical_filter.rbs +20 -9
  154. data/sig/generated/paper_trail_diff/historical_snapshot_store.rbs +40 -10
  155. data/sig/generated/paper_trail_diff/instrumentation.rbs +0 -3
  156. data/sig/generated/paper_trail_diff/live_endpoint_batch_loader.rbs +3 -0
  157. data/sig/generated/paper_trail_diff/live_endpoint_provider.rbs +5 -8
  158. data/sig/generated/paper_trail_diff/live_graph_collector.rbs +2 -2
  159. data/sig/generated/paper_trail_diff/nested_comparator.rbs +20 -4
  160. data/sig/generated/paper_trail_diff/net_change.rbs +168 -0
  161. data/sig/generated/paper_trail_diff/own_window.rbs +22 -0
  162. data/sig/generated/paper_trail_diff/paper_trail_adapter.rbs +9 -6
  163. data/sig/generated/paper_trail_diff/prepared_activity_index.rbs +114 -14
  164. data/sig/generated/paper_trail_diff/prepared_child_candidates.rbs +39 -0
  165. data/sig/generated/paper_trail_diff/prepared_edge_loader.rbs +18 -35
  166. data/sig/generated/paper_trail_diff/prepared_history.rbs +9 -12
  167. data/sig/generated/paper_trail_diff/prepared_history_loader.rbs +28 -3
  168. data/sig/generated/paper_trail_diff/prepared_record_index.rbs +68 -14
  169. data/sig/generated/paper_trail_diff/prepared_snapshot_builder.rbs +12 -0
  170. data/sig/generated/paper_trail_diff/prepared_state_association_reader.rbs +6 -7
  171. data/sig/generated/paper_trail_diff/read_snapshot.rbs +27 -8
  172. data/sig/generated/paper_trail_diff/recorded_changes.rbs +4 -2
  173. data/sig/generated/paper_trail_diff/recorded_changes_reader.rbs +41 -0
  174. data/sig/generated/paper_trail_diff/recorded_class.rbs +7 -6
  175. data/sig/generated/paper_trail_diff/recorded_columns.rbs +21 -0
  176. data/sig/generated/paper_trail_diff/root_version_plan.rbs +8 -4
  177. data/sig/generated/paper_trail_diff/root_version_selection.rbs +27 -13
  178. data/sig/generated/paper_trail_diff/scope_condition.rbs +0 -2
  179. data/sig/generated/paper_trail_diff/scope_ranking.rbs +10 -10
  180. data/sig/generated/paper_trail_diff/scoped_analysis.rbs +19 -0
  181. data/sig/generated/paper_trail_diff/scoped_analysis_builder.rbs +2 -2
  182. data/sig/generated/paper_trail_diff/scoped_root_selection.rbs +37 -14
  183. data/sig/generated/paper_trail_diff/snapshot_normalizer.rbs +7 -0
  184. data/sig/generated/paper_trail_diff/stored_json_values.rbs +35 -0
  185. data/sig/generated/paper_trail_diff/stored_time_precision.rbs +19 -5
  186. data/sig/generated/paper_trail_diff/stored_values.rbs +13 -0
  187. data/sig/generated/paper_trail_diff/support.rbs +120 -23
  188. data/sig/generated/paper_trail_diff/time_of_day.rbs +21 -0
  189. data/sig/generated/paper_trail_diff/time_range.rbs +15 -8
  190. data/sig/generated/paper_trail_diff/time_version_range.rbs +2 -5
  191. data/sig/generated/paper_trail_diff/timeline_builder.rbs +2 -2
  192. data/sig/generated/paper_trail_diff/timeline_range.rbs +12 -7
  193. data/sig/generated/paper_trail_diff/total_order.rbs +32 -0
  194. data/sig/generated/paper_trail_diff/transaction_cut.rbs +111 -52
  195. data/sig/generated/paper_trail_diff/traversal_preparer.rbs +2 -2
  196. data/sig/generated/paper_trail_diff/value_objects.rbs +5 -1
  197. data/sig/generated/paper_trail_diff/version_association_candidate_scope.rbs +10 -9
  198. data/sig/generated/paper_trail_diff/version_boundary.rbs +15 -8
  199. data/sig/generated/paper_trail_diff/version_query.rbs +17 -10
  200. data/sig/generated/paper_trail_diff/version_range.rbs +6 -9
  201. data/sig/generated/paper_trail_diff/version_sequence_diagnostics.rbs +13 -0
  202. data/sig/generated/paper_trail_diff/version_table.rbs +3 -0
  203. data/sig/generated/paper_trail_diff.rbs +16 -16
  204. metadata +28 -6
  205. data/lib/paper_trail_diff/preloaded_endpoint_batch_loader.rb +0 -60
  206. data/sig/generated/paper_trail_diff/preloaded_endpoint_batch_loader.rbs +0 -32
@@ -1,15 +1,17 @@
1
1
  # Generated from lib/paper_trail_diff/time_range.rb with RBS::Inline
2
2
 
3
3
  module PaperTrailDiff
4
- # Validates and applies a finite wall-clock range without loading model state.
4
+ # Validates and applies a wall-clock range without loading model state.
5
5
  #
6
6
  # A Date is a whole day and a String a local time, both in Time.zone, as
7
7
  # Rails reads them, or in UTC without one: never the server's own zone. An
8
- # inclusive Date end runs through that day.
8
+ # inclusive Date end runs through that day. An endless range has no end:
9
+ # it runs through every version saved since it began, whatever the clock
10
+ # that dated them read, as a report through the current state does.
9
11
  class TimeRange
10
12
  attr_reader begin_time: Time
11
13
 
12
- attr_reader end_time: Time
14
+ attr_reader end_time: Time?
13
15
 
14
16
  # : (untyped) -> void
15
17
  def initialize: (untyped) -> void
@@ -23,10 +25,12 @@ module PaperTrailDiff
23
25
  # : (untyped) -> untyped
24
26
  def scope: (untyped) -> untyped
25
27
 
26
- # The window as a Ruby range, its end included or left out as given.
27
- # : () -> Range[Time]
28
- def to_range: () -> Range[Time]
28
+ # The window as a Ruby range, its end included or left out as given, or
29
+ # endless.
30
+ # : () -> Range[Time?]
31
+ def to_range: () -> Range[Time?]
29
32
 
33
+ # The versions after the window; none follows an endless one.
30
34
  # : (untyped) -> untyped
31
35
  def trailing_scope: (untyped) -> untyped
32
36
 
@@ -40,8 +44,11 @@ module PaperTrailDiff
40
44
 
41
45
  @exclude_end: bool
42
46
 
43
- # : (untyped) -> untyped
44
- def after_end: (untyped) -> untyped
47
+ # : (untyped, Time) -> untyped
48
+ def after: (untyped, Time) -> untyped
49
+
50
+ # : (untyped, Time) -> untyped
51
+ def after_end: (untyped, Time) -> untyped
45
52
 
46
53
  # : (untyped, boundary: Symbol) -> Time
47
54
  def coerce_time: (untyped, boundary: Symbol) -> Time
@@ -6,8 +6,8 @@ module PaperTrailDiff
6
6
  # : (untyped, time_range: TimeRange, version_scope: untyped, live_endpoint: untyped) -> void
7
7
  def initialize: (untyped, time_range: TimeRange, version_scope: untyped, live_endpoint: untyped) -> void
8
8
 
9
- # : (context_required: bool) -> RootVersionPlan
10
- def select_plan: (context_required: bool) -> RootVersionPlan
9
+ # : (context_required: bool, whole: bool) -> RootVersionPlan
10
+ def select_plan: (context_required: bool, whole: bool) -> RootVersionPlan
11
11
 
12
12
  private
13
13
 
@@ -21,8 +21,5 @@ module PaperTrailDiff
21
21
 
22
22
  # : (untyped) -> untyped
23
23
  def trailing_version: (untyped) -> untyped
24
-
25
- # : (Array[untyped]) -> Array[untyped]
26
- def ordered: (Array[untyped]) -> Array[untyped]
27
24
  end
28
25
  end
@@ -3,8 +3,8 @@
3
3
  module PaperTrailDiff
4
4
  # Selects and compares a chronological slice of a record's version history.
5
5
  class TimelineBuilder
6
- # : (untyped, from: untyped, to: untyped, snapshotter: untyped, ?within: untyped, ?version_scope: untyped, ?plan: RootVersionPlan?, ?live_endpoint: untyped) -> void
7
- def initialize: (untyped, from: untyped, to: untyped, snapshotter: untyped, ?within: untyped, ?version_scope: untyped, ?plan: RootVersionPlan?, ?live_endpoint: untyped) -> void
6
+ # : (untyped, from: untyped, to: untyped, snapshotter: untyped, ?within: untyped, ?version_scope: untyped, ?plan: RootVersionPlan?, ?live_endpoint: untyped, ?traversal: AssociationTraversal?) -> void
7
+ def initialize: (untyped, from: untyped, to: untyped, snapshotter: untyped, ?within: untyped, ?version_scope: untyped, ?plan: RootVersionPlan?, ?live_endpoint: untyped, ?traversal: AssociationTraversal?) -> void
8
8
 
9
9
  # : () -> Array[Step]
10
10
  def build: () -> Array[Step]
@@ -15,8 +15,10 @@ module PaperTrailDiff
15
15
 
16
16
  attr_reader time_range: TimeRange?
17
17
 
18
- # : (untyped, from: untyped, to: untyped, within: untyped, ?version_scope: untyped, ?plan: RootVersionPlan?, ?live_endpoint: untyped) -> void
19
- def initialize: (untyped, from: untyped, to: untyped, within: untyped, ?version_scope: untyped, ?plan: RootVersionPlan?, ?live_endpoint: untyped) -> void
18
+ # `traversal` names the requested paths, which decide where a window's
19
+ # edges move (see TransactionCut).
20
+ # : (untyped, from: untyped, to: untyped, within: untyped, ?version_scope: untyped, ?plan: RootVersionPlan?, ?live_endpoint: untyped, ?traversal: AssociationTraversal?) -> void
21
+ def initialize: (untyped, from: untyped, to: untyped, within: untyped, ?version_scope: untyped, ?plan: RootVersionPlan?, ?live_endpoint: untyped, ?traversal: AssociationTraversal?) -> void
20
22
 
21
23
  # A record with no versions has no first boundary to resolve, which
22
24
  # is an empty history rather than a bad request. Both endpoints are
@@ -27,9 +29,10 @@ module PaperTrailDiff
27
29
  # A batch may have selected these versions already, in which case reselecting
28
30
  # them per record would undo the batching.
29
31
  # The plan says which pairs of versions become steps, which a filter can
30
- # make different from adjacent pairs of the selected versions.
31
- # : (?context_required: bool) -> RootVersionPlan
32
- def select_plan: (?context_required: bool) -> RootVersionPlan
32
+ # make different from adjacent pairs of the selected versions. A `whole`
33
+ # plan replays every version in the range; see RootVersionSelection.
34
+ # : (?context_required: bool, ?whole: bool) -> RootVersionPlan
35
+ def select_plan: (?context_required: bool, ?whole: bool) -> RootVersionPlan
33
36
 
34
37
  # : () -> bool
35
38
  def time?: () -> bool
@@ -56,10 +59,12 @@ module PaperTrailDiff
56
59
 
57
60
  @to: untyped
58
61
 
62
+ @traversal: AssociationTraversal?
63
+
59
64
  @version_scope: untyped
60
65
 
61
- # : () -> RootVersionPlan
62
- def explicit_plan: () -> RootVersionPlan
66
+ # : (bool) -> RootVersionPlan
67
+ def explicit_plan: (bool) -> RootVersionPlan
63
68
 
64
69
  # : (untyped) -> bool
65
70
  def symbolic?: (untyped) -> bool
@@ -0,0 +1,32 @@
1
+ # Generated from lib/paper_trail_diff/total_order.rb with RBS::Inline
2
+
3
+ module PaperTrailDiff
4
+ # A relation's order, completed by its primary key. Reading a relation by
5
+ # offset holds only under a total order: a database may return rows that tie
6
+ # in a different order for each query, so that pages read some records twice
7
+ # and others never.
8
+ module TotalOrder
9
+ # The relation sorted by its key after its own order, unless that order
10
+ # already sorts by the key. Such an order is kept as given, since SQL
11
+ # Server rejects a column listed twice. So is the order of a relation
12
+ # grouped by anything but the key: each of its rows is a group, which a
13
+ # database sorts only by what it groups or aggregates. A relation answers
14
+ # for its model the key and table name read here.
15
+ # : (untyped) -> untyped
16
+ def self.apply: (untyped) -> untyped
17
+
18
+ # : (untyped) -> bool
19
+ def self.grouped_by_other?: (untyped) -> bool
20
+
21
+ # An Arel order or group names its column; SQL text, or the name a group
22
+ # may be given as, is read by key_in_sql?.
23
+ # : (untyped, untyped) -> bool
24
+ def self.key?: (untyped, untyped) -> bool
25
+
26
+ # Whether SQL text names the key, alone or after its table's name. That
27
+ # also finds a key the text only uses, as in `LENGTH(id)`, which then goes
28
+ # without the tie-breaker, but it misses no sort by the key.
29
+ # : (String, untyped) -> bool
30
+ def self.key_in_sql?: (String, untyped) -> bool
31
+ end
32
+ end
@@ -14,14 +14,28 @@ module PaperTrailDiff
14
14
  # Only the root's own versions on either side of an edge are consulted:
15
15
  # rows locked by an update keep two transactions of one root from
16
16
  # interleaving, so a transaction holding a root version and crossing the edge
17
- # holds the root's nearest version on one side of it. Each edge is moved from
18
- # where it was asked for, never from where another edge moved, so adjacent
19
- # windows move their shared edge alike.
17
+ # holds the root's nearest version on one side of it. One that saved the root
18
+ # after the edge moves it. One that saved the root only before the edge moves
19
+ # it only when it saved a record of a type on the requested paths after it,
20
+ # which the root's history reads: without one, the root's change is in the
21
+ # earlier window, where its version is, as selecting by a window's versions
22
+ # finds it, and ScopedRootSelection selects the roots such a move brings into
23
+ # a window. Each edge is moved from where it was asked for, never from where
24
+ # another edge moved, so adjacent windows move their shared edge alike.
20
25
  module TransactionCut
21
26
  # One edge of a window. A strict edge keeps versions recorded at its
22
27
  # instant on the left, as an inclusive end does. A plain class rather than
23
28
  # Data.define, which arrived in Ruby 3.2 while this gem supports 3.1.
24
29
  class Edge
30
+ # A window's start, which keeps versions recorded at it on the right.
31
+ # : (TimeRange) -> Edge
32
+ def self.start_of: (TimeRange) -> Edge
33
+
34
+ # A window's end, strict when the window includes it; an endless window
35
+ # has none.
36
+ # : (TimeRange) -> Edge?
37
+ def self.end_of: (TimeRange) -> Edge?
38
+
25
39
  # : (Time, bool) -> void
26
40
  def initialize: (Time, bool) -> void
27
41
 
@@ -36,55 +50,102 @@ module PaperTrailDiff
36
50
  @time: Time
37
51
  end
38
52
 
39
- # Roots, or transactions, per statement. SQL Server compiles every
40
- # statement afresh, since its ids are written into it, in time that grows
41
- # with their number; fewer statements than this cost more than they save.
42
- SLICE: ::Integer
43
-
44
53
  # The same as `windows` for a batch of roots, keyed by identity.
45
- # : (Array[untyped], TimeRange?) -> Hash[Array[String], TimeRange]
46
- def self.batch_windows: (Array[untyped], TimeRange?) -> Hash[Array[String], TimeRange]
54
+ # : (Array[untyped], TimeRange?, ?traversal: AssociationTraversal?) -> Hash[Array[String], TimeRange]
55
+ def self.batch_windows: (Array[untyped], TimeRange?, ?traversal: AssociationTraversal?) -> Hash[Array[String], TimeRange]
47
56
 
48
57
  # Where history for a batch must be read from: the earliest moved start.
49
58
  # : (TimeRange?, Hash[Array[String], TimeRange]) -> Time?
50
59
  def self.earliest_start: (TimeRange?, Hash[Array[String], TimeRange]) -> Time?
51
60
 
52
61
  # The windows that move, keyed by root id. A root missing from the result
53
- # keeps the window as asked.
54
- # : (untyped, Array[untyped], TimeRange) -> Hash[String, TimeRange]
55
- def self.windows: (untyped, Array[untyped], TimeRange) -> Hash[String, TimeRange]
62
+ # keeps the window as asked. `traversal` names the requested paths.
63
+ # `records` may be ids. Each move is reported unless `report` is false,
64
+ # for a reader that looks before the analysis that reports them.
65
+ # : (untyped, Array[untyped], TimeRange, ?traversal: AssociationTraversal?, ?report: bool) -> Hash[String, TimeRange]
66
+ def self.windows: (untyped, Array[untyped], TimeRange, ?traversal: AssociationTraversal?, ?report: bool) -> Hash[String, TimeRange]
67
+
68
+ # Reads the windows of `model_class` ids for a range, unreported.
69
+ # : (untyped, AssociationTraversal?) -> ^(Array[String], TimeRange) -> Hash[String, TimeRange]
70
+ def self.reader: (untyped, AssociationTraversal?) -> ^(Array[String], TimeRange) -> Hash[String, TimeRange]
56
71
 
57
72
  # A transaction holds its rows only while it runs, so in history as an
58
73
  # application saves it an edge moves by moments. A longer move means a
59
74
  # long transaction or rewritten times, which only the application can
60
75
  # judge, so each move is reported rather than logged or refused.
61
- # : (untyped, String, TimeRange, Time?, Time?) -> TimeRange
62
- def self.moved_window: (untyped, String, TimeRange, Time?, Time?) -> TimeRange
76
+ # : (untyped, String, TimeRange, TimeRange) -> void
77
+ def self.report_move: (untyped, String, TimeRange, TimeRange) -> void
78
+
79
+ # The model's versions in a window, and those saved before it in a
80
+ # transaction that saved a record of one of `types` inside it, which
81
+ # moves their root's window back to take them in: the versions that
82
+ # select a root for the window. Without a window, every version does.
83
+ # : (untyped, TimeRange?, Array[String]) -> untyped
84
+ def self.window_versions: (untyped, TimeRange?, Array[String]) -> untyped
85
+
86
+ # : (untyped, untyped, TimeRange, Array[String]) -> untyped
87
+ def self.crossing_versions: (untyped, untyped, TimeRange, Array[String]) -> untyped
63
88
 
64
89
  # : (untyped) -> untyped
65
90
  def self.transaction_versions: (untyped) -> untyped
66
91
 
67
- # Each root's earliest start among its transactions that cross the edge.
68
- # : (untyped, Array[untyped], Edge) -> Hash[String, Time]
69
- def self.moved_edges: (untyped, Array[untyped], Edge) -> Hash[String, Time]
92
+ # : (untyped) -> bool
93
+ def self.transactional?: (untyped) -> bool
94
+
95
+ # Each root's earliest start among its transactions that cross the edge:
96
+ # the one that saved its first version after the edge, which crosses when
97
+ # it began before it, and the one that saved its last version before it,
98
+ # which crosses when it saved a record of one of `types` after it.
99
+ # : (untyped, Array[untyped], Edge, Array[String]) -> Hash[String, Time]
100
+ def self.moved_edges: (untyped, Array[untyped], Edge, Array[String]) -> Hash[String, Time]
101
+
102
+ # For each side of the edge, the roots its transactions hold next to the
103
+ # edge, and where those that cross it began.
104
+ # : (untyped, Array[untyped], Edge, Array[String]) -> Array[[Hash[untyped, Array[String]], Hash[untyped, Time]]]
105
+ def self.crossing: (untyped, Array[untyped], Edge, Array[String]) -> Array[[ Hash[untyped, Array[String]], Hash[untyped, Time] ]]
70
106
 
71
- # The roots whose versions next to the edge each transaction holds.
72
- # : (untyped, Array[untyped], Edge) -> Hash[untyped, Array[String]]
73
- def self.nearest_roots: (untyped, Array[untyped], Edge) -> Hash[untyped, Array[String]]
107
+ # The roots whose versions next to the edge each transaction holds, those
108
+ # after the edge and those before it.
109
+ # : (untyped, Array[untyped], Edge) -> [Hash[untyped, Array[String]], Hash[untyped, Array[String]]]
110
+ def self.nearest_roots: (untyped, Array[untyped], Edge) -> [ Hash[untyped, Array[String]], Hash[untyped, Array[String]] ]
111
+
112
+ # The roots of the rows, by the transaction each row names.
113
+ # : (Array[[String, untyped, bool]]) -> Hash[untyped, Array[String]]
114
+ def self.by_transaction: (Array[[ String, untyped, bool ]]) -> Hash[untyped, Array[String]]
74
115
 
75
116
  # Each root's nearest versions on either side of an edge, as [id,
76
- # transaction] pairs; versions tied at the nearest instant are all kept.
77
- # One statement per slice: a grouped pass over the roots' versions finds
78
- # both instants, and a join reads the versions saved at either. A lookup
79
- # per root, joined by UNION ALL, took SQL Server about a second per 200
80
- # roots to compile. Rows read without a model come back as the adapter
81
- # returns them, so the transaction is cast as the grouped query's keys are.
82
- # : (untyped, Array[untyped], Edge) -> Array[[String, untyped]]
83
- def self.nearest: (untyped, Array[untyped], Edge) -> Array[[ String, untyped ]]
84
-
85
- # The roots' versions saved in a transaction at either nearest instant.
86
- # : (untyped, Array[untyped], Edge) -> String
87
- def self.nearest_sql: (untyped, Array[untyped], Edge) -> String
117
+ # transaction, after the edge] rows; versions tied at the nearest instant
118
+ # are all kept. One statement per slice: a grouped pass over the roots'
119
+ # versions finds both instants, and a join reads the versions saved at
120
+ # either. A lookup per root, joined by UNION ALL, took SQL Server about a
121
+ # second per 200 roots to compile. Rows read without a model come back as
122
+ # the adapter returns them, so the transaction is cast as the grouped
123
+ # query's keys are.
124
+ #
125
+ # The ids go to the adapter as bound parameters. Written into the
126
+ # statement, they made each slice's text new to SQL Server, which compiled
127
+ # it again, at about 0.05 ms per id.
128
+ # : (untyped, Array[untyped], Edge) -> Array[[String, untyped, bool]]
129
+ def self.nearest: (untyped, Array[untyped], Edge) -> Array[[ String, untyped, bool ]]
130
+
131
+ # The roots' versions saved in a transaction at either nearest instant,
132
+ # each with whether it is the one after the edge.
133
+ # : (untyped, Array[untyped], Edge) -> untyped
134
+ def self.nearest_query: (untyped, Array[untyped], Edge) -> untyped
135
+
136
+ # 1 for a version saved at the instant after the edge, 0 for one before.
137
+ # Only the 1 is read (see after_edge?), so another value or alias, or none,
138
+ # answers the same.
139
+ # mutant:disable
140
+ # : (untyped, untyped) -> untyped
141
+ def self.after_edge: (untyped, untyped) -> untyped
142
+
143
+ # Whether after_edge flagged a row as saved after the edge. Adapters
144
+ # return the flag as an Integer or a String, so any spelling that reads
145
+ # only 1 as after answers the same.
146
+ # mutant:disable
147
+ # : (untyped) -> bool
148
+ def self.after_edge?: (untyped) -> bool
88
149
 
89
150
  # Each root's latest instant before the edge and earliest after it, from
90
151
  # every version, saved in a transaction or not.
@@ -99,26 +160,24 @@ module PaperTrailDiff
99
160
  # : (untyped, untyped) -> untyped
100
161
  def self.at_either: (untyped, untyped) -> untyped
101
162
 
102
- # Where each transaction that has versions on both sides of the edge began.
103
- # : (untyped, Array[untyped], Edge) -> Hash[untyped, Time]
104
- def self.crossing_starts: (untyped, Array[untyped], Edge) -> Hash[untyped, Time]
105
-
106
- # Another version of the same transaction on the edge's later side.
107
- # : (untyped, Edge) -> untyped
108
- def self.later_version: (untyped, Edge) -> untyped
109
-
110
- # The version table under a second name, for a subquery over it. Any name
111
- # serves, and SQLite even accepts an empty one other databases refuse, so
112
- # no spec can tell the mutations apart.
113
- # mutant:disable
114
- # : (untyped) -> untyped
115
- def self.other_versions: (untyped) -> untyped
116
-
117
- # Arel ships no signatures; see VersionQuery. Any spelling of the constant
118
- # finds the same module.
163
+ # Where each transaction that saved a version before the edge began; with
164
+ # `types`, only one that also saved a record of one of them after it.
165
+ # : (untyped, Array[untyped], Edge, ?Array[String]?) -> Hash[untyped, Time]
166
+ def self.crossing_starts: (untyped, Array[untyped], Edge, ?Array[String]?) -> Hash[untyped, Time]
167
+
168
+ # Those of the transactions that saved a version of a record of one of
169
+ # `types` on the edge's later side. A subquery apart from the outer one,
170
+ # rather than an EXISTS correlated with it, so the database finds them
171
+ # once by transaction: SQLite answered the correlated form by scanning
172
+ # every later version of the types for each version before the edge, with
173
+ # the README's indexes 17 s for 450 transactions on 114,000 versions.
174
+ # Only the outer query's transactions are read, so the database can find
175
+ # them by transaction rather than read every later version of the types;
176
+ # the outer query keeps only those anyway, so no spec can tell the
177
+ # mutation that drops them apart.
119
178
  # mutant:disable
120
- # : () -> untyped
121
- def self.arel: () -> untyped
179
+ # : (untyped, Array[untyped], Edge, Array[String]) -> untyped
180
+ def self.saved_later: (untyped, Array[untyped], Edge, Array[String]) -> untyped
122
181
 
123
182
  # : (TimeRange, Time?, Time?) -> TimeRange
124
183
  def self.moved: (TimeRange, Time?, Time?) -> TimeRange
@@ -34,8 +34,8 @@ module PaperTrailDiff
34
34
  # : (untyped) -> Array[untyped]
35
35
  def self.through_models: (untyped) -> Array[untyped]
36
36
 
37
- # : (tree: AssociationTree, traversal: AssociationTraversal, ?allow_approximate: bool) -> void
38
- def initialize: (tree: AssociationTree, traversal: AssociationTraversal, ?allow_approximate: bool) -> void
37
+ # : (traversal: AssociationTraversal, ?allow_approximate: bool) -> void
38
+ def initialize: (traversal: AssociationTraversal, ?allow_approximate: bool) -> void
39
39
 
40
40
  # : (untyped, historical: bool) -> void
41
41
  def call: (untyped, historical: bool) -> void
@@ -28,7 +28,10 @@ module PaperTrailDiff
28
28
  #
29
29
  # An element that is itself a Hash or Array is reported whole. Saying which
30
30
  # field of which object changed would require pairing before-elements with
31
- # after-elements, and nothing in the value licenses that pairing.
31
+ # after-elements, and nothing in the value licenses that pairing. Elements
32
+ # match with their keys read as strings (NestedComparator.comparable), so
33
+ # `{a: 1}` and `{"a" => 1}` are one element; each is reported as it was
34
+ # given.
32
35
  class ArrayChange
33
36
  attr_reader from: Array[untyped]
34
37
 
@@ -52,6 +55,7 @@ module PaperTrailDiff
52
55
  # : () -> bool
53
56
  def reordered?: () -> bool
54
57
 
58
+ # The same elements in the same order, with keys read as strings.
55
59
  # : () -> bool
56
60
  def empty?: () -> bool
57
61
 
@@ -17,21 +17,22 @@ module PaperTrailDiff
17
17
 
18
18
  @version_class: untyped
19
19
 
20
- # Only quoting helpers are needed, so the connection is borrowed for the
21
- # duration of building the condition rather than checked out permanently,
22
- # which Active Record 7.2 and newer can deprecate. Active Record 7.1 has no
23
- # `with_connection` and reaches the same connection through the accessor.
24
- # : () { (untyped) -> String } -> String
25
- def with_connection: () { (untyped) -> String } -> String
26
-
27
20
  # : () -> String
28
21
  def candidate_condition: () -> String
29
22
 
23
+ # A version saved before the start names the state there unless a later
24
+ # one saved before the start replaced it. PT-AT stores the keys a version
25
+ # saved, and a start inside a transaction reads each record as it stood
26
+ # before the transaction, so a later version that the record's
27
+ # transaction across the start saved before it replaced nothing yet.
28
+ # Without the version before it, a record that this transaction moved
29
+ # away is not found, nor is the transaction (see
30
+ # PreparedHistoryLoader#reload).
30
31
  # : (untyped) -> String
31
32
  def condition_sql: (untyped) -> String
32
33
 
33
- # : (untyped, String, String) -> Hash[Symbol, String]
34
- def quoted_columns: (untyped, String, String) -> Hash[Symbol, String]
34
+ # : (untyped, String, String, String) -> Hash[Symbol, String]
35
+ def quoted_columns: (untyped, String, String, String) -> Hash[Symbol, String]
35
36
 
36
37
  # : (Hash[Symbol, String], String, untyped) -> String
37
38
  def activity_condition: (Hash[Symbol, String], String, untyped) -> String
@@ -8,8 +8,10 @@ module PaperTrailDiff
8
8
  # sequential ids in one version table; any other tie cannot be ordered, and
9
9
  # guessing would place a change on an arbitrary side of the boundary. A
10
10
  # bare instant has no position among same-time versions, so it keeps them.
11
- # : (untyped, untyped) -> bool
12
- def self?.at_or_after?: (untyped, untyped) -> bool
11
+ # `time` and `boundary_time` are when each was recorded, which a caller
12
+ # placing many versions against one boundary reads once.
13
+ # : (untyped, untyped, ?time: untyped, ?boundary_time: untyped) -> bool
14
+ def self.at_or_after?: (untyped, untyped, ?time: untyped, ?boundary_time: untyped) -> bool
13
15
 
14
16
  # A range starting at a version starts before that version's transaction,
15
17
  # as PT-AT reads associations there. A version saved earlier in the same
@@ -17,26 +19,31 @@ module PaperTrailDiff
17
19
  # version, can be recorded before the start, so the start moves back to
18
20
  # the earliest version of each root's first transaction in the range.
19
21
  # History loaded from the start alone would read that child after its
20
- # change.
22
+ # change. The transactions go 500 to a statement.
21
23
  # : (Array[untyped], untyped) -> untyped
22
- def self?.transaction_start: (Array[untyped], untyped) -> untyped
24
+ def self.transaction_start: (Array[untyped], untyped) -> untyped
23
25
 
24
26
  # The transaction of each root's first version at or after the start.
25
27
  # : (Array[untyped], untyped) -> Array[untyped]
26
- def self?.opening_transactions: (Array[untyped], untyped) -> Array[untyped]
28
+ def self.opening_transactions: (Array[untyped], untyped) -> Array[untyped]
27
29
 
28
30
  # A custom version class need not carry the column, and PaperTrail leaves
29
31
  # it nil outside a transaction. Both read as "no transaction here", which
30
32
  # groups with nothing.
31
33
  # : (untyped) -> untyped
32
- def self?.transaction_id: (untyped) -> untyped
34
+ def self.transaction_id: (untyped) -> untyped
35
+
36
+ # Answered once for each Active Record class (see Support.per_model).
37
+ # : (untyped) -> bool
38
+ def self.transactional?: (untyped) -> bool
33
39
 
40
+ # Answered once for each Active Record class, as `transactional?` is.
34
41
  # : (untyped) -> bool
35
- def self?.version_record?: (untyped) -> bool
42
+ def self.version_record?: (untyped) -> bool
36
43
 
37
44
  # The same row of the same version table. A record or instant is never a
38
45
  # version.
39
46
  # : (untyped, untyped) -> bool
40
- def self?.same_version?: (untyped, untyped) -> bool
47
+ def self.same_version?: (untyped, untyped) -> bool
41
48
  end
42
49
  end
@@ -7,31 +7,38 @@ module PaperTrailDiff
7
7
  # instant, and the timestamp comes first because ids need not follow time:
8
8
  # a UUID key does not.
9
9
  # : (untyped) -> untyped
10
- def self?.chronological: (untyped) -> untyped
10
+ def self.chronological: (untyped) -> untyped
11
11
 
12
12
  # Every version of a model's items. They are read from the version class
13
13
  # rather than through the model's versions association, whose scope may
14
14
  # leave some out: a history replayed without them credits their changes to
15
15
  # the next version kept.
16
16
  # : (untyped) -> untyped
17
- def self?.for_model: (untyped) -> untyped
17
+ def self.for_model: (untyped) -> untyped
18
18
 
19
19
  # The versions of the given items, read the same way.
20
20
  # : (untyped, untyped) -> untyped
21
- def self?.for_items: (untyped, untyped) -> untyped
21
+ def self.for_items: (untyped, untyped) -> untyped
22
22
 
23
23
  # Keeps each item's earliest version among those the block also accepts:
24
24
  # no other version of the same item that the block accepts is earlier. A
25
25
  # correlated NOT EXISTS stays portable where window functions are not.
26
26
  # : (untyped) ?{ (untyped) -> untyped } -> untyped
27
- def self?.no_earlier_version: (untyped) ?{ (untyped) -> untyped } -> untyped
27
+ def self.no_earlier_version: (untyped) ?{ (untyped) -> untyped } -> untyped
28
28
 
29
- # The same for either side of an instant: each item's earliest version
30
- # when the versions lie after it, and its latest when they lie before.
31
- # : (untyped, later: bool) ?{ (untyped) -> untyped } -> untyped
32
- def self?.no_nearer_version: (untyped, later: bool) ?{ (untyped) -> untyped } -> untyped
29
+ # Whether a version exists that the block's condition accepts. The block
30
+ # is given the version table under a second name, beside `table`.
31
+ # : (untyped) { (untyped) -> untyped } -> untyped
32
+ def self.exists: (untyped) { (untyped) -> untyped } -> untyped
33
33
 
34
- # : (untyped, untyped, later: bool) ?{ (untyped) -> untyped } -> untyped
35
- def self?.nearer_version: (untyped, untyped, later: bool) ?{ (untyped) -> untyped } -> untyped
34
+ # : (untyped, untyped) ?{ (untyped) -> untyped } -> untyped
35
+ def self.earlier_version: (untyped, untyped) ?{ (untyped) -> untyped } -> untyped
36
+
37
+ # The version table under a second name, for a subquery over it. Any name
38
+ # serves, and SQLite even accepts an empty one other databases refuse, so
39
+ # no spec can tell the mutations apart.
40
+ # mutant:disable
41
+ # : (untyped) -> untyped
42
+ def self.other_versions: (untyped) -> untyped
36
43
  end
37
44
  end
@@ -7,14 +7,14 @@ module PaperTrailDiff
7
7
  def initialize: (untyped, from: untyped, to: untyped, version_scope: untyped) -> void
8
8
 
9
9
  # Keep both reconstruction boundaries and the step pairs a filter implies.
10
- # : () -> RootVersionPlan
11
- def select_plan_for_range: () -> RootVersionPlan
10
+ # : (?whole: bool) -> RootVersionPlan
11
+ def select_plan_for_range: (?whole: bool) -> RootVersionPlan
12
12
 
13
13
  # : () -> untyped
14
14
  def validated_relation: () -> untyped
15
15
 
16
- # : (untyped) -> RootVersionPlan
17
- def select_plan_through_current: (untyped) -> RootVersionPlan
16
+ # : (untyped, ?whole: bool) -> RootVersionPlan
17
+ def select_plan_through_current: (untyped, ?whole: bool) -> RootVersionPlan
18
18
 
19
19
  private
20
20
 
@@ -26,11 +26,8 @@ module PaperTrailDiff
26
26
 
27
27
  @version_scope: untyped
28
28
 
29
- # : (untyped, ?through: untyped, ?live_endpoint: untyped) -> RootVersionPlan
30
- def select_plan: (untyped, ?through: untyped, ?live_endpoint: untyped) -> RootVersionPlan
31
-
32
- # : (Array[untyped]) -> Array[untyped]
33
- def ordered: (Array[untyped]) -> Array[untyped]
29
+ # : (untyped, whole: bool, ?through: untyped, ?live_endpoint: untyped) -> RootVersionPlan
30
+ def select_plan: (untyped, whole: bool, ?through: untyped, ?live_endpoint: untyped) -> RootVersionPlan
34
31
 
35
32
  # : (untyped, untyped, boundary: Symbol) -> void
36
33
  def validate_boundary!: (untyped, untyped, boundary: Symbol) -> void
@@ -28,6 +28,19 @@ module PaperTrailDiff
28
28
  # : (Array[untyped]) -> DiagnosticIssue?
29
29
  def unorderable: (Array[untyped]) -> DiagnosticIssue?
30
30
 
31
+ # Versions are read in time order, and ids that count up in one table say
32
+ # which was saved first. A later version dated earlier was usually dated
33
+ # by PaperTrail at an `updated_at` the application set itself, and the
34
+ # history then reads it before the change it followed: an update dated
35
+ # before the record's create reads as the record deleted and created
36
+ # again. A time can also be right and the id wrong, as for versions
37
+ # imported from elsewhere, so this warns rather than refuses.
38
+ # : (Array[untyped]) -> DiagnosticIssue?
39
+ def inverted: (Array[untyped]) -> DiagnosticIssue?
40
+
41
+ # : (untyped, untyped) -> String
42
+ def inverted_message: (untyped, untyped) -> String
43
+
31
44
  # Loaded history orders versions that share a timestamp by id, but PT-AT
32
45
  # places association changes by timestamp alone, so a path it reads loses
33
46
  # any change between such a pair. Unlike an unorderable sequence this is
@@ -18,6 +18,9 @@ module PaperTrailDiff
18
18
  # : (untyped) -> untyped
19
19
  def self.separate_part: (untyped) -> untyped
20
20
 
21
+ # : (untyped) -> bool
22
+ def self.separate?: (untyped) -> bool
23
+
21
24
  # PT-AT's version association rows joined to the versions they were saved
22
25
  # with. Its `belongs_to :version` names PaperTrail's default class whatever
23
26
  # table a model's versions are in, so the join names the table instead.