[PR #3242] [MERGED] fix(sqlite): keep a retained worker owner after a failed worker exit #5669

Closed
opened 2026-10-31 01:08:27 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3242
Author: @kaoru0822-kitauji
Created: 10/14/2026
Status: ✅ Merged
Merged: 10/14/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/json-validation-aborts-parse


📝 Commits (5)

  • 8ff54a7 fix: abort invalid JSON parses and keep retained worker owners
  • 2bf4dd8 test(sqlite): keep a retained worker owner after a failed worker exit
  • dbcd6bb fix(evm): retain the compact worker failure beside retained cleanup
  • 555492d Merge remote-tracking branch 'origin/main' into fix/json-validation-aborts-parse
  • d919a2c Merge origin/main into fix/json-validation-aborts-parse

📊 Changes

2 files changed (+56 additions, -2 deletions)

View changed files

📝 src/sqlite/SqliteDatabaseProvider.ts (+6 -1)
📝 tests/boundary/sqlite/sqliteDatabaseCleanup.test.ts (+50 -1)

📄 Description

Summary

Main's latest CI run (7375ab6e3) fails 4 boundary tests from the 13:40–13:58 batch:

  • processCli.test.ts › JSON depth constraint
  • evmoleInterfaceProvider.test.ts › diagnostic truncation with failed cleanup, and malformed-reply cleanup
  • pcapProvider.test.ts › capinfos cleanup unresolved

Three are Linux-x64-only tests that the commits note couldn't be run on macOS.

Root causes and fixes

JSON validation must abort the parse (src/domain/jsonValue.ts). f79fd59e9 moved JSON value validation from z.custom into a superRefine. That issue doesn't abort the parse, so authenticatedEvidenceSchema still ran computeEvidenceId → emitCanonical (recursive) over a 10,000-level parameters value and overflowed the stack. The process comparison CLI then reported Maximum call stack size exceeded instead of the depth limit. The issue now uses continue: false, so enclosing refinements never walk invalid data. A new evidence.test.ts case runs a 100,000-level value through parseEvidence: it throws RangeError without the fix and a depth ZodError with it.

Keep the retained worker owner (EvmoleInterfaceProvider.ts, SqliteDatabaseProvider.ts). runOwnedCommand retains an incomplete cleanup through retainCleanup, then rethrows the command failure without a cleanupOwner. Both providers then did processOwner = cause.cleanupOwner, replacing the retained owner with undefined. An output-limit failure whose cleanup failed therefore came back without cleanupIncomplete and without its owner. Both now keep the retained owner unless the failure carries its own. SQLite had the same latent pattern.

Test expectations.

  • The EVM malformed-reply case expected previous_error.code: "output_failure", which isn't a code anywhere in src. AnalysisOutputError projects to unreadable_output, which another test in the same file already expects.
  • The pcap capinfos stub prints its report with printf '%s\n', and retained captured_output.stdout preserves the producer's exact output, so the expectation now includes the trailing newline.

Validation

  • processCli (via the compiled CLI) and the new Evidence depth test pass. src/domain passes (2864).
  • src/sqlite, tests/boundary/sqlite, src/evm, tests/boundary/evm, tests/boundary/pcap and src/process pass (400). The Linux-x64-only EVM and pcap cases skip on this macOS host, so CI's Linux lanes have to confirm those.
  • check:fast is clean.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/3242 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/14/2026 **Status:** ✅ Merged **Merged:** 10/14/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/json-validation-aborts-parse` --- ### 📝 Commits (5) - [`8ff54a7`](https://github.com/morluto/rea/commit/8ff54a765d7a7d1028fe62dc9f561cc487318bd1) fix: abort invalid JSON parses and keep retained worker owners - [`2bf4dd8`](https://github.com/morluto/rea/commit/2bf4dd892f7de720fc25d8843fcf140e7d5f9fbe) test(sqlite): keep a retained worker owner after a failed worker exit - [`dbcd6bb`](https://github.com/morluto/rea/commit/dbcd6bb4b6f914e7f6b5e27aff3296047ec5efaa) fix(evm): retain the compact worker failure beside retained cleanup - [`555492d`](https://github.com/morluto/rea/commit/555492dafd47576a71d0e5a1cc55666fe2ce506c) Merge remote-tracking branch 'origin/main' into fix/json-validation-aborts-parse - [`d919a2c`](https://github.com/morluto/rea/commit/d919a2c88d3808ae0e617bd1e851f6bad53abe9e) Merge origin/main into fix/json-validation-aborts-parse ### 📊 Changes **2 files changed** (+56 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/sqlite/SqliteDatabaseProvider.ts` (+6 -1) 📝 `tests/boundary/sqlite/sqliteDatabaseCleanup.test.ts` (+50 -1) </details> ### 📄 Description ## Summary Main's latest CI run (7375ab6e3) fails 4 boundary tests from the 13:40–13:58 batch: - `processCli.test.ts` › JSON depth constraint - `evmoleInterfaceProvider.test.ts` › diagnostic truncation with failed cleanup, and malformed-reply cleanup - `pcapProvider.test.ts` › capinfos cleanup unresolved Three are Linux-x64-only tests that the commits note couldn't be run on macOS. ## Root causes and fixes **JSON validation must abort the parse (`src/domain/jsonValue.ts`).** f79fd59e9 moved JSON value validation from `z.custom` into a `superRefine`. That issue doesn't abort the parse, so `authenticatedEvidenceSchema` still ran `computeEvidenceId` → `emitCanonical` (recursive) over a 10,000-level `parameters` value and overflowed the stack. The process comparison CLI then reported `Maximum call stack size exceeded` instead of the depth limit. The issue now uses `continue: false`, so enclosing refinements never walk invalid data. A new `evidence.test.ts` case runs a 100,000-level value through `parseEvidence`: it throws `RangeError` without the fix and a depth `ZodError` with it. **Keep the retained worker owner (`EvmoleInterfaceProvider.ts`, `SqliteDatabaseProvider.ts`).** `runOwnedCommand` retains an incomplete cleanup through `retainCleanup`, then rethrows the command failure without a `cleanupOwner`. Both providers then did `processOwner = cause.cleanupOwner`, replacing the retained owner with `undefined`. An output-limit failure whose cleanup failed therefore came back without `cleanupIncomplete` and without its owner. Both now keep the retained owner unless the failure carries its own. SQLite had the same latent pattern. **Test expectations.** - The EVM malformed-reply case expected `previous_error.code: "output_failure"`, which isn't a code anywhere in `src`. `AnalysisOutputError` projects to `unreadable_output`, which another test in the same file already expects. - The pcap `capinfos` stub prints its report with `printf '%s\n'`, and retained `captured_output.stdout` preserves the producer's exact output, so the expectation now includes the trailing newline. ## Validation - `processCli` (via the compiled CLI) and the new Evidence depth test pass. `src/domain` passes (2864). - `src/sqlite`, `tests/boundary/sqlite`, `src/evm`, `tests/boundary/evm`, `tests/boundary/pcap` and `src/process` pass (400). The Linux-x64-only EVM and pcap cases skip on this macOS host, so CI's Linux lanes have to confirm those. - `check:fast` is clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:08:27 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5669
No description provided.