historiographer 4.4.3 → 4.4.5

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +54 -3
  3. data/Rakefile +14 -0
  4. data/VERSION +1 -1
  5. data/historiographer.gemspec +26 -13
  6. data/lib/historiographer/history.rb +4 -1
  7. data/lib/historiographer.rb +12 -7
  8. data/spec/db/migrate/20250827000000_create_templates.rb +9 -0
  9. data/spec/db/migrate/20250827000001_create_template_histories.rb +9 -0
  10. data/spec/db/migrate/20250827000002_create_websites.rb +9 -0
  11. data/spec/db/migrate/20250827000003_create_website_histories.rb +9 -0
  12. data/spec/db/migrate/20250827000004_create_template_files.rb +15 -0
  13. data/spec/db/migrate/20250827000005_create_template_file_histories.rb +9 -0
  14. data/spec/db/migrate/20250827000006_create_website_files.rb +15 -0
  15. data/spec/db/migrate/20250827000007_create_website_file_histories.rb +9 -0
  16. data/spec/db/migrate/20250827000008_create_code_files_view.rb +62 -0
  17. data/spec/db/schema.rb +126 -1
  18. data/spec/examples.txt +72 -0
  19. data/spec/historiographer_spec.rb +30 -0
  20. data/spec/internal/log/development.log +0 -0
  21. data/spec/internal/log/test.log +1479 -0
  22. data/spec/models/code_file.rb +16 -0
  23. data/spec/models/template.rb +6 -0
  24. data/spec/models/template_file.rb +5 -0
  25. data/spec/models/template_file_history.rb +3 -0
  26. data/spec/models/template_history.rb +3 -0
  27. data/spec/models/website.rb +7 -0
  28. data/spec/models/website_file.rb +5 -0
  29. data/spec/models/website_file_history.rb +3 -0
  30. data/spec/models/website_history.rb +3 -0
  31. data/spec/view_backed_model_spec.rb +166 -0
  32. metadata +24 -11
  33. data/.document +0 -5
  34. data/.rspec +0 -1
  35. data/.ruby-version +0 -1
  36. data/.standalone_migrations +0 -6
  37. data/Gemfile.lock +0 -355
  38. data/historiographer-4.1.12.gem +0 -0
  39. data/historiographer-4.1.13.gem +0 -0
  40. data/historiographer-4.1.14.gem +0 -0
  41. data/historiographer-4.3.0.gem +0 -0
