Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,29 @@
---
name: 🐛 Bug Report
about: Thank you for taking the time, please report a reproducible bug
title: "[Bug] <Bug Title Here>"
name: 🐛 Bug / safety report
about: Report a bug — especially anything that looks like a safety problem
title: "[Bug] <title>"
labels: bug
assignees: add codeowner's @name here
assignees: Kiran01bm

---

**Describe the bug**
*A clear and concise description of what the bug is.*
> pg-sprite is in early-stage development and we are not accepting external
> contributions yet — but bug reports, **especially safety problems** (a path
> where the engine could take a lock it shouldn't, lose data, or misclassify
> a change as native-safe), are welcome even now.

**To Reproduce:**
*Steps to reproduce the behavior:*
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Describe the bug**
A clear and concise description of what the bug is.

**Expected behavior:**
*A clear and concise description of what you expected to happen.*
**To reproduce**
Steps to reproduce the behavior (DDL, table shape, pg-sprite command).

**Supporting Material**
*If applicable, add screenshots, output log and/or other documentation to help explain your problem.*
**Expected behavior**
What you expected to happen.

**Environment (please complete the following information):**
- OS: [ex: iOS]
- Version
**Environment**
- pg-sprite version / commit:
- PostgreSQL version (and Aurora/RDS/community):

**Additional context**
Add any other context that you feel is relevant about the problem here.
Logs, output, or anything else relevant.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
contact_links:
- name: ❓ Questions and Help 🤔
url: https://discord.gg/block-opensource (/add your discord channel if applicable)
about: This issue tracker is not for support questions. Please refer to the community for more help.
url: https://discord.gg/block-opensource
about: This issue tracker is not for support questions. Please refer to the community for more help.
47 changes: 47 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: ci

on:
push:
branches: [main]
pull_request:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
# Pin the same golangci-lint major used locally (v2 config format);
# the action's default binary lags and cannot load a v2 config.
- uses: golangci/golangci-lint-action@ba0d7d2ec06a0ea1cb5fa41b2e4a3ab91d21278a # v9.3.0
with:
version: v2.12.2

build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: make build

