Bound the migration bridge transaction

f291cf64f6cf · AtlantisPleb · · parent d8dd91b08ca6

Bound the migration bridge transaction

Deploy story

What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.

Not deployed through the forge lane

No push, promotion, build, or deploy receipt references this commit (receipts are scanned over a bounded recent window). Changes shipped by full node replacement carry their proof in the release gate receipt instead.

Changed files

  • modified lib/openagents/migration_lineage.ex

Diff

1 file changed, +29 -26

lib/openagents/migration_lineage.ex modified +29 -26

@@ -32,32 +32,35 @@ defmodule OpenAgents.MigrationLineage do

32 32
         :ok <- validate_snapshot_ref(snapshot_ref) do
33 33
      map = load_map!()
34 34
35
      repo.transaction(fn ->
36
        _lock = SQL.query!(repo, "SELECT pg_advisory_xact_lock($1)", [@lock_id])
37
        before = classify_repo(repo, map)
38
39
        case before.classification do
40
          "prior" ->
41
            apply_bridge!(repo)
42
            insert_baseline_versions!(repo, baseline_versions(map))
43
            after_baseline = classify_repo(repo, map)
44
45
            if after_baseline.classification != "prior_baselined" do
46
              repo.rollback(:baseline_postcondition_failed)
47
            end
48
49
            result(after_baseline, snapshot_ref, true)
50
51
          "prior_baselined" ->
52
            result(before, snapshot_ref, false)
53
54
          "prior_partial" ->
55
            repo.rollback(:partial_lineage_forbidden)
56
57
          _other ->
58
            repo.rollback(:lineage_not_baselineable)
59
        end
60
      end)
35
      repo.transaction(
36
        fn ->
37
          _lock = SQL.query!(repo, "SELECT pg_advisory_xact_lock($1)", [@lock_id])
38
          before = classify_repo(repo, map)
39
40
          case before.classification do
41
            "prior" ->
42
              apply_bridge!(repo)
43
              insert_baseline_versions!(repo, baseline_versions(map))
44
              after_baseline = classify_repo(repo, map)
45
46
              if after_baseline.classification != "prior_baselined" do
47
                repo.rollback(:baseline_postcondition_failed)
48
              end
49
50
              result(after_baseline, snapshot_ref, true)
51
52
            "prior_baselined" ->
53
              result(before, snapshot_ref, false)
54
55
            "prior_partial" ->
56
              repo.rollback(:partial_lineage_forbidden)
57
58
            _other ->
59
              repo.rollback(:lineage_not_baselineable)
60
          end
61
        end,
62
        timeout: 120_000
63
      )
61 64
      |> normalize_transaction()
62 65
    end
63 66
  end

This page updates live while a promote is in flight · changelog