# gustavoconti-cloud/postgresql16-migration-lab architecture

> Architecture diagram of the GitHub repository gustavoconti-cloud/postgresql16-migration-lab, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gustavoconti-cloud/postgresql16-migration-lab
- Repository: https://github.com/gustavoconti-cloud/postgresql16-migration-lab

## Overview

This repository is supporting code for a synthetic PostgreSQL 16 migration laboratory, not a production migration service. The operator’s workflow is to configure and provision a disposable AWS lab, run PostgreSQL-to-RDS migration experiments with DMS, observe controlled mismatches and writer barriers, collect and validate cutover evidence, then audit and clean up resources. The graph preserves those documented stages and the safety, guardrail, and cost branches. Some stage connections are documented only at the README level; unsampled implementation details are not inferred.

Main entry points: [`scripts/repro/scripts/control/aws_context.py`](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/aws_context.py) (Lab context), [`scripts/repro/scripts/control/dms_runtime.py`](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/dms_runtime.py) (DMS controls), [`scripts/repro/scripts/infra/build_template.py`](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/infra/build_template.py) (Lab infrastructure), [`scripts/repro/scripts/control/ssm_runtime.py`](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/ssm_runtime.py) (SSM controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_lab["Migration laboratory"]
  node_template["Lab infrastructure<br/>[build_template.py]"]
  node_harness["Migration harness<br/>[lab_harness.py]"]
  node_dms["DMS controls<br/>[dms_runtime.py]"]
end

subgraph group_controls["Operator controls"]
  node_context["Lab context<br/>[aws_context.py]"]
  node_ssm["SSM controls<br/>[ssm_runtime.py]"]
  node_export["Evidence export<br/>[export_evidence.py]"]
  node_proof["Cutover proof<br/>[make_g6_proof.py]"]
end

subgraph group_safety["Safety and verification"]
  node_guardrail["Guardrail builder<br/>[build_guardrail.py]"]
  node_policy["Policy tightening<br/>[tighten_policy.py]"]
  node_ttl["Expiry handler<br/>[ttl_handler.py]"]
  node_cleanup["Lab cleanup<br/>[cleanup_lab.py]"]
  node_cleanup_audit["Cleanup audit<br/>[verify_cleanup.py]"]
  node_tag_audit["Tag audit<br/>[verify_tags.py]"]
  node_tag_apply["Tag correction"]
  node_cost["Runtime cost estimate"]
end

node_operator(("Operator"))
node_aws["AWS services"]

node_operator -->|"configures"| node_context
node_context -->|"supplies bindings"| node_template
node_operator -->|"builds lab"| node_template
node_operator -->|"runs experiments"| node_harness
node_operator -->|"controls replication"| node_dms
node_dms -->|"validates bindings"| node_context
node_operator -->|"runs remote commands"| node_ssm
node_ssm -->|"validates instance"| node_context
node_operator -->|"exports evidence"| node_export
node_export -->|"reads command output"| node_ssm
node_operator -->|"validates evidence"| node_proof
node_operator -->|"builds guardrail"| node_guardrail
node_operator -->|"tightens policy"| node_policy
node_operator -->|"expires resources"| node_ttl
node_operator -->|"cleans lab"| node_cleanup
node_operator -->|"checks cleanup"| node_cleanup_audit
node_operator -->|"audits tags"| node_tag_audit
node_tag_apply -->|"reuses tag readers"| node_tag_audit
node_operator -->|"applies tags"| node_tag_apply
node_operator -->|"estimates cost"| node_cost
node_template -.->|"defines resources"| node_aws
node_dms -.->|"controls DMS"| node_aws
node_cleanup -->|"tears down resources"| node_aws
node_cleanup_audit -->|"inventories resources"| node_aws

click node_context "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/aws_context.py"
click node_template "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/infra/build_template.py"
click node_harness "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/harness/lab_harness.py"
click node_dms "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/dms_runtime.py"
click node_ssm "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/ssm_runtime.py"
click node_export "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/export_evidence.py"
click node_proof "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/make_g6_proof.py"
click node_guardrail "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/guardrails/build_guardrail.py"
click node_policy "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/guardrails/tighten_policy.py"
click node_ttl "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/guardrails/ttl_handler.py"
click node_cleanup "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/cleanup_lab.py"
click node_cleanup_audit "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/verification/verify_cleanup.py"
click node_tag_audit "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/verification/verify_tags.py"
click node_tag_apply "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/verification/apply_required_tags.py"
click node_cost "https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/verification/estimate_runtime_cost.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_template,node_harness,node_dms toneBlue
class node_context,node_ssm,node_export,node_proof toneAmber
class node_guardrail,node_policy,node_ttl,node_cleanup,node_cleanup_audit,node_tag_audit,node_tag_apply,node_cost toneMint
class node_operator,node_aws toneIndigo
```

## Components

### Migration laboratory

- [Lab infrastructure](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/infra/build_template.py): `scripts/repro/scripts/infra/build_template.py`
- [Migration harness](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/harness/lab_harness.py): `scripts/repro/scripts/harness/lab_harness.py`
- [DMS controls](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/dms_runtime.py): `scripts/repro/scripts/control/dms_runtime.py`

### Operator controls

- [Lab context](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/aws_context.py): `scripts/repro/scripts/control/aws_context.py`
- [SSM controls](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/ssm_runtime.py): `scripts/repro/scripts/control/ssm_runtime.py`
- [Evidence export](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/export_evidence.py): `scripts/repro/scripts/control/export_evidence.py`
- [Cutover proof](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/make_g6_proof.py): `scripts/repro/scripts/control/make_g6_proof.py`

### Safety and verification

- [Guardrail builder](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/guardrails/build_guardrail.py): `scripts/repro/scripts/guardrails/build_guardrail.py`
- [Policy tightening](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/guardrails/tighten_policy.py): `scripts/repro/scripts/guardrails/tighten_policy.py`
- [Expiry handler](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/guardrails/ttl_handler.py): `scripts/repro/scripts/guardrails/ttl_handler.py`
- [Lab cleanup](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/control/cleanup_lab.py): `scripts/repro/scripts/control/cleanup_lab.py`
- [Cleanup audit](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/verification/verify_cleanup.py): `scripts/repro/scripts/verification/verify_cleanup.py`
- [Tag audit](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/verification/verify_tags.py): `scripts/repro/scripts/verification/verify_tags.py`
- [Tag correction](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/verification/apply_required_tags.py): `scripts/repro/scripts/verification/apply_required_tags.py`
- [Runtime cost estimate](https://github.com/gustavoconti-cloud/postgresql16-migration-lab/blob/main/scripts/repro/scripts/verification/estimate_runtime_cost.py): `scripts/repro/scripts/verification/estimate_runtime_cost.py`

### Other components

- **Operator**
- **AWS services**

## Connections

- Operator → Lab context: configures (evidence: `scripts/repro/scripts/control/aws_context.py`)
- Lab context → Lab infrastructure: supplies bindings (evidence: `scripts/repro/scripts/infra/build_template.py`)
- Operator → Lab infrastructure: builds lab (evidence: `README.md`)
- Operator → Migration harness: runs experiments (evidence: `README.md`)
- Operator → DMS controls: controls replication (evidence: `scripts/repro/scripts/control/dms_runtime.py`)
- DMS controls → Lab context: validates bindings (evidence: `scripts/repro/scripts/control/dms_runtime.py`)
- Operator → SSM controls: runs remote commands (evidence: `scripts/repro/scripts/control/ssm_runtime.py`)
- SSM controls → Lab context: validates instance (evidence: `scripts/repro/scripts/control/ssm_runtime.py`)
- Operator → Evidence export: exports evidence (evidence: `scripts/repro/scripts/control/export_evidence.py`)
- Evidence export → SSM controls: reads command output (evidence: `scripts/repro/scripts/control/export_evidence.py`)
- Operator → Cutover proof: validates evidence (evidence: `scripts/repro/scripts/control/make_g6_proof.py`)
- Operator → Guardrail builder: builds guardrail (evidence: `scripts/repro/scripts/guardrails/build_guardrail.py`)
- Operator → Policy tightening: tightens policy (evidence: `scripts/repro/scripts/guardrails/tighten_policy.py`)
- Operator → Expiry handler: expires resources (evidence: `README.md`)
- Operator → Lab cleanup: cleans lab (evidence: `scripts/repro/scripts/control/cleanup_lab.py`)
- Operator → Cleanup audit: checks cleanup (evidence: `scripts/repro/scripts/verification/verify_cleanup.py`)
- Operator → Tag audit: audits tags (evidence: `scripts/repro/scripts/verification/verify_tags.py`)
- Tag correction → Tag audit: reuses tag readers (evidence: `scripts/repro/scripts/verification/apply_required_tags.py`)
- Operator → Tag correction: applies tags (evidence: `scripts/repro/scripts/verification/apply_required_tags.py`)
- Operator → Runtime cost estimate: estimates cost (evidence: `README.md`)
- Lab infrastructure → AWS services: defines resources (evidence: `README.md`)
- DMS controls → AWS services: controls DMS (evidence: `scripts/repro/scripts/control/dms_runtime.py`)
- Lab cleanup → AWS services: tears down resources (evidence: `scripts/repro/scripts/control/cleanup_lab.py`)
- Cleanup audit → AWS services: inventories resources (evidence: `scripts/repro/scripts/verification/verify_cleanup.py`)