# The integration suite runs against every Aurora-supported PostgreSQL
# major (see the version-support research doc): the version floor is a
# promise CI enforces, not documentation.
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pg: ["14", "15", "16", "17", "18"]
env:
PG_VERSION: ${{ matrix.pg }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- run: make test
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bin/
coverage.out
*.test
.idea/
.vscode/
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: "2"

linters:
enable:
- bodyclose
- misspell
- nolintlint
72 changes: 72 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# AGENTS.md

Guidance for AI coding agents working on pg-sprite — an online schema-change engine for Aurora
PostgreSQL. Deliberately short: don't restate what you can infer from the code.

## Read SAFETY.md first

This codebase is partitioned into a **safety-critical core** and a periphery.
[SAFETY.md](SAFETY.md) lists which packages are which and the stricter rules that apply inside
the core (proof types, bounded everything, `// INV:` locality, the core dependency list, the
never-import-`block/spirit` rule). Before touching a `pkg/` package, check its row in
SAFETY.md — the review bar and the AI-assistance posture differ by side.

## Build and test

```sh
make build # build ./... and bin/pg-sprite
make test # full suite; integration tests need Docker
make test-unit # SKIP_INTEGRATION=1, no Docker
make lint # golangci-lint
```

- Always run the full `make test` when the scope of a change is unclear.
- Never assume a test failure is unrelated to your change; investigate it.
- Never increase timeouts to fix flakes; find the root cause.
- Integration tests run against real PostgreSQL (testcontainers); `PG_VERSION` selects the
major (default 16), CI runs the matrix 14 → 18. Core logic is validated against a real
database — no mocked-DB tests for core logic.

## Conventions

- Use `pkg/dbconn` for connections — never raw `pgx` pools in production code (tests excepted).
Every session runs under bounded `lock_timeout` / `statement_timeout`.
- All SQL parsing goes through `pg_query_go` (once `pkg/statement` exists). No
`strings.Split(";")`, no hand-parsing; a parse failure is an error surfaced to the caller.
- Tests use testify (`require` for setup, `assert` for verification), `t.Context()` (except in
cleanups, which run after the context is cancelled), and named polling deadlines — no bare
`time.Sleep` readiness waits.
- Errors: wrap with context and identifiers (`fmt.Errorf("create slot %s: %w", name, err)`);
never log-and-continue; no silent branch cases; no `nolint`; no `--no-verify`.

## Go maxims

- **"A little copying is better than a little dependency."** Small mechanics (retry/backoff, CA
loading, keepalives, tiny helpers) are hand-written or copied with an attributing comment —
never imported. Take pinned dependencies only for load-bearing expertise (the parser, the wire
protocol); a dependency inside a core package needs a recorded decision (see
[SAFETY.md](SAFETY.md)). **Never import `github.com/block/spirit` as a module** — port ideas
with citations, not code.
- **Expose the smallest interface that does the job.** Export domain types and their validating
constructors, not internals; no re-exports or plain-delegation wrappers — callers import the
source package.
- **Clear is better than clever.** No clever SQL, no dense compound predicates — extract a named
helper for any 3+-term or state-machine conditional. Separate error handling from state
decisions. This code gets read during incidents; readability outranks ease of use and
performance here (correctness outranks both).
- **Minimize state; derive rather than store.** If a value can be recomputed from the database
or the checkpoint, don't persist it.
- **Don't conflate causes.** No `if err != nil || value == nil` when the cases mean different
things; no deduping unrelated branches with `||` — separate branches calling a shared helper.
- Concurrency: `wg.Go(...)`; `context.WithoutCancel(ctx)` for background goroutines that must
outlive a request; snapshot shared state under one lock acquisition, not several.
- Cleanup: close errors are logged, not discarded — no bare `_ = x.Close()` (one exception: a
redundant safety closer on a handle someone else owns discards its guaranteed
already-closed error).
- State comparisons use typed constants and helpers, never raw string matching.

Design docs live in [docs/](docs/) — start at [docs/README.md](docs/README.md); the invariant
registry is [docs/invariants.md](docs/invariants.md).

> This file grows with the codebase. Keep it short: rules earn a line here only when an agent
> can't infer them from the code.
24 changes: 4 additions & 20 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
# This CODEOWNERS file denotes the project leads
# and encodes their responsibilities for code review.

# Instructions: At a minimum, replace the '@GITHUB_USER_NAME_GOES_HERE'
# here with at least one project lead.

# Lines starting with '#' are comments.
# Each line is a file pattern followed by one or more owners.
# The format is described: https://github.blog/2017-07-06-introducing-code-owners/
#
# The format is described:
# https://github.blog/2017-07-06-introducing-code-owners/

# These owners will be the default owners for everything in the repo.
* @Kiran01bm


# -----------------------------------------------
# BELOW THIS LINE ARE TEMPLATES, UNUSED
# -----------------------------------------------
# Order is important. The last matching pattern has the most precedence.
# So if a pull request only touches javascript files, only these owners
# will be requested to review.
# *.js @octocat @github/js

# You can also use email addresses if you prefer.
# docs/* docs@example.com
* @Kiran01bm @aparajon @eeSeeGee @JashLal @jayjanssen @jemiahw @morgo
134 changes: 134 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Block Code of Conduct

Block's mission is Economic Empowerment. This means opening the global economy to everyone. We extend the same principles of inclusion to our developer ecosystem. We are excited to build with you. So we will ensure our community is truly open, transparent and inclusive. Because of the global nature of our project, diversity and inclusivity is paramount to our success. We not only welcome diverse perspectives, we **need** them!

The code of conduct below reflects the expectations for ourselves and for our community.

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, physical appearance, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful and welcoming of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

The Block Open Source Governance Committee (GC) is responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

The GC has the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all project spaces, and it also applies when an individual is representing the project or its community in public spaces. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event, or any space where the project is listed as part of your profile.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the Block Open Source Governance Committee (GC) at
`open-source-governance@block.xyz`. All complaints will be reviewed and
investigated promptly and fairly.

The GC is obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

The GC will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from the GC, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media and forums.

Although this list cannot be exhaustive, we explicitly honor diversity in age, culture, ethnicity, gender identity or expression, language, national origin, political beliefs, profession, race, religion, sexual orientation, socioeconomic status, and technical ability. We will not tolerate discrimination based on any of the protected characteristics above, including participants with disabilities.

Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Contributing

Thanks for your interest in pg-sprite!

**We are not accepting external contributions yet.** The project is in
early-stage development (see the warning in the [README](README.md)): the
design is still settling, interfaces change without notice, and there is no
released version to contribute against. PRs opened at this stage will likely
be closed without review.

If you've found something that looks like a safety problem — a path where the
engine could take a lock it shouldn't, lose data, or misclassify a change as
native-safe — please open an issue; those we want to hear about even now.

Once the project reaches a consumable state we'll replace this file with a
real contribution guide (issue-first workflow, testing requirements, and the
review rules for the safety-critical core described in
[SAFETY.md](SAFETY.md)).

Community standards: see [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md) and
[GOVERNANCE.md](GOVERNANCE.md); anything not covered there (e.g. the security
policy) is inherited from the
[Block organization defaults](https://github.com/block/.github).
2 changes: 1 addition & 1 deletion GOVERNANCE.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
## [Click here for Block Open Source Project governance information](https://github.com/block/.github/blob/main/GOVERNANCE.md)
## [Click here for Block Open Source Project governance information](https://github.com/block/.github/blob/main/GOVERNANCE.md)
Loading
Loading