Repository navigation
fix(contracts,ci): prune per-stream storage on close and repair migration/CI pipeline - #1942
Open
Ayomikun2005 wants to merge 3 commits into
Open
Ayomikun2005 wants to merge 3 commits into
Ayomikun2005 wants to merge 3 commits into
Conversation
…igration pipeline close_stream removed only the stream record, so conditional streams leaked milestone/attestation entries into instance storage and position metadata kept paying rent forever; both are now pruned. The contract-deploy workflow uploaded from a directory it never wrote, and test:integration:docker always exited 0 while running a single spec. The migration history no longer drops the dead-letter table on replay, a missing notification/webhook migration was generated to remove the drift db push was hiding, and CI now replays the history on an empty database and fails on schema drift.
Ayomikun2005
force-pushed
the
chore/close-stream-cleanup-ci-fixes
branch
from
November 24, 2026 14:46
2d8fb7a to
f060952
Compare
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 |
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 |
DataKey::StreamPosition is keyed by (stream_id, PositionRole) since the per-role position storage change, so the single-argument remove left the recipient entry behind and did not compile.
Ayomikun2005
force-pushed
the
chore/close-stream-cleanup-ci-fixes
branch
from
November 24, 2026 16:12
33bc1b5 to
aaab074
Compare
Frontend CI failed on the CancelConfirmModal Escape-key assertion, which passes on its own and does not touch anything in this branch.
This branch has not been deployed
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.
Four repo-hygiene fixes: one contract storage leak and three CI/script defects.
Closes #1863
Closes #1864
Closes #1865
Closes #1866
#1863 —
close_streamnow prunes everything keyed by the streamclose_streamremoved onlyDataKey::Stream(stream_id), leaving the conditional-stream bookkeeping (ConditionalMilestones,AttestedIds, written into the shared instance entry for every conditional stream) and the position metadata (persistent, paying rent with no stream attached) behind forever.New
storage::remove_position_metadataandstorage::remove_conditional_metadataare called fromclose_streamnext toremove_stream, and the function docs no longer overclaim.Test:
test_close_stream_prunes_conditional_entry_and_positionsasserts the milestone, attestation and position records exist before the close and are all gone afterwards.#1864 —
test:integration:dockerreports failures and runs the whole suiteThe old script ended in
docker compose stop postgres, so the npm script always exited 0, and it only ranstream-lifecycle.test.ts. It now runsvitest run tests/integration, captures its status, stops Postgres, and exits with that status;docker compose up -d --wait postgresgates on the compose healthcheck instead of racing startup.Verified by running the exact chain against a deliberately failing spec:
vitestreturned 1 and the; rc=$?; …; exit $rcsequence propagated it (chain exit 1).#1865 — deploy-contracts uploads the WASM it actually builds
The build step writes
contracts/target/wasm32-unknown-unknown/release/stream_contract.optimized.wasm, but the upload read…/optimized/*.wasm, a directory nothing creates, soif-no-files-found: errorguaranteed a failed step. The upload now points at the release directory — the same pathci.ymluses — and a "Verify Optimized WASM Exists" step fails early with the directory listing if the file is missing.#1866 — migration history repaired, no more
db push --accept-data-loss20260926000000_add_indexer_dead_letter_eventused toDROP TABLE … CASCADEthe table created by20260830000000_add_indexer_dead_letter_eventand recreate it with a different shape. It now evolves the table in place (RENAME COLUMN,ADD COLUMN+DROP DEFAULT, index swap), so replaying history can no longer destroy quarantined events.schema.prismadeclaredWebhookSubscription,WebhookDelivery,AlertHistory,PushSubscription,NotificationChannel,LinkCode,NotificationLogand several indexes that no migration ever created — the driftdb pushwas masking. A new20261121000000_add_notification_webhook_tablesmigration (generated withprisma migrate diff, not by hand) brings a freshly migrated database up to the model.migrationsjob runs onbackend/prisma/**changes against an empty Postgres service:prisma migrate deploy, thenprisma migrate diff --from-config-datasource --to-schema … --exit-codeso any future history/schema drift fails the build.testnet-e2e.ymlnow runsprisma migrate deployinstead ofdb push --accept-data-loss; thedev:mock:seedscript drops the flag too. No--accept-data-lossremains in any workflow or script.Verification (real Postgres via
embedded-postgres, no Docker daemon here)prisma migrate deploy→ 0prisma migrate diff --from-config-datasource --to-schema prisma/schema.prisma --exit-code→ 0 (migrations now match the model exactly)20260830000000, inserted a dead-letter row, applied the rest → the row survived with the renamed columns (eventId,txHash,ledgerSequence,payload,errorMessage) intactChecks run
cargo test -p stream_contract: 280 passed, 0 failed, 1 pre-existing ignored.cargo clippy -p stream_contract --all-targets -- -D warningsandcargo fmt --all --check: clean.yaml.safe_loadon the three touched workflows andjson.loadon bothpackage.jsonfiles: valid.Not run: GitHub Actions itself (no runner here), and the full backend integration suite (needs the compose stack, which is unavailable in this environment).