paper_trail_diff 0.15.0 → 0.17.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +724 -1
- data/README.md +43 -8
- data/docs/architecture.md +7 -5
- data/docs/performance.md +89 -32
- data/docs/reference.md +427 -96
- data/docs/testing.md +260 -32
- data/lib/paper_trail_diff/activity_belongs_to_event_applier.rb +2 -16
- data/lib/paper_trail_diff/activity_boundary.rb +55 -34
- data/lib/paper_trail_diff/activity_child_candidate_loader.rb +46 -57
- data/lib/paper_trail_diff/activity_collection_event_applier.rb +33 -11
- data/lib/paper_trail_diff/activity_collection_route_updater.rb +1 -1
- data/lib/paper_trail_diff/activity_event.rb +33 -21
- data/lib/paper_trail_diff/activity_event_record_resolver.rb +16 -116
- data/lib/paper_trail_diff/activity_event_route_finder.rb +49 -18
- data/lib/paper_trail_diff/activity_event_snapshot_refresher.rb +13 -7
- data/lib/paper_trail_diff/activity_history.rb +90 -49
- data/lib/paper_trail_diff/activity_range.rb +9 -35
- data/lib/paper_trail_diff/activity_root_snapshot_refresher.rb +104 -52
- data/lib/paper_trail_diff/activity_root_steps.rb +10 -13
- data/lib/paper_trail_diff/activity_scope_filter.rb +77 -0
- data/lib/paper_trail_diff/activity_snapshot_delta.rb +12 -15
- data/lib/paper_trail_diff/activity_snapshot_sequence.rb +37 -15
- data/lib/paper_trail_diff/activity_target_candidate_loader.rb +35 -43
- data/lib/paper_trail_diff/activity_timeline_builder.rb +200 -249
- data/lib/paper_trail_diff/activity_transaction_grouper.rb +3 -1
- data/lib/paper_trail_diff/activity_tree_filter.rb +54 -13
- data/lib/paper_trail_diff/activity_version_collector.rb +72 -138
- data/lib/paper_trail_diff/activity_view.rb +22 -11
- data/lib/paper_trail_diff/analysis.rb +39 -6
- data/lib/paper_trail_diff/analysis_batch.rb +16 -58
- data/lib/paper_trail_diff/approximate_paths.rb +4 -8
- data/lib/paper_trail_diff/association_activity_edge.rb +5 -24
- data/lib/paper_trail_diff/association_activity_selection.rb +10 -18
- data/lib/paper_trail_diff/association_discovery.rb +1 -6
- data/lib/paper_trail_diff/association_key.rb +9 -6
- data/lib/paper_trail_diff/association_traversal.rb +49 -6
- data/lib/paper_trail_diff/batch_boundary_resolver.rb +33 -42
- data/lib/paper_trail_diff/batch_preload.rb +2 -12
- data/lib/paper_trail_diff/batched_root_analyses.rb +72 -0
- data/lib/paper_trail_diff/batched_root_analyzer.rb +22 -14
- data/lib/paper_trail_diff/batched_root_versions.rb +25 -20
- data/lib/paper_trail_diff/branch_snapshot_refresher.rb +41 -42
- data/lib/paper_trail_diff/change_attribution.rb +314 -0
- data/lib/paper_trail_diff/change_row.rb +30 -10
- data/lib/paper_trail_diff/comparison_batch.rb +3 -4
- data/lib/paper_trail_diff/configuration.rb +1 -1
- data/lib/paper_trail_diff/deleted_analysis_batch.rb +22 -33
- data/lib/paper_trail_diff/deleted_root_filter.rb +29 -10
- data/lib/paper_trail_diff/deprecation.rb +4 -43
- data/lib/paper_trail_diff/diagnostics.rb +8 -7
- data/lib/paper_trail_diff/direct_record_state_loader.rb +8 -1
- data/lib/paper_trail_diff/endpoint.rb +78 -44
- data/lib/paper_trail_diff/errors.rb +2 -9
- data/lib/paper_trail_diff/fallback_paths.rb +2 -5
- data/lib/paper_trail_diff/habtm_transaction_owners.rb +5 -3
- data/lib/paper_trail_diff/historical_association_reifier.rb +3 -1
- data/lib/paper_trail_diff/historical_filter.rb +40 -15
- data/lib/paper_trail_diff/historical_snapshot_store.rb +80 -38
- data/lib/paper_trail_diff/instrumentation.rb +0 -8
- data/lib/paper_trail_diff/live_endpoint_batch_loader.rb +11 -7
- data/lib/paper_trail_diff/live_endpoint_provider.rb +7 -23
- data/lib/paper_trail_diff/live_graph_collector.rb +3 -3
- data/lib/paper_trail_diff/nested_comparator.rb +46 -19
- data/lib/paper_trail_diff/net_change.rb +276 -0
- data/lib/paper_trail_diff/own_window.rb +35 -0
- data/lib/paper_trail_diff/paper_trail_adapter.rb +119 -87
- data/lib/paper_trail_diff/prepared_activity_index.rb +182 -50
- data/lib/paper_trail_diff/prepared_child_candidates.rb +58 -0
- data/lib/paper_trail_diff/prepared_edge_loader.rb +43 -107
- data/lib/paper_trail_diff/prepared_history.rb +31 -36
- data/lib/paper_trail_diff/prepared_history_loader.rb +47 -12
- data/lib/paper_trail_diff/prepared_record_index.rb +143 -49
- data/lib/paper_trail_diff/prepared_snapshot_builder.rb +16 -0
- data/lib/paper_trail_diff/prepared_state_association_reader.rb +17 -19
- data/lib/paper_trail_diff/read_snapshot.rb +99 -0
- data/lib/paper_trail_diff/recorded_changes.rb +10 -11
- data/lib/paper_trail_diff/recorded_changes_reader.rb +60 -0
- data/lib/paper_trail_diff/recorded_class.rb +14 -19
- data/lib/paper_trail_diff/recorded_columns.rb +33 -0
- data/lib/paper_trail_diff/root_version_plan.rb +20 -22
- data/lib/paper_trail_diff/root_version_selection.rb +39 -29
- data/lib/paper_trail_diff/scope_condition.rb +92 -32
- data/lib/paper_trail_diff/scope_ranking.rb +27 -34
- data/lib/paper_trail_diff/scoped_analysis.rb +27 -4
- data/lib/paper_trail_diff/scoped_analysis_builder.rb +18 -7
- data/lib/paper_trail_diff/scoped_root_selection.rb +65 -39
- data/lib/paper_trail_diff/snapshot_normalizer.rb +18 -3
- data/lib/paper_trail_diff/stored_json_values.rb +52 -0
- data/lib/paper_trail_diff/stored_time_precision.rb +30 -18
- data/lib/paper_trail_diff/stored_values.rb +20 -0
- data/lib/paper_trail_diff/support.rb +185 -35
- data/lib/paper_trail_diff/time_of_day.rb +39 -0
- data/lib/paper_trail_diff/time_range.rb +40 -22
- data/lib/paper_trail_diff/time_version_range.rb +5 -10
- data/lib/paper_trail_diff/timeline_builder.rb +9 -3
- data/lib/paper_trail_diff/timeline_range.rb +18 -12
- data/lib/paper_trail_diff/timeline_snapshot_provider.rb +1 -1
- data/lib/paper_trail_diff/total_order.rb +55 -0
- data/lib/paper_trail_diff/transaction_cut.rb +235 -75
- data/lib/paper_trail_diff/traversal_preparer.rb +5 -8
- data/lib/paper_trail_diff/value_objects.rb +8 -4
- data/lib/paper_trail_diff/version.rb +1 -1
- data/lib/paper_trail_diff/version_association_candidate_scope.rb +1 -12
- data/lib/paper_trail_diff/version_boundary.rb +41 -23
- data/lib/paper_trail_diff/version_query.rb +25 -25
- data/lib/paper_trail_diff/version_range.rb +12 -16
- data/lib/paper_trail_diff/version_sequence_diagnostics.rb +36 -1
- data/lib/paper_trail_diff/version_table.rb +12 -8
- data/lib/paper_trail_diff.rb +32 -44
- data/sig/generated/paper_trail_diff/activity_belongs_to_event_applier.rbs +0 -8
- data/sig/generated/paper_trail_diff/activity_boundary.rbs +39 -17
- data/sig/generated/paper_trail_diff/activity_child_candidate_loader.rbs +19 -22
- data/sig/generated/paper_trail_diff/activity_collection_event_applier.rbs +13 -5
- data/sig/generated/paper_trail_diff/activity_event.rbs +25 -9
- data/sig/generated/paper_trail_diff/activity_event_record_resolver.rbs +6 -34
- data/sig/generated/paper_trail_diff/activity_event_route_finder.rbs +25 -4
- data/sig/generated/paper_trail_diff/activity_event_snapshot_refresher.rbs +6 -3
- data/sig/generated/paper_trail_diff/activity_history.rbs +54 -19
- data/sig/generated/paper_trail_diff/activity_range.rbs +6 -20
- data/sig/generated/paper_trail_diff/activity_root_snapshot_refresher.rbs +55 -10
- data/sig/generated/paper_trail_diff/activity_root_steps.rbs +6 -6
- data/sig/generated/paper_trail_diff/activity_scope_filter.rbs +51 -0
- data/sig/generated/paper_trail_diff/activity_snapshot_delta.rbs +5 -3
- data/sig/generated/paper_trail_diff/activity_snapshot_sequence.rbs +21 -3
- data/sig/generated/paper_trail_diff/activity_target_candidate_loader.rbs +19 -24
- data/sig/generated/paper_trail_diff/activity_timeline_builder.rbs +125 -127
- data/sig/generated/paper_trail_diff/activity_tree_filter.rbs +41 -8
- data/sig/generated/paper_trail_diff/activity_version_collector.rbs +42 -35
- data/sig/generated/paper_trail_diff/activity_view.rbs +16 -8
- data/sig/generated/paper_trail_diff/analysis.rbs +26 -5
- data/sig/generated/paper_trail_diff/analysis_batch.rbs +6 -24
- data/sig/generated/paper_trail_diff/association_activity_edge.rbs +0 -13
- data/sig/generated/paper_trail_diff/association_activity_selection.rbs +6 -9
- data/sig/generated/paper_trail_diff/association_discovery.rbs +0 -3
- data/sig/generated/paper_trail_diff/association_key.rbs +5 -0
- data/sig/generated/paper_trail_diff/association_traversal.rbs +26 -2
- data/sig/generated/paper_trail_diff/batch_boundary_resolver.rbs +17 -17
- data/sig/generated/paper_trail_diff/batch_preload.rbs +0 -4
- data/sig/generated/paper_trail_diff/batched_root_analyses.rbs +47 -0
- data/sig/generated/paper_trail_diff/batched_root_analyzer.rbs +13 -8
- data/sig/generated/paper_trail_diff/batched_root_versions.rbs +10 -6
- data/sig/generated/paper_trail_diff/branch_snapshot_refresher.rbs +16 -4
- data/sig/generated/paper_trail_diff/change_attribution.rbs +185 -0
- data/sig/generated/paper_trail_diff/change_row.rbs +22 -7
- data/sig/generated/paper_trail_diff/deleted_analysis_batch.rbs +11 -9
- data/sig/generated/paper_trail_diff/deleted_root_filter.rbs +9 -3
- data/sig/generated/paper_trail_diff/deprecation.rbs +4 -24
- data/sig/generated/paper_trail_diff/direct_record_state_loader.rbs +4 -0
- data/sig/generated/paper_trail_diff/endpoint.rbs +40 -16
- data/sig/generated/paper_trail_diff/errors.rbs +2 -11
- data/sig/generated/paper_trail_diff/habtm_transaction_owners.rbs +2 -1
- data/sig/generated/paper_trail_diff/historical_filter.rbs +20 -9
- data/sig/generated/paper_trail_diff/historical_snapshot_store.rbs +40 -10
- data/sig/generated/paper_trail_diff/instrumentation.rbs +0 -3
- data/sig/generated/paper_trail_diff/live_endpoint_batch_loader.rbs +3 -0
- data/sig/generated/paper_trail_diff/live_endpoint_provider.rbs +5 -8
- data/sig/generated/paper_trail_diff/live_graph_collector.rbs +2 -2
- data/sig/generated/paper_trail_diff/nested_comparator.rbs +20 -4
- data/sig/generated/paper_trail_diff/net_change.rbs +168 -0
- data/sig/generated/paper_trail_diff/own_window.rbs +22 -0
- data/sig/generated/paper_trail_diff/paper_trail_adapter.rbs +19 -6
- data/sig/generated/paper_trail_diff/prepared_activity_index.rbs +113 -17
- data/sig/generated/paper_trail_diff/prepared_child_candidates.rbs +39 -0
- data/sig/generated/paper_trail_diff/prepared_edge_loader.rbs +18 -35
- data/sig/generated/paper_trail_diff/prepared_history.rbs +15 -13
- data/sig/generated/paper_trail_diff/prepared_history_loader.rbs +28 -3
- data/sig/generated/paper_trail_diff/prepared_record_index.rbs +70 -15
- data/sig/generated/paper_trail_diff/prepared_snapshot_builder.rbs +12 -0
- data/sig/generated/paper_trail_diff/prepared_state_association_reader.rbs +6 -7
- data/sig/generated/paper_trail_diff/read_snapshot.rbs +62 -0
- data/sig/generated/paper_trail_diff/recorded_changes.rbs +4 -2
- data/sig/generated/paper_trail_diff/recorded_changes_reader.rbs +41 -0
- data/sig/generated/paper_trail_diff/recorded_class.rbs +7 -6
- data/sig/generated/paper_trail_diff/recorded_columns.rbs +21 -0
- data/sig/generated/paper_trail_diff/root_version_plan.rbs +8 -4
- data/sig/generated/paper_trail_diff/root_version_selection.rbs +27 -13
- data/sig/generated/paper_trail_diff/scope_condition.rbs +39 -9
- data/sig/generated/paper_trail_diff/scope_ranking.rbs +16 -16
- data/sig/generated/paper_trail_diff/scoped_analysis.rbs +19 -0
- data/sig/generated/paper_trail_diff/scoped_analysis_builder.rbs +9 -2
- data/sig/generated/paper_trail_diff/scoped_root_selection.rbs +40 -12
- data/sig/generated/paper_trail_diff/snapshot_normalizer.rbs +7 -0
- data/sig/generated/paper_trail_diff/stored_json_values.rbs +35 -0
- data/sig/generated/paper_trail_diff/stored_time_precision.rbs +19 -5
- data/sig/generated/paper_trail_diff/stored_values.rbs +13 -0
- data/sig/generated/paper_trail_diff/support.rbs +120 -23
- data/sig/generated/paper_trail_diff/time_of_day.rbs +21 -0
- data/sig/generated/paper_trail_diff/time_range.rbs +15 -7
- data/sig/generated/paper_trail_diff/time_version_range.rbs +2 -5
- data/sig/generated/paper_trail_diff/timeline_builder.rbs +6 -2
- data/sig/generated/paper_trail_diff/timeline_range.rbs +12 -7
- data/sig/generated/paper_trail_diff/total_order.rbs +32 -0
- data/sig/generated/paper_trail_diff/transaction_cut.rbs +131 -40
- data/sig/generated/paper_trail_diff/traversal_preparer.rbs +2 -2
- data/sig/generated/paper_trail_diff/value_objects.rbs +5 -1
- data/sig/generated/paper_trail_diff/version_association_candidate_scope.rbs +0 -7
- data/sig/generated/paper_trail_diff/version_boundary.rbs +17 -8
- data/sig/generated/paper_trail_diff/version_query.rbs +17 -10
- data/sig/generated/paper_trail_diff/version_range.rbs +6 -9
- data/sig/generated/paper_trail_diff/version_sequence_diagnostics.rbs +16 -0
- data/sig/generated/paper_trail_diff/version_table.rbs +3 -0
- data/sig/generated/paper_trail_diff.rbs +16 -16
- metadata +31 -7
- data/lib/paper_trail_diff/preloaded_endpoint_batch_loader.rb +0 -60
- data/sig/generated/paper_trail_diff/preloaded_endpoint_batch_loader.rbs +0 -32
|
@@ -15,6 +15,11 @@ module PaperTrailDiff
|
|
|
15
15
|
# : (untyped) -> untyped
|
|
16
16
|
def after_value: (untyped) -> untyped
|
|
17
17
|
|
|
18
|
+
# Compared as text, so an id read as a string matches one read as an
|
|
19
|
+
# integer.
|
|
20
|
+
# : (untyped) -> bool
|
|
21
|
+
def changed?: (untyped) -> bool
|
|
22
|
+
|
|
18
23
|
# : (untyped) -> bool
|
|
19
24
|
def relationship_changed?: (untyped) -> bool
|
|
20
25
|
|
|
@@ -24,9 +29,6 @@ module PaperTrailDiff
|
|
|
24
29
|
|
|
25
30
|
@before_attributes: Hash[String, untyped]
|
|
26
31
|
|
|
27
|
-
# : (Hash[untyped, untyped]) -> Hash[String, untyped]
|
|
28
|
-
def normalize_hash: (Hash[untyped, untyped]) -> Hash[String, untyped]
|
|
29
|
-
|
|
30
32
|
# : (untyped) -> Array[untyped]
|
|
31
33
|
def relationship_keys: (untyped) -> Array[untyped]
|
|
32
34
|
end
|
|
@@ -13,6 +13,8 @@ module PaperTrailDiff
|
|
|
13
13
|
# share these snapshots too, and the caches their refresher builds. They
|
|
14
14
|
# are the same for any root with that history, so reusing them depends on
|
|
15
15
|
# nothing but the history.
|
|
16
|
+
#
|
|
17
|
+
# A `start_at` is a window's; a range of versions starts at its first.
|
|
16
18
|
# : (untyped, Array[untyped], ?start_at: untyped, ?end_at: untyped) -> PreparedActivitySnapshots
|
|
17
19
|
def prepare: (untyped, Array[untyped], ?start_at: untyped, ?end_at: untyped) -> PreparedActivitySnapshots
|
|
18
20
|
|
|
@@ -40,6 +42,9 @@ module PaperTrailDiff
|
|
|
40
42
|
# : () -> PreparedActivityIndex?
|
|
41
43
|
def activity_index: () -> PreparedActivityIndex?
|
|
42
44
|
|
|
45
|
+
# : () -> Array[Array[untyped]]
|
|
46
|
+
def opening_transactions: () -> Array[Array[untyped]]
|
|
47
|
+
|
|
43
48
|
# : (untyped, untyped) -> RecordSnapshot?
|
|
44
49
|
def call: (untyped, untyped) -> RecordSnapshot?
|
|
45
50
|
|
|
@@ -53,6 +58,11 @@ module PaperTrailDiff
|
|
|
53
58
|
# : (untyped, untyped, tree: AssociationTree, normalizer: SnapshotNormalizer) -> RecordSnapshot?
|
|
54
59
|
def custom: (untyped, untyped, tree: AssociationTree, normalizer: SnapshotNormalizer) -> RecordSnapshot?
|
|
55
60
|
|
|
61
|
+
# The state this root's snapshot at an endpoint is built from, where
|
|
62
|
+
# prepared history builds it.
|
|
63
|
+
# : (untyped) -> PreparedRecordState?
|
|
64
|
+
def root_state: (untyped) -> PreparedRecordState?
|
|
65
|
+
|
|
56
66
|
# : (untyped, habtm_version: untyped) -> untyped
|
|
57
67
|
def association_reader: (untyped, habtm_version: untyped) -> untyped
|
|
58
68
|
|
|
@@ -74,9 +84,6 @@ module PaperTrailDiff
|
|
|
74
84
|
# : (Array[untyped], Array[ActivityEvent], untyped, ?current: untyped) -> void
|
|
75
85
|
def initialize: (Array[untyped], Array[ActivityEvent], untyped, ?current: untyped) -> void
|
|
76
86
|
|
|
77
|
-
# : () -> Array[RecordSnapshot?]
|
|
78
|
-
def call: () -> Array[RecordSnapshot?]
|
|
79
|
-
|
|
80
87
|
# : () { (ActivityEvent, RecordSnapshot?) -> void } -> void
|
|
81
88
|
def each: () { (ActivityEvent, RecordSnapshot?) -> void } -> void
|
|
82
89
|
|
|
@@ -97,6 +104,17 @@ module PaperTrailDiff
|
|
|
97
104
|
# : (ActivityEvent, ActivityEvent, RecordSnapshot?) -> RecordSnapshot?
|
|
98
105
|
def transition_snapshot: (ActivityEvent, ActivityEvent, RecordSnapshot?) -> RecordSnapshot?
|
|
99
106
|
|
|
107
|
+
# A transaction with a root event is read whole once it ends. Until then,
|
|
108
|
+
# PT-AT reads the records it saved as they stood before it began, so from
|
|
109
|
+
# one descendant's event to the next in the same transaction the snapshot
|
|
110
|
+
# is the same, and from the root's event to a descendant's only the root's
|
|
111
|
+
# own version applies, as when it is alone in its transaction. A create
|
|
112
|
+
# leaves nothing to advance. The root's version can record what the
|
|
113
|
+
# transaction changed, such as HABTM membership, so a snapshot at a root
|
|
114
|
+
# event is rebuilt.
|
|
115
|
+
# : (ActivityEvent, ActivityEvent, RecordSnapshot?) -> RecordSnapshot?
|
|
116
|
+
def rebuilt_snapshot: (ActivityEvent, ActivityEvent, RecordSnapshot?) -> RecordSnapshot?
|
|
117
|
+
|
|
100
118
|
# : (ActivityEvent) -> bool
|
|
101
119
|
def incremental_root?: (ActivityEvent) -> bool
|
|
102
120
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
# Generated from lib/paper_trail_diff/activity_target_candidate_loader.rb with RBS::Inline
|
|
2
2
|
|
|
3
3
|
module PaperTrailDiff
|
|
4
|
-
# Loads the `belongs_to` targets owners pointed at
|
|
5
|
-
#
|
|
4
|
+
# Loads the `belongs_to` targets owners pointed at from a start onward: at
|
|
5
|
+
# the start, after each change since, and in the live row.
|
|
6
6
|
#
|
|
7
7
|
# PT-AT records a version's foreign keys as they stood after its change, so
|
|
8
|
-
# the target at the start comes from the latest version before it
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
# change there -- an author renamed under an article nobody edited.
|
|
8
|
+
# the target at the start comes from the latest version before it. Reading
|
|
9
|
+
# only the owners' versions after the start misses a target whose owner did
|
|
10
|
+
# not change there -- an author renamed under an article nobody edited.
|
|
12
11
|
class ActivityTargetCandidateLoader
|
|
13
12
|
# A plain class rather than Data.define, which arrived in Ruby 3.2 while this
|
|
14
13
|
# gem supports 3.1.
|
|
@@ -23,20 +22,15 @@ module PaperTrailDiff
|
|
|
23
22
|
|
|
24
23
|
attr_reader event: String?
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
# : (untyped, untyped, String?, ?untyped, ?String?, ?untyped) -> void
|
|
29
|
-
def initialize: (untyped, untyped, String?, ?untyped, ?String?, ?untyped) -> void
|
|
25
|
+
# : (untyped, untyped, String?, ?untyped, ?String?) -> void
|
|
26
|
+
def initialize: (untyped, untyped, String?, ?untyped, ?String?) -> void
|
|
30
27
|
end
|
|
31
28
|
|
|
32
|
-
# : (untyped, Array[untyped], untyped,
|
|
33
|
-
def initialize: (untyped, Array[untyped], untyped,
|
|
34
|
-
|
|
35
|
-
# : () -> Array[Row]
|
|
36
|
-
def call: () -> Array[Row]
|
|
29
|
+
# : (untyped, Array[untyped], untyped, untyped) -> void
|
|
30
|
+
def initialize: (untyped, Array[untyped], untyped, untyped) -> void
|
|
37
31
|
|
|
38
|
-
#
|
|
39
|
-
#
|
|
32
|
+
# Queries shared by a batch's roots keep the owner and timestamp needed to
|
|
33
|
+
# partition its candidates back into each root's exact activity range.
|
|
40
34
|
# : () -> Array[Row]
|
|
41
35
|
def historical_rows: () -> Array[Row]
|
|
42
36
|
|
|
@@ -50,12 +44,16 @@ module PaperTrailDiff
|
|
|
50
44
|
|
|
51
45
|
@owner_ids: Array[untyped]
|
|
52
46
|
|
|
53
|
-
@range: ActivityRange
|
|
54
|
-
|
|
55
47
|
@reflection: untyped
|
|
56
48
|
|
|
57
|
-
|
|
58
|
-
|
|
49
|
+
@start_at: untyped
|
|
50
|
+
|
|
51
|
+
# Each statement reads the targets of 500 owners.
|
|
52
|
+
# : () -> Enumerator[Array[untyped], untyped]
|
|
53
|
+
def owner_slices: () -> Enumerator[Array[untyped], untyped]
|
|
54
|
+
|
|
55
|
+
# : (untyped, Array[untyped]) -> untyped
|
|
56
|
+
def historical_relation: (untyped, Array[untyped]) -> untyped
|
|
59
57
|
|
|
60
58
|
# : (untyped, untyped) -> Array[Array[untyped]]
|
|
61
59
|
def historical_columns: (untyped, untyped) -> Array[Array[untyped]]
|
|
@@ -67,9 +65,6 @@ module PaperTrailDiff
|
|
|
67
65
|
# : () -> Array[Array[untyped]]
|
|
68
66
|
def live_rows: () -> Array[Array[untyped]]
|
|
69
67
|
|
|
70
|
-
# : (untyped) -> VersionAssociationCandidateScope
|
|
71
|
-
def candidate_scope: (untyped) -> VersionAssociationCandidateScope
|
|
72
|
-
|
|
73
68
|
# : () -> untyped
|
|
74
69
|
def association_class: () -> untyped
|
|
75
70
|
|
|
@@ -9,12 +9,19 @@ module PaperTrailDiff
|
|
|
9
9
|
# window reports only the events inside it, and closes on a final destroy,
|
|
10
10
|
# or on the live row when nothing recorded follows it.
|
|
11
11
|
class ActivityTimelineBuilder
|
|
12
|
-
#
|
|
13
|
-
|
|
12
|
+
# `traversal` holds the tree and reads its reflections; the adapter passes
|
|
13
|
+
# the one it reads every root with, so they are resolved once for a call
|
|
14
|
+
# rather than once for each root.
|
|
15
|
+
# : (untyped, range: TimelineRange, snapshotter: untyped, view: ActivityView, traversal: AssociationTraversal) -> void
|
|
16
|
+
def initialize: (untyped, range: TimelineRange, snapshotter: untyped, view: ActivityView, traversal: AssociationTraversal) -> void
|
|
14
17
|
|
|
15
18
|
# : () -> Array[ActivityStep]
|
|
16
19
|
def build: () -> Array[ActivityStep]
|
|
17
20
|
|
|
21
|
+
# The window the range covers once its edges have moved to transactions.
|
|
22
|
+
# : () -> TimeRange?
|
|
23
|
+
def window: () -> TimeRange?
|
|
24
|
+
|
|
18
25
|
# Builds the endpoint diff, the root timeline, and the activity from one
|
|
19
26
|
# activity snapshot pass.
|
|
20
27
|
# : () -> Analysis
|
|
@@ -22,6 +29,8 @@ module PaperTrailDiff
|
|
|
22
29
|
|
|
23
30
|
private
|
|
24
31
|
|
|
32
|
+
@filter: ActivityScopeFilter?
|
|
33
|
+
|
|
25
34
|
@range: TimelineRange
|
|
26
35
|
|
|
27
36
|
@record: untyped
|
|
@@ -30,6 +39,8 @@ module PaperTrailDiff
|
|
|
30
39
|
|
|
31
40
|
@to: untyped
|
|
32
41
|
|
|
42
|
+
@traversal: AssociationTraversal
|
|
43
|
+
|
|
33
44
|
@tree: AssociationTree
|
|
34
45
|
|
|
35
46
|
@view: ActivityView
|
|
@@ -37,42 +48,67 @@ module PaperTrailDiff
|
|
|
37
48
|
# : () -> Array[ActivityStep]
|
|
38
49
|
def no_steps: () -> Array[ActivityStep]
|
|
39
50
|
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
# : () -> Array[ActivityStep]
|
|
46
|
-
def
|
|
47
|
-
|
|
48
|
-
#
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
#
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
# Each kind of range replays into the same things, or into nil when it
|
|
52
|
+
# reports no step: its plan and history, the steps it reports, ending with
|
|
53
|
+
# the one that closes the range after its last event, the state it ends
|
|
54
|
+
# at, and the live record's snapshot and when it was read, which the root
|
|
55
|
+
# timeline's closing step reads.
|
|
56
|
+
# : (RootVersionPlan, ActivityHistory, ActivityStep?, RecordSnapshot?, ?RecordSnapshot?, ?untyped) -> [RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped]?
|
|
57
|
+
def replayed: (RootVersionPlan, ActivityHistory, ActivityStep?, RecordSnapshot?, ?RecordSnapshot?, ?untyped) -> [ RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped ]?
|
|
58
|
+
|
|
59
|
+
# : ([RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped]?) -> Array[ActivityStep]
|
|
60
|
+
def steps_of: ([ RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped ]?) -> Array[ActivityStep]
|
|
61
|
+
|
|
62
|
+
# A range that reports no step is empty, whatever its replay read: a
|
|
63
|
+
# version filter may keep nothing in it, or only the version that ends it,
|
|
64
|
+
# which opens no step, and a range may run from a version to itself.
|
|
65
|
+
# : ([RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped]?) -> Analysis
|
|
66
|
+
def analysis: ([ RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped ]?) -> Analysis
|
|
67
|
+
|
|
68
|
+
# Every boundary between the endpoints, filtered out or not: dropping one
|
|
69
|
+
# would fold the change it carried into a neighbouring step and credit it
|
|
70
|
+
# to whoever made that one. A version filter decides only which of the
|
|
71
|
+
# steps are reported (see #reported?). Only the activity view gains the
|
|
72
|
+
# closing removal. The endpoint diff and the root timeline keep their
|
|
73
|
+
# `compare` and `timeline` semantics, under which the state at a destroy
|
|
74
|
+
# version is the state before the deletion.
|
|
75
|
+
# : () -> [RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped]?
|
|
76
|
+
def version_replay: () -> [ RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped ]?
|
|
77
|
+
|
|
78
|
+
# Activity replays every root version in the range, even those a version
|
|
79
|
+
# filter leaves out, so that each change it keeps is read as the whole
|
|
80
|
+
# history shows it. Only a window reads a context: an explicit range
|
|
81
|
+
# always holds a version.
|
|
82
|
+
# : () -> RootVersionPlan
|
|
83
|
+
def select_plan: () -> RootVersionPlan
|
|
84
|
+
|
|
85
|
+
# Whether the event's step is reported: it is inside the range, and a
|
|
86
|
+
# version filter keeps it. With associations the filter keeps whole
|
|
87
|
+
# transactions (see ActivityScopeFilter). On the root alone it keeps the
|
|
88
|
+
# root's versions, as `timeline` does, and so does a plan without one, but
|
|
89
|
+
# for the version it holds only to reveal the last change in it.
|
|
90
|
+
# : (ActivityEvent, RootVersionPlan) -> bool
|
|
91
|
+
def reported?: (ActivityEvent, RootVersionPlan) -> bool
|
|
57
92
|
|
|
58
93
|
# The explicit live endpoint and a batch's live closing endpoint use the
|
|
59
|
-
# same selected plan
|
|
60
|
-
#
|
|
61
|
-
|
|
94
|
+
# same selected plan, which replays every version through to the current
|
|
95
|
+
# record, a version filter or not.
|
|
96
|
+
# : () -> [RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped]?
|
|
97
|
+
def current_replay: () -> [ RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped ]?
|
|
62
98
|
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
|
|
99
|
+
# A range that closes after its last event ends at what closed it: the
|
|
100
|
+
# live row, or nothing after a destroy, where no live row is read. One
|
|
101
|
+
# that does not ends at the state its last reported step reached.
|
|
102
|
+
# : (RootVersionPlan, ActivityHistory, untyped, untyped, RecordSnapshot?) -> [RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped]?
|
|
103
|
+
def live_replay: (RootVersionPlan, ActivityHistory, untyped, untyped, RecordSnapshot?) -> [ RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped ]?
|
|
67
104
|
|
|
68
|
-
#
|
|
69
|
-
|
|
70
|
-
# mutant:disable
|
|
71
|
-
# : (RootVersionPlan) -> [RootVersionPlan, ActivityHistory, RecordSnapshot?, ActivityBoundary?]
|
|
72
|
-
def empty_history: (RootVersionPlan) -> [ RootVersionPlan, ActivityHistory, RecordSnapshot?, ActivityBoundary? ]
|
|
105
|
+
# : (RootVersionPlan, ?RecordSnapshot?, ?untyped) -> ActivityHistory
|
|
106
|
+
def history_until: (RootVersionPlan, ?RecordSnapshot?, ?untyped) -> ActivityHistory
|
|
73
107
|
|
|
74
|
-
#
|
|
75
|
-
|
|
108
|
+
# The range's events up to its last root version, or to the instant the
|
|
109
|
+
# live record it closes on was read, with the history they are read from.
|
|
110
|
+
# : (RootVersionPlan, untyped) -> [Array[ActivityEvent], untyped]
|
|
111
|
+
def range_events: (RootVersionPlan, untyped) -> [ Array[ActivityEvent], untyped ]
|
|
76
112
|
|
|
77
113
|
# : () -> [RecordSnapshot?, untyped]
|
|
78
114
|
def capture_current: () -> [ RecordSnapshot?, untyped ]
|
|
@@ -80,97 +116,54 @@ module PaperTrailDiff
|
|
|
80
116
|
# : () -> void
|
|
81
117
|
def validate_current_range!: () -> void
|
|
82
118
|
|
|
83
|
-
#
|
|
84
|
-
#
|
|
85
|
-
#
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
#
|
|
91
|
-
#
|
|
92
|
-
# : (Array[
|
|
93
|
-
def
|
|
94
|
-
|
|
95
|
-
#
|
|
96
|
-
#
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
# :
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
# : () -> Analysis
|
|
105
|
-
def analyze_window: () -> Analysis
|
|
106
|
-
|
|
107
|
-
# A window with a closing step ends at what closed it: the live row, or
|
|
108
|
-
# nothing after a destroy, where no live row is read. One that ends before
|
|
109
|
-
# a later event ends at the state that event found.
|
|
110
|
-
# : (ActivityHistory, ActivityStep?, RecordSnapshot?) -> RecordSnapshot?
|
|
111
|
-
def window_final_snapshot: (ActivityHistory, ActivityStep?, RecordSnapshot?) -> RecordSnapshot?
|
|
112
|
-
|
|
113
|
-
# : () -> [ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped]
|
|
114
|
-
def window_history: () -> [ ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped ]
|
|
115
|
-
|
|
116
|
-
# Nothing reads a window's closing step, live snapshot, or capture time
|
|
117
|
-
# when it reported nothing, so mutations of those cannot change an answer.
|
|
118
|
-
# mutant:disable
|
|
119
|
-
# : (RootVersionPlan) -> [ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped]
|
|
120
|
-
def empty_window: (RootVersionPlan) -> [ ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped ]
|
|
121
|
-
|
|
122
|
-
# A window with no selected event reports nothing. Any other has a
|
|
123
|
-
# boundary after its last one: the plan refuses a window that has no later
|
|
124
|
-
# version, ends on no destroy, and does not close on the live row.
|
|
125
|
-
# : (RootVersionPlan, untyped) -> [ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped]
|
|
126
|
-
def window_replay: (RootVersionPlan, untyped) -> [ ActivityHistory, RootVersionPlan, ActivityStep?, RecordSnapshot?, untyped ]
|
|
127
|
-
|
|
128
|
-
# One live read serves both the closing activity step and the endpoint the
|
|
129
|
-
# analysis reports, which would otherwise reconstruct the graph twice.
|
|
130
|
-
# : (RootVersionPlan) -> RecordSnapshot?
|
|
131
|
-
def window_live_snapshot: (RootVersionPlan) -> RecordSnapshot?
|
|
132
|
-
|
|
133
|
-
# Root versions inside the window that the plan does not report are context
|
|
134
|
-
# rather than mutations: the version appended to reveal the last selected
|
|
135
|
-
# change, and anything a filter excluded but the replay still walks. Neither
|
|
136
|
-
# may be counted as a selected mutation. Descendant events are not filtered,
|
|
137
|
-
# so window membership is the whole test for them.
|
|
138
|
-
# : (Array[ActivityEvent], RootVersionPlan) -> Array[ActivityEvent]
|
|
139
|
-
def selected_events: (Array[ActivityEvent], RootVersionPlan) -> Array[ActivityEvent]
|
|
140
|
-
|
|
141
|
-
# A window either closes on the absence its final destruction leaves, or on
|
|
142
|
-
# current state when it reaches past everything recorded. Both are boundaries
|
|
143
|
-
# no version can supply.
|
|
119
|
+
# A window with no selected event reports nothing, and so does one whose
|
|
120
|
+
# replay left out every event it selected, each of a record outside the
|
|
121
|
+
# tree throughout, such as a comment created outside a scope. Any other
|
|
122
|
+
# has a boundary after its last event: the plan refuses a window that has
|
|
123
|
+
# no later version, ends on no destroy, and does not close on the live row.
|
|
124
|
+
#
|
|
125
|
+
# A window closing on current state runs to the instant it is captured,
|
|
126
|
+
# not to the last root version, or descendants that moved after that
|
|
127
|
+
# version would be missing from a report that claims to reach now.
|
|
128
|
+
# : () -> [RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped]?
|
|
129
|
+
def window_replay: () -> [ RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped ]?
|
|
130
|
+
|
|
131
|
+
# The live record is read only once something in the window is reported.
|
|
132
|
+
# : (RootVersionPlan, untyped, untyped) -> [RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped]?
|
|
133
|
+
def window_activity: (RootVersionPlan, untyped, untyped) -> [ RootVersionPlan, ActivityHistory, Array[ActivityStep], RecordSnapshot?, RecordSnapshot?, untyped ]?
|
|
134
|
+
|
|
135
|
+
# The step that closes the range after its last event, which is reported
|
|
136
|
+
# as that event's step would be. It runs from the last boundary the
|
|
137
|
+
# history kept into one no version can supply: the live record the range
|
|
138
|
+
# closes on, or the absence a final root destroy leaves.
|
|
144
139
|
#
|
|
145
140
|
# Everything recorded means on every requested path, not only the root's
|
|
146
|
-
# own versions. When an association changed after
|
|
147
|
-
#
|
|
148
|
-
#
|
|
149
|
-
#
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
# : (ActivityHistory,
|
|
153
|
-
def
|
|
154
|
-
|
|
155
|
-
#
|
|
156
|
-
#
|
|
157
|
-
#
|
|
158
|
-
#
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
# : (ActivityEvent) -> bool
|
|
162
|
-
def terminal_destroy?: (ActivityEvent) -> bool
|
|
141
|
+
# own versions. When an association changed after a window, its last step
|
|
142
|
+
# already ends at that change, at the state the window left, and that
|
|
143
|
+
# change is the last kept event, outside the window; closing on current
|
|
144
|
+
# state would add it to a window it was not in. A plan that does not close
|
|
145
|
+
# on the current record holds a version after the window, which is such a
|
|
146
|
+
# change, or ends at a destruction.
|
|
147
|
+
# : (ActivityHistory, RootVersionPlan, ?untyped, ?untyped, ?RecordSnapshot?) -> ActivityStep?
|
|
148
|
+
def closing_step: (ActivityHistory, RootVersionPlan, ?untyped, ?untyped, ?RecordSnapshot?) -> ActivityStep?
|
|
149
|
+
|
|
150
|
+
# Without a live record to close on, a range closes only on the root's
|
|
151
|
+
# destruction, and its last event is then the root's own: the version
|
|
152
|
+
# that ends an explicit range, or a window's version after it, or the
|
|
153
|
+
# destroy nothing follows.
|
|
154
|
+
# : (ActivityEvent?, RootVersionPlan, untyped, untyped) -> ActivityBoundary?
|
|
155
|
+
def closing_boundary: (ActivityEvent?, RootVersionPlan, untyped, untyped) -> ActivityBoundary?
|
|
163
156
|
|
|
164
157
|
# : () -> void
|
|
165
158
|
def reject_live_habtm!: () -> void
|
|
166
159
|
|
|
167
|
-
# : () ->
|
|
168
|
-
def root_recorded: () ->
|
|
160
|
+
# : () -> RecordedChangesReader?
|
|
161
|
+
def root_recorded: () -> RecordedChangesReader?
|
|
169
162
|
|
|
170
163
|
# A window prepares from its start, explicit endpoints from their first
|
|
171
164
|
# version.
|
|
172
|
-
# : (Array[untyped],
|
|
173
|
-
def prepare_history: (Array[untyped],
|
|
165
|
+
# : (Array[untyped], end_at: untyped) -> untyped
|
|
166
|
+
def prepare_history: (Array[untyped], end_at: untyped) -> untyped
|
|
174
167
|
|
|
175
168
|
# A window collects from its start, explicit endpoints from their first
|
|
176
169
|
# version. Explicit endpoints also stop before the rest of the closing
|
|
@@ -179,21 +172,26 @@ module PaperTrailDiff
|
|
|
179
172
|
# : (Array[untyped], untyped, range_end: untyped) -> Array[ActivityEvent]
|
|
180
173
|
def collect_events: (Array[untyped], untyped, range_end: untyped) -> Array[ActivityEvent]
|
|
181
174
|
|
|
182
|
-
#
|
|
183
|
-
#
|
|
184
|
-
#
|
|
185
|
-
|
|
186
|
-
def replay: (Array[untyped], Array[ActivityEvent], untyped, ?current: untyped, ?closing: RecordSnapshot?) -> ActivityHistory
|
|
175
|
+
# A version filter reads its answers for a batch's history once, for the
|
|
176
|
+
# first root that history serves.
|
|
177
|
+
# : (untyped, Array[ActivityEvent]) -> void
|
|
178
|
+
def prepare_filter: (untyped, Array[ActivityEvent]) -> void
|
|
187
179
|
|
|
188
|
-
#
|
|
189
|
-
# the range.
|
|
190
|
-
#
|
|
191
|
-
|
|
180
|
+
# Events after the last root version read the root from the live record
|
|
181
|
+
# when the range closes on it. Explicit endpoints report every step their
|
|
182
|
+
# plan does, as their range includes every version.
|
|
183
|
+
# : (RootVersionPlan, Array[ActivityEvent], untyped, current: untyped, closing: RecordSnapshot?) -> ActivityHistory
|
|
184
|
+
def replay: (RootVersionPlan, Array[ActivityEvent], untyped, current: untyped, closing: RecordSnapshot?) -> ActivityHistory
|
|
185
|
+
|
|
186
|
+
# The root as a change row's `record` would name it. A root is a record,
|
|
187
|
+
# or a deleted one rebuilt from its destroy (see DeletedAnalysisBatch).
|
|
188
|
+
# A reference reads its type with `to_s`, so mutant cannot tell the class
|
|
189
|
+
# from its name here.
|
|
190
|
+
# mutant:disable
|
|
191
|
+
# : () -> RecordReference
|
|
192
|
+
def root_reference: () -> RecordReference
|
|
192
193
|
|
|
193
194
|
# : (Array[ActivityStep]) -> Array[ActivityStep]
|
|
194
195
|
def present: (Array[ActivityStep]) -> Array[ActivityStep]
|
|
195
|
-
|
|
196
|
-
# : (RootVersionPlan, ActivityHistory, final: RecordSnapshot?, steps: Array[ActivityStep], ?closing_snapshot: RecordSnapshot?, ?captured_at: untyped) -> Analysis
|
|
197
|
-
def analysis: (RootVersionPlan, ActivityHistory, final: RecordSnapshot?, steps: Array[ActivityStep], ?closing_snapshot: RecordSnapshot?, ?captured_at: untyped) -> Analysis
|
|
198
196
|
end
|
|
199
197
|
end
|
|
@@ -14,14 +14,28 @@ module PaperTrailDiff
|
|
|
14
14
|
# PT-AT reads associations as they were before a transaction, so a record
|
|
15
15
|
# is judged by two snapshots: the one at its transaction's first event, and
|
|
16
16
|
# the one after its last, which is the next event's or what the range
|
|
17
|
-
# closes on. A
|
|
17
|
+
# closes on. A root version inside the transaction is the exception: it
|
|
18
|
+
# reads the has_and_belongs_to_many members it records, including a record
|
|
19
|
+
# the transaction created before it, so the snapshots at the transaction's
|
|
20
|
+
# root events are read too. A tag created, attached and detached again
|
|
21
|
+
# before the next root version is in the tree only there. A record in none
|
|
22
|
+
# of these was outside the tree throughout.
|
|
18
23
|
#
|
|
19
|
-
# The root's own events are always kept, and so
|
|
20
|
-
#
|
|
21
|
-
# step is
|
|
24
|
+
# The root's own events are always kept, and so is an event whose step is
|
|
25
|
+
# not reported, which only bounds one that is, unless its transaction has an
|
|
26
|
+
# event whose step is: the transaction crossed the window's end. A version
|
|
27
|
+
# it saved after the edge reads each record as it stood before the
|
|
28
|
+
# transaction, so a step ending there shows none of its changes. Judged
|
|
29
|
+
# like the rest, as the window after the edge judges it, the event bounds
|
|
30
|
+
# that step when the later window reports the transaction; left out, the
|
|
31
|
+
# step runs past it and reports the changes here instead (see
|
|
32
|
+
# ActivityHistoryBuilder#consume). A snapshot does not hold a through's join
|
|
33
|
+
# rows, so their versions are judged when they are collected, by the row's
|
|
34
|
+
# own state (PreparedActivityIndex#join_versions), and kept here.
|
|
22
35
|
class ActivityTreeFilter
|
|
23
|
-
# `
|
|
24
|
-
#
|
|
36
|
+
# `reported` says whether an event's step is reported. `closing` is the
|
|
37
|
+
# snapshot after the last event: the current record's, or nil when
|
|
38
|
+
# nothing follows, as after the root's destruction.
|
|
25
39
|
# : (Array[ActivityEvent], reported: untyped, closing: RecordSnapshot?) -> void
|
|
26
40
|
def initialize: (Array[ActivityEvent], reported: untyped, closing: RecordSnapshot?) -> void
|
|
27
41
|
|
|
@@ -36,8 +50,14 @@ module PaperTrailDiff
|
|
|
36
50
|
|
|
37
51
|
@ends: Array[Integer]
|
|
38
52
|
|
|
53
|
+
@judged: Set[Array[untyped] | Integer]
|
|
54
|
+
|
|
55
|
+
@keys: Array[Array[untyped] | Integer]
|
|
56
|
+
|
|
39
57
|
@reported: untyped
|
|
40
58
|
|
|
59
|
+
@roots: Hash[Array[untyped] | Integer, Array[Integer]]
|
|
60
|
+
|
|
41
61
|
@starts: Array[Integer]
|
|
42
62
|
|
|
43
63
|
@types: Hash[String, Array[String?]]
|
|
@@ -45,14 +65,27 @@ module PaperTrailDiff
|
|
|
45
65
|
# : (ActivityEvent, Integer, Array[[ActivityEvent, RecordSnapshot?]]) -> bool
|
|
46
66
|
def keep?: (ActivityEvent, Integer, Array[[ ActivityEvent, RecordSnapshot? ]]) -> bool
|
|
47
67
|
|
|
68
|
+
# The snapshots at the first event and the root events of the event's
|
|
69
|
+
# transaction, and the one after its last event.
|
|
70
|
+
# : (Integer, Array[untyped] | Integer, Array[[ActivityEvent, RecordSnapshot?]]) -> Array[RecordSnapshot?]
|
|
71
|
+
def judged_by: (Integer, Array[untyped] | Integer, Array[[ ActivityEvent, RecordSnapshot? ]]) -> Array[RecordSnapshot?]
|
|
72
|
+
|
|
48
73
|
# : (ActivityEvent) -> bool
|
|
49
74
|
def reported?: (ActivityEvent) -> bool
|
|
50
75
|
|
|
51
76
|
# Where each event's transaction starts, and the position just past its
|
|
52
77
|
# last event. Two transactions can interleave, so a transaction's events
|
|
53
78
|
# need not be adjacent.
|
|
54
|
-
# : (Array[
|
|
55
|
-
def spans: (Array[
|
|
79
|
+
# : (Array[Array[untyped] | Integer]) -> [Array[Integer], Array[Integer]]
|
|
80
|
+
def spans: (Array[Array[untyped] | Integer]) -> [ Array[Integer], Array[Integer] ]
|
|
81
|
+
|
|
82
|
+
# Where each transaction's root events are.
|
|
83
|
+
# : (Array[ActivityEvent]) -> Hash[Array[untyped] | Integer, Array[Integer]]
|
|
84
|
+
def root_positions: (Array[ActivityEvent]) -> Hash[Array[untyped] | Integer, Array[Integer]]
|
|
85
|
+
|
|
86
|
+
# The transactions that have an event whose step is reported.
|
|
87
|
+
# : (Array[ActivityEvent]) -> Set[Array[untyped] | Integer]
|
|
88
|
+
def reported_transactions: (Array[ActivityEvent]) -> Set[Array[untyped] | Integer]
|
|
56
89
|
|
|
57
90
|
# A version saved outside a transaction is a transaction of its own,
|
|
58
91
|
# keyed by its position.
|