data/spec/examples.txt ADDED
@@ -0,0 +1,72 @@
1
+ example_id | status | run_time |
2
+ ------------------------------------------------------------------ | ------ | --------------- |
3
+ ./spec/historiographer_spec.rb[1:1:1] | passed | 0.07846 seconds |
4
+ ./spec/historiographer_spec.rb[1:1:2] | passed | 0.05421 seconds |
5
+ ./spec/historiographer_spec.rb[1:1:3] | passed | 0.05161 seconds |
6
+ ./spec/historiographer_spec.rb[1:2:1] | passed | 0.05923 seconds |
7
+ ./spec/historiographer_spec.rb[1:2:2] | passed | 0.0649 seconds |
8
+ ./spec/historiographer_spec.rb[1:2:3:1:1] | passed | 0.10678 seconds |
9
+ ./spec/historiographer_spec.rb[1:2:3:1:2] | passed | 0.07362 seconds |
10
+ ./spec/historiographer_spec.rb[1:2:3:2:1] | passed | 0.0583 seconds |
11
+ ./spec/historiographer_spec.rb[1:2:3:2:2] | passed | 0.06499 seconds |
12
+ ./spec/historiographer_spec.rb[1:2:3:2:3] | passed | 0.07272 seconds |
13
+ ./spec/historiographer_spec.rb[1:2:3:3:1] | passed | 0.07946 seconds |
14
+ ./spec/historiographer_spec.rb[1:2:3:3:2] | passed | 0.0671 seconds |
15
+ ./spec/historiographer_spec.rb[1:2:4:1] | passed | 0.06979 seconds |
16
+ ./spec/historiographer_spec.rb[1:2:4:2] | passed | 0.06026 seconds |
17
+ ./spec/historiographer_spec.rb[1:2:4:3] | passed | 0.05019 seconds |
18
+ ./spec/historiographer_spec.rb[1:2:5:1] | passed | 0.0693 seconds |
19
+ ./spec/historiographer_spec.rb[1:2:5:2] | passed | 0.06955 seconds |
20
+ ./spec/historiographer_spec.rb[1:2:5:3] | passed | 0.05246 seconds |
21
+ ./spec/historiographer_spec.rb[1:2:6] | passed | 0.04995 seconds |
22
+ ./spec/historiographer_spec.rb[1:2:7] | passed | 0.05019 seconds |
23
+ ./spec/historiographer_spec.rb[1:2:8] | passed | 0.05534 seconds |
24
+ ./spec/historiographer_spec.rb[1:3:1] | passed | 0.05769 seconds |
25
+ ./spec/historiographer_spec.rb[1:4:1] | passed | 0.07179 seconds |
26
+ ./spec/historiographer_spec.rb[1:5:1] | passed | 0.05631 seconds |
27
+ ./spec/historiographer_spec.rb[1:5:2] | passed | 0.0544 seconds |
28
+ ./spec/historiographer_spec.rb[1:6:1] | passed | 0.05814 seconds |
29
+ ./spec/historiographer_spec.rb[1:6:2] | passed | 0.08519 seconds |
30
+ ./spec/historiographer_spec.rb[1:7:1] | passed | 0.0567 seconds |
31
+ ./spec/historiographer_spec.rb[1:7:2] | passed | 0.0759 seconds |
32
+ ./spec/historiographer_spec.rb[1:7:3] | passed | 0.05536 seconds |
33
+ ./spec/historiographer_spec.rb[1:7:4] | passed | 0.05564 seconds |
34
+ ./spec/historiographer_spec.rb[1:7:5] | passed | 0.07313 seconds |
35
+ ./spec/historiographer_spec.rb[1:8:1] | passed | 0.05466 seconds |
36
+ ./spec/historiographer_spec.rb[1:9:1] | passed | 0.07755 seconds |
37
+ ./spec/historiographer_spec.rb[1:10:1] | passed | 0.05444 seconds |
38
+ ./spec/historiographer_spec.rb[1:11:1] | passed | 0.05663 seconds |
39
+ ./spec/historiographer_spec.rb[1:11:2] | passed | 0.07322 seconds |
40
+ ./spec/historiographer_spec.rb[1:11:3] | passed | 0.07853 seconds |
41
+ ./spec/historiographer_spec.rb[1:11:4] | passed | 0.05709 seconds |
42
+ ./spec/historiographer_spec.rb[1:12:1] | passed | 0.07377 seconds |
43
+ ./spec/historiographer_spec.rb[1:12:2] | passed | 0.05676 seconds |
44
+ ./spec/historiographer_spec.rb[1:12:3] | passed | 0.07933 seconds |
45
+ ./spec/historiographer_spec.rb[1:12:4] | passed | 0.07886 seconds |
46
+ ./spec/historiographer_spec.rb[1:12:5] | passed | 0.07857 seconds |
47
+ ./spec/historiographer_spec.rb[1:12:6] | passed | 0.06854 seconds |
48
+ ./spec/historiographer_spec.rb[1:12:7] | passed | 0.08045 seconds |
49
+ ./spec/historiographer_spec.rb[1:13:1] | passed | 0.07652 seconds |
50
+ ./spec/historiographer_spec.rb[1:14:1] | passed | 0.05116 seconds |
51
+ ./spec/historiographer_spec.rb[1:14:2] | passed | 0.06274 seconds |
52
+ ./spec/historiographer_spec.rb[1:14:3] | passed | 0.0698 seconds |
53
+ ./spec/historiographer_spec.rb[1:14:4] | passed | 0.05648 seconds |
54
+ ./spec/historiographer_spec.rb[1:15:1] | passed | 0.05722 seconds |
55
+ ./spec/historiographer_spec.rb[1:15:2] | passed | 0.08476 seconds |
56
+ ./spec/historiographer_spec.rb[1:16:1] | passed | 0.04781 seconds |
57
+ ./spec/historiographer_spec.rb[1:16:2] | passed | 0.04802 seconds |
58
+ ./spec/historiographer_spec.rb[1:16:3] | passed | 0.06019 seconds |
59
+ ./spec/historiographer_spec.rb[1:16:4] | passed | 0.07289 seconds |
60
+ ./spec/historiographer_spec.rb[1:17:1:1] | passed | 0.07235 seconds |
61
+ ./spec/historiographer_spec.rb[1:17:1:2] | passed | 0.06784 seconds |
62
+ ./spec/historiographer_spec.rb[1:17:2:1] | passed | 0.05847 seconds |
63
+ ./spec/integration/historiographer_safe_integration_spec.rb[1:1:1] | passed | 0.06664 seconds |
64
+ ./spec/integration/historiographer_safe_integration_spec.rb[1:1:2] | passed | 0.07357 seconds |
65
+ ./spec/integration/historiographer_safe_integration_spec.rb[1:1:3] | passed | 0.05953 seconds |
66
+ ./spec/view_backed_model_spec.rb[1:1:1] | passed | 0.06878 seconds |
67
+ ./spec/view_backed_model_spec.rb[1:1:2] | passed | 0.08949 seconds |
68
+ ./spec/view_backed_model_spec.rb[1:1:3:1] | passed | 0.11878 seconds |
69
+ ./spec/view_backed_model_spec.rb[1:1:3:2] | passed | 0.1122 seconds |
70
+ ./spec/view_backed_model_spec.rb[1:1:3:3] | passed | 0.10204 seconds |
71
+ ./spec/view_backed_model_spec.rb[1:1:3:4] | passed | 0.11072 seconds |
72
+ ./spec/view_backed_model_spec.rb[1:2:1] | passed | 0.07444 seconds |
@@ -823,6 +823,36 @@ describe Historiographer do
823
823
  expect(post.latest_snapshot.comment_count).to eq 1
