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
13 changes: 13 additions & 0 deletions .github/workflows/ci-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,22 @@ jobs:

steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0

- uses: actions-rust-lang/setup-rust-toolchain@ecabd13d1c56bd1345c230e542e9144811ad706f # v2.0.0

- name: Reject changes to removed legacy contracts
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
changed_files="$(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA" -- contracts/)"
if [[ -n "$changed_files" ]]; then
printf 'Changes to the removed contracts/ tree are not accepted:\n%s\n' "$changed_files" >&2
exit 1
fi

- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: |
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-error-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
pull_request:
branches: [main]
paths:
- 'contracts/**'
- 'COMEBACKHERE-contracts/**'
- 'docs/error-codes.md'
- 'scripts/check_error_docs_sync.sh'
Expand Down
39 changes: 0 additions & 39 deletions .github/workflows/ci-legacy-contracts.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .github/workflows/ci-summary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ jobs:
name: ci / contract tests
uses: ./.github/workflows/ci-contracts.yml

ci-legacy-contracts:
name: ci / legacy contract tests
uses: ./.github/workflows/ci-legacy-contracts.yml

ci-legacy-frontend:
name: ci / legacy frontend tests
uses: ./.github/workflows/ci-legacy-frontend.yml
Expand Down Expand Up @@ -88,7 +84,6 @@ jobs:
needs:
- ci-frontend
- ci-contracts
- ci-legacy-contracts
- ci-legacy-frontend
- ci-abi-metadata
- ci-abi-snapshots
Expand Down
22 changes: 9 additions & 13 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This repository sits at the centre of the COMEBACKHERE protocol and orchestrates
- **Backend API** — Node/Express service that fronts the contracts.
- **Frontend UI** — React/Vite app used by merchants, payers, and admins.

Each layer has **two source trees in this repository**, plus CI jobs that pull a third copy from upstream. This document explains which tree to target when contributing.
Contracts have one canonical source tree in this repository. The backend and frontend also retain older mirrored trees while their migrations continue. This document explains which tree to target when contributing.

## Canonical trees (where changes go)

Expand All @@ -18,27 +18,23 @@ The active source of truth for each layer lives in a tree with the `COMEBACKHERE
| Backend (Node) | `comebackhere-backend/` | Referenced by `.github/workflows/ci.yml` for `npm ci`, `tsc --noEmit`, `npm run lint`, `npm run build`. |
| Frontend (React) | `comebackhere-frontend/` | Same as backend — the `ci.yml` `working-directory` points here. |

New feature work, bug fixes, and contract changes should target these three directories by default — they're the only ones with a dedicated, contract-specific CI workflow.
New feature work, bug fixes, and contract changes should target these three directories by default — they're the source trees covered by the full CI workflows.

## Mirrored trees (older in-tree copies)
## Remaining mirrored trees

The repository also contains a parallel set of directories without the prefix:
The repository retains older backend and frontend copies without the prefix:

- `contracts/` and `backend/` and `frontend/`
- `backend/` and `frontend/`

These are in-tree copies of the canonical sources at earlier points in time. They are kept because:
The former contract mirror was removed in PR #948. The remaining mirrors are in-tree copies of canonical backend and frontend sources at earlier points in time. They are kept because:

- Process docs reference them by path. `docs/error-codes.md` calls out `contracts/invoice/src/lib.rs` as the source of `InvoiceError`; that file still lives here.
- They give reviewers a familiar path while the migration to the `COMEBACKHERE-*` trees completes.

These trees are valid PR targets. They have dedicated CI coverage:
The remaining mirrors are valid PR targets. They have dedicated CI coverage:

- `ci-legacy-contracts.yml` runs `cargo test --manifest-path contracts/Cargo.toml` on changes to `contracts/**`.
- `ci-legacy-frontend.yml` runs `npm test` for `frontend/` on changes to `frontend/**`.

The legacy contract and frontend tests use the same toolchain and patterns as the canonical trees.

If your change is brand-new work, target the `COMEBACKHERE-*` tree to inherit full CI coverage and ensure parity is maintained. If your change is intentionally narrow (a doc tweak, a small Rust fix to legacy contract files), the mirrored tree is fine and will still be tested.
If your change is brand-new work, target the `COMEBACKHERE-*` tree to inherit full CI coverage and ensure parity is maintained. The remaining backend and frontend mirrors are still available during their migrations.

## CI checkout behaviour

Expand Down Expand Up @@ -71,7 +67,7 @@ When working inside this repository alone, the in-tree `COMEBACKHERE-contracts/`

## Invoice state machine

The invoice contract (`COMEBACKHERE-contracts/contracts/invoice/src/lib.rs`, mirrored at `contracts/invoice/src/lib.rs`) is the source of truth every other layer reads from: backend status displays, the indexer, and both frontend apps all ultimately derive their view of an invoice from this state machine. The diagram below shows every `InvoiceStatus` value and the function whose call transitions an invoice into it. Any transition not shown here is illegal and the calling function returns an `InvalidStateTransition` / `NotPending` style error (see [docs/error-codes.md](docs/error-codes.md) for the exact variant and code per contract).
The invoice contract (`COMEBACKHERE-contracts/contracts/invoice/src/lib.rs`) is the source of truth every other layer reads from: backend status displays, the indexer, and both frontend apps all ultimately derive their view of an invoice from this state machine. The diagram below shows every `InvoiceStatus` value and the function whose call transitions an invoice into it. Any transition not shown here is illegal and the calling function returns an `InvalidStateTransition` / `NotPending` style error (see [docs/error-codes.md](docs/error-codes.md) for the exact variant and code per contract).

```mermaid
stateDiagram-v2
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Changes are organized by component: **Contract**, **Backend**, and **Frontend**.

### Contract

#### Removed

- Removed the obsolete legacy contract tree; `COMEBACKHERE-contracts/` is the canonical source. Closes #948.

#### Added

- Invoice contract with `create_invoice` supporting minimum amount validation.
Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The following components are in scope for responsible disclosure:

| Component | Repository / Location |
| --- | --- |
| Soroban smart contracts | `COMEBACKHERE-contracts/` and `contracts/` |
| Soroban smart contracts | `COMEBACKHERE-contracts/` |
| Backend API | `comebackhere-backend` (separate repo) |
| Frontend application | `frontend/` and `comebackhere-frontend/` |
| Deployment scripts | `scripts/` |
Expand Down
Loading