Cascading deletes#1572
Merged
Merged
Conversation
Prevent orphaned child records by staging DELETE rows for project/unit children before parent deletion. This keeps staged changes aligned with the datalayer commit pipeline and makes delete responses explicit via stagedChildDeletes counts.
Wrap child and parent delete staging in one transaction so partial staging cannot commit child deletes without the parent row.
Reduce fixed waits and redundant setup in the v2 live-api job, and run cascade delete coverage from the existing data-short orchestration instead of a separate test process.
Replace commit-and-tag-version/conventional-changelog-cli with release-please for automated version bumps, changelog generation, and GitHub Release creation via a Release PR workflow on main. - Add release-please-config.json and .release-please-manifest.json - Add .github/workflows/release-please.yml (triggers on push to main) - Strip auto-release.yml to dev-dependency auto-update only - Remove commit-and-tag-version devDep, release script, and config - Keep auto-release-rc.yml unchanged for RC releases on develop
Install required system packages and Chia tools in one step per job so apt metadata refresh runs once after repository sources are configured.
chore(CI): migrate from standard-version to release-please
getDiffObject returned diff.change={} for DELETE actions, but the
staging findAll controller strips raw data from the response. The
cascade delete live test relied on row.data (which was removed) causing
JSON.parse(undefined). Include parsed staging data in diff.change for
DELETE (matching INSERT/UPDATE behavior) and update the test to read
from diff.change.
Move reconcileOrganization() before the transaction in the resync controller so its non-transactional DB writes complete before the registry_hash='0' reset, preventing a race where reconcile overwrites the reset value. Fix V1 unit integration tests that checked staging-empty immediately after commit+sync. The sync task inserts data before its afterCommit callback truncates staging, so merge the staging-empty check into the poll condition. Also clear committed staging records before the split call so assertNoPendingCommits passes, and increase maxAttempts for the serial-number ordering test to handle sync backlog from prior tests.
The auto-release workflow's primary purpose is to compare the version in package.json to existing tags and create a tag + changelog when the version is new. PR #1567 removed this core functionality in favor of release-please-action, which adds an unnecessary external dependency. The original approach using npx conventional-changelog-cli works fine and doesn't require any project devDependencies (npx downloads it on-the-fly in CI). The commit-and-tag-version devDep removal from #1567 is intentionally kept since the auto-release workflow never used it — it only resolves the handlebars vulnerability from #1562. Reverts: auto-release.yml changes from #1567 Removes: release-please.yml, release-please-config.json, .release-please-manifest.json
Testnet transaction confirmation latency caused the v1-to-v2 upgrade test to timeout waiting for wallet funding. All 8 jobs got identical HTTP 202 faucet responses, but confirmation times ranged from ~3 to 5+ minutes. Bump MAX_ATTEMPTS from 30 to 60 (10 minutes) across all 8 wallet funding polling loops to absorb testnet variability.
…-children fix(V2): cascade stage project/unit child deletes
…e-tag-creation revert(CI): restore auto-release tag creation, remove release-please
…g-timeout fix(CI): increase faucet funding timeout from 5 to 10 minutes
…endpoints DELETE /v2/verification/:id and DELETE /v2/issuance/:id previously staged only the parent row, orphaning downstream children (issuances, units, unit_labels). This mirrors the cascade logic already present on project and unit deletes. Adds stageVerificationChildDeletes and stageIssuanceChildDeletes helpers, wires them into their respective controllers with transaction + mutex, and documents the two-category deletion design (project-scoped cascade vs shared-record guard) in v2-cascade-delete.js. Integration tests cover both mid-chain cascades, double-delete idempotency, and multi-unit-per-issuance. Live API test batches all three cascade levels (unit, issuance, verification) into one commit cycle to avoid adding test runtime.
After org creation, the wallet temporarily desyncs while processing on-chain confirmations. The middleware assertWalletIsAvailable check and test commitStagedRecords both failed instantly with no retry, causing spurious CI failures. Server-side: assertWalletIsAvailable now retries up to 5 times (25s) when the wallet is reachable but not synced, while still failing fast on connection errors (checked on every retry iteration). Test-side (V1): commitStagedRecords retries up to 5 times (50s) on wallet availability/sync errors before giving up. V2 already has createRetryableRequest at the transport layer handling this, so the V2 commitStagedRecords is left unchanged.
fix(V2): add cascade deletes for mid-chain verification and issuance endpoints
…-desync fix(CI): retry on transient wallet desync during commit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Plus important dependency updates
Note
Medium Risk
Moderate risk: changes V2 delete behavior by staging cascaded child deletions inside a mutexed DB transaction, which could affect data-layer sync integrity if the cascade list is incomplete or mis-scoped. CI/workflow and wallet-availability retry tweaks may change test timing and failure modes but are operationally contained.
Overview
V2 deletes now cascade via staging:
destroyhandlers forproject,verification,issuance, andunitstage DELETE rows for dependent child records (e.g.,unit_label,unit,issuance) using new helpers insrc/utils/v2-cascade-delete.js, and run the cascade + parent staging inside asequelizeV2transaction guarded byprocessingSyncRegistriesTransactionMutexV2.Operational hardening: the org resync flow reconciles before opening the transaction to ensure the
registry_hashreset wins; staging diff generation treats missingdataas{};assertWalletIsAvailablenow distinguishes connection failures from temporary sync lag and retries a few times.Tooling/CI updates: GitHub Actions installs are consolidated (
npm ci, combined apt installs incl. MySQL + Chia tools), faucet funding wait is extended, CADT readiness uses a/healthpoll instead of fixed sleep, andcommit-and-tag-version/releasewiring is removed frompackage.json/lockfile while adding a newtest:v2:live:cascade-deletescript.Reviewed by Cursor Bugbot for commit 91b1f37. Bugbot is set up for automated code reviews on this repo. Configure here.