824
824
  end
825
825
 
826
+ it "snapshots all children when one has a null_snapshot history record" do
827
+ # This tests a bug where if one child record already has a history with snapshot_id: nil,
828
+ # the snapshot would silently fail to update it due to belongs_to :user validation
829
+ Historiographer::Configuration.mode = :snapshot_only
830
+
831
+ # Create records without triggering histories (snapshot_only mode)
832
+ author1 = Author.create(full_name: 'Author One', history_user_id: user.id)
833
+ author2 = Author.create(full_name: 'Author Two', history_user_id: user.id)
834
+
835
+ # Manually create a null_snapshot history for author1 (simulating previous state)
836
+ # This mimics what happens when a record has a history created outside of snapshot
837
+ AuthorHistory.create!(
838
+ author_id: author1.id,
839
+ full_name: author1.full_name,
840
+ history_user_id: nil, # No user - this will trigger the bug
841
+ snapshot_id: nil, # Null snapshot
842
+ history_started_at: Time.current
843
+ )
844
+
845
+ expect(AuthorHistory.count).to eq 1
846
+ expect(AuthorHistory.where(snapshot_id: nil).count).to eq 1
847
+
848
+ # Now snapshot author1 - this should work even though there's a null_snapshot
849
+ # The bug: without_history_user_id doesn't prevent belongs_to :user validation
850
+ author1.snapshot
851
+
852
+ expect(AuthorHistory.where.not(snapshot_id: nil).count).to eq 1
853
+ expect(AuthorHistory.first.snapshot_id).to be_present
854
+ end
855
+
826
856
  it "doesn't explode" do
827
857
  project = Project.create(name: "test_project")
828
858
  project_file = ProjectFile.create(project: project, name: "test_file", content: "Hello world")
File without changes