Skip to content

Persist state to .wal immediately after resource update#5149

Open
denik wants to merge 84 commits into
mainfrom
denik/wal-review1
Open

Persist state to .wal immediately after resource update#5149
denik wants to merge 84 commits into
mainfrom
denik/wal-review1

Conversation

@denik
Copy link
Copy Markdown
Contributor

@denik denik commented Apr 30, 2026

Changes

Every time we update a state, we now write resource entry to resources.json.wal. At the end of the deployment, we read those entries, merge them into state and write state file.

Internally, the state file can be opened in two modes: read and write. In write mode we only track IDs in memory but not full state. This ensures that when we merge .wal file into state in-memory representation, the .wal file is source of truth, so normal state update is not different from recovery state-update.

Why

If "bundle deploy" is killed, we don't lose state changes. Next time any bundle command runs, we'll recover the updates.

Tests

Modified testserver kill API to be more flexible. Instead of being configured via test.toml, it's a separate endpoint that can add kill middleware on any other endpoint. So you can dynamically insert kill action during script execution.

@denik denik temporarily deployed to test-trigger-is April 30, 2026 14:29 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is April 30, 2026 14:29 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 1, 2026 11:49 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 1, 2026 11:49 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 1, 2026 14:04 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 1, 2026 14:04 — with GitHub Actions Inactive
@denik denik force-pushed the denik/wal-review1 branch from 4e30122 to 864a2b9 Compare May 1, 2026 14:12
@denik denik temporarily deployed to test-trigger-is May 1, 2026 14:13 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 1, 2026 14:13 — with GitHub Actions Inactive
@denik denik force-pushed the denik/wal-review1 branch from 864a2b9 to 547e62f Compare May 4, 2026 12:01
@denik denik temporarily deployed to test-trigger-is May 4, 2026 12:01 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 4, 2026 12:01 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 6, 2026 09:29 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 6, 2026 09:29 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 7, 2026 09:46 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 7, 2026 09:46 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 13:01 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 13:01 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 13:09 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 13:09 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 13:13 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 13:13 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 17:56 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 17:56 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 17:59 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 17:59 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 18:01 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 18:01 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 18:04 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 10, 2026 18:04 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 11, 2026 13:13 — with GitHub Actions Inactive
denik added 2 commits May 11, 2026 16:24
Move kill-on-request behavior from test.toml fields (KillCaller,
KillCallerOffset) to a POST /__testserver/kill endpoint. Kill rules
are scoped by auth token so concurrent tests sharing a server don't
interfere.

acceptance/bin/kill_after.py is a convenience wrapper that posts to
the endpoint, keeping scripts readable.

The kill check is applied at the HTTP middleware layer (wrapping the
entire router) so it fires for all requests, including those that
would otherwise fall through to the not-found handler.

Co-authored-by: Isaac
@denik denik temporarily deployed to test-trigger-is May 11, 2026 14:26 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 11, 2026 14:26 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 11, 2026 14:34 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 11, 2026 14:34 — with GitHub Actions Inactive
@denik denik temporarily deployed to test-trigger-is May 11, 2026 14:42 — with GitHub Actions Inactive
Tester and others added 19 commits May 11, 2026 16:55
- acceptance/bundle/deploy/wal/crash-after-create/test.toml and
  lineage-mismatch/test.toml were untracked; scripts using $COMMAND
  failed with "unbound variable" on CI
- assert_exists.py and assert_not_exists.py were tracked as 100644;
  CI ran them as non-executable, producing "Permission denied" errors

Co-authored-by: Isaac
… Windows

Multiline TOML basic strings (""") use literal newlines from the file.
On Windows with autocrlf=true, these become CRLF. After NormalizeNewlines
strips \r from the test output, the replacement re-introduces \r via the
New string, causing the comparison to fail.

Using single-line basic strings with \n escapes ensures the newlines in the
replacement are always LF regardless of platform.

Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
…tial progress

Co-authored-by: Denis Bilenko <denis.bilenko@databricks.com>
@github-actions
Copy link
Copy Markdown
Contributor

Approval status: pending

/acceptance/bundle/ - needs approval

67 files changed
Suggested: @pietern
Also eligible: @shreyas-goenka, @andrewnester, @janniklasrose, @anton-107, @lennartkats-db

/bundle/ - needs approval

12 files changed
Suggested: @pietern
Also eligible: @shreyas-goenka, @andrewnester, @janniklasrose, @anton-107, @lennartkats-db

/cmd/bundle/ - needs approval

Files: cmd/bundle/deployment/migrate.go, cmd/bundle/generate/dashboard.go, cmd/bundle/utils/process.go
Suggested: @pietern
Also eligible: @shreyas-goenka, @andrewnester, @janniklasrose, @anton-107, @lennartkats-db

General files (require maintainer)

24 files changed
Based on git history:

  • @pietern -- recent work in libs/testserver/, cmd/bundle/generate/, ./

Any maintainer (@andrewnester, @anton-107, @pietern, @shreyas-goenka, @simonfaltum, @renaudhartert-db) can approve all areas.
See OWNERS for ownership rules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants