fix(rust): repair fresh dependency resolution (#137)#138
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: #137
The published crate does not ship its Cargo.lock, so consumers resolve every dependency to the newest compatible version. Registry drift had made a from-scratch `cargo add web-capture` fail to compile: - html-to-markdown-rs 3.6 replaced `InlineImage.dimensions` (`Option<(u32, u32)>`) with `Option<ImageDimensions>`; adapt src/kreuzberg.rs to the struct shape and bump the dependency to 3.6. - brotli 8.0.3 ships an inconsistent alloc-no-stdlib graph that fails to build; drop the unused `brotli` decompression feature from reqwest (gzip remains) so the conflicting crate leaves the graph entirely. - Bump rust-version to the latest stable (1.96) and satisfy the newer MSRV-aware clippy lint by using Duration::from_mins. Add a CI job that re-resolves the lockfile from scratch and builds, so this class of registry drift is caught before a release. Regenerate Cargo.lock against the latest compatible graph and bump to 0.3.31.
The JS/Rust parity guard requires JS source/test changes alongside the
Rust dependency fix. Export normalizeStructuredKeys and add regression
tests asserting inline image dimensions are exposed as { width, height },
mirroring the Rust inline_image_to_json adaptation for html-to-markdown 3.6.
Add a changeset for the JS package.
Working session summaryEverything is complete and verified. The SummaryIssue #137 is fully resolved and PR #138 is ready for review with all CI green. Root causes fixed (fresh
Per maintainer feedback: bumped Regression prevention: added a CI Fresh Dependency Resolution job ( JS/Rust parity: mirrored the dimensions regression on the JS side (exported Verification:
PR: #138 This summary was automatically extracted from the AI working session output. |
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:Claude Opus 4.8: (2 sub-sessions)
Total: (25.3K new + 181.5K cache writes + 10.3M cache reads) input tokens, 72.7K output tokens, $8.220738 cost 🤖 Models used:
📎 Log file uploaded as Gist (3809KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit bc9dc2e.
🤖 Решение
Исправляет xlabtg/TONAIAgent#453 (LOGIC-43) — read-локи в shared-memory перезаписывали друг друга.
📋 Проблема
Локи хранились в
this.locks: Map<key, MemoryLock>— не более одной записи на ключ. Read-локи должны разделяться несколькими держателями, но приобретение второго read-лока просто перезаписывало запись в map новым держателем. Запись первого читателя терялась: при вызовеreleaseLockегоholderIdуже не совпадал и release возвращалfalse, а write-лок мог быть взят после истечения TTL последнего читателя, даже если ранние читатели ещё активны — это нарушало гарантию взаимного исключения read/write.🔧 Решение
В
core/multi-agent/memory/shared-memory.tsхранилище локов заменено на структуру с раздельным учётом:acquireLock: write-лок выдаётся только при отсутствии активного write и активных читателей; read-лок блокируется лишь активным write-локом, несколько читателей сосуществуют.releaseLock: освобождает write- или read-лок именно вызвавшего держателя; запись удаляется, когда локов не осталось.pruneLockEntry, который чистит истёкшие write/read-локи и используется как вacquireLock, так и вcleanup.setиgetStatsобновлены под новую структуру (проверка write-лока и подсчёт активных локов с учётом читателей).✅ Соответствие критериям приёмки
🧪 Тесты
Добавлены тесты в
tests/multi-agent/multi-agent.test.ts:Локально:
vitest run tests/multi-agent/multi-agent.test.ts— 52 passed;tsc --noEmit— без ошибок; eslint — чисто.JS/Rust parity
The repo enforces JS↔Rust source/test parity. The same html-to-markdown 3.6
{ width, height }dimensions shape applies to the JS binding(
@kreuzberg/html-to-markdown-node,^3.5.5already resolves into the 3.6line), so the Rust regression is mirrored on the JS side:
normalizeStructuredKeysis exported from
js/src/kreuzberg.jsandjs/tests/unit/kreuzberg.test.jsgains tests asserting inline image
dimensionskeep{ width, height }. Achangeset is included for the JS package.
CI
All workflows green on the latest commit: Rust Checks and Release,
JavaScript Checks and Release, and JS/Rust Parity.
Fixes #137