You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: close 13 real bugs from the architecture audit + split common.rs hotspot
Batch fix for CALM's own maintenance/graph/diff/memory/release subsystems,
following a line-by-line verification of a 28-finding external audit
against actual source (not docs/comments). Each item below was independently
confirmed as a real, reproducing bug before being fixed and covered by a
new regression test.
Transaction/graph correctness:
- txn::advance: close the check-then-act race (BEGIN IMMEDIATE before
reading current_state); advance_many now surfaces a failed outer COMMIT
instead of silently discarding it (Vec<Result> -> Result<Vec<Result>>).
- SCIP overlay: a discarded (stale-generation) ingest pass no longer commits
its cache key, which was silently disabling re-runs of that provider.
- path tool: route confidence is no longer collapsed into a bare
exists:true — routes now carry per-hop confidence and a `certain` flag.
- transitive_bfs: a node first seen via an ambiguous (unexpandable) edge
can now be promoted to expandable by a later confirmed encounter, instead
of being permanently poisoned by a flat visited-set.
- coreness: split into `coreness` (confirmed edges only, feeds is_hub/gate)
and `possible_coreness` (old undifferentiated behavior, uncertainty-only).
Maintenance outbox (biggest item):
- run_all_coalesced now reports whether the caller actually led the
coalesced pass or deferred to an in-flight one — only the leader may mark
the durable job "done", closing a race where a deferred/no-op completion
could mark real in-flight work as finished.
- mark_completed no longer silently drops a later, genuinely-real
completion just because an earlier one already reached a terminal state.
- mark_running/reconcile_stale_at_startup now use a real lease
(lease_owner/lease_expires_at, columns the schema already reserved) so a
second process's startup no longer kills a sibling process's still-live
job on a shared project.
diff_impact:
- A deleted file whose index row already converged away no longer defaults
to "low" risk when there's no surviving evidence of its former callers.
- Unified-diff parsing now handles Git's C-style quoted paths (spaces,
tabs, escaped quotes/backslashes, octal-escaped non-ASCII).
- Signature-change comparison is now language-aware: Python/Kotlin keyword
arguments and Swift's one-identifier external-label shorthand are no
longer stripped as "just a param rename".
- The syntax gate now rejects any parse error intersecting the edited
region outright, instead of a gameable bare error-count comparison.
- reference_impact no longer suppresses independent textual hits in a file
that also has an import edge.
Memory/session safety:
- remember() note upsert and ref replacement now share one transaction —
a crash or ref-write failure can no longer leave new content paired with
stale/partial refs.
- Ambient note surfacing fails closed (not open) when the MAC key is
unavailable or the injection scan didn't finish.
- HTTP sessions (http.rs) now clean up their active_sessions registry
entry on disconnect via an Arc-refcounted guard, closing a leak the
unix-socket daemon already had a fix for but HTTP never got.
Release/CI hygiene:
- action.yml's default `version: latest` now resolves to the exact npm
version matching the action's own tag instead of npm's floating latest,
closing a real past release-skew incident.
- action.yml's shallow base-ref fetch (depth=1) shared no history with the
checkout's own depth=1 HEAD, so `git merge-base` failed outright —
reproduced live in calm-guard-dogfood CI; fixed with a deeper fetch plus
an --unshallow fallback. Documented explicit promotion criteria for
taking that job out of shadow mode (not done yet — no clean track record
with the fix in place).
- Fixed 2 stale KNOWN_LIMITATIONS.md entries already resolved in code.
Also: split tools/common.rs (15 methods -> new tools/session_state.rs) to
bring its own hotspot_risk score back under the CI gate threshold, and
fixed a self-perpetuating state-corruption bug in the project's own
calm-nudge.sh dev-tooling hook (unvalidated JSON read before jq --argjson).
1351 unit tests pass (1000 calm-core + 351 calm-server), clippy -D warnings
clean across calm-core/calm-server/calm-cli.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
0 commit comments