Skip to content

fix(cockpit-server): wire chains OrdinalIndex into the request-time gather path - #143

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/q2-osm-chains-books-lancedb
Aug 18, 2026
Merged

fix(cockpit-server): wire chains OrdinalIndex into the request-time gather path#143
AdaWorldAPI merged 1 commit into
mainfrom
claude/q2-osm-chains-books-lancedb

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

Summary

Root-causes and fixes the live memory-growth regression on maps.oga.red
(reported: "after opening the map in browser memory doesn't go down again").

  • main.rs's boot sequence converted the .chains sidecar to a Lance
    dataset but discarded the returned OrdinalIndex (Some((dataset_dir, _index)) => ...), so CHAINS_INDEX was never populated.
    gather_chains()'s CHAINS_INDEX.get()?.as_ref()? therefore always
    short-circuited to None, and every tile/feature request needing chain
    geometry permanently fell back to open_chains() — an eager,
    process-global OnceLock singleton that decodes the entire .chains
    file into memory once and never releases it.
  • Live-confirmed against /api/osm/status: cgroup_memory.current_bytes
    sat at ~850MB baseline and jumped to ~5.73GB after the first
    chains-touching request, then stayed flat forever — matching the
    reported symptom exactly.
  • Added osm_chains_books_lance::publish_chains_conversion(), the one
    function responsible for turning an ensure_chains_lance_local() result
    into a set_chains_index() call, with unit tests for both the Some
    (wires the index) and None (fails open, no panic) arms.
  • main.rs now calls it instead of the old broken inline match.
  • Corrected the now-stale "not yet consumed by the read path" log wording
    for both the chains and books boot-time conversion blocks — an earlier
    PR (Claude/add palantir dashboard 3 mn on #16 in this branch's task list) already wired the
    Lance-first-with-eager-fallback read path for both.

Test plan

  • cargo check -p cockpit-server --bin q2-cockpit --tests — 0 errors,
    33/18 warnings (at/under the pre-existing baseline)
  • New unit tests: publish_chains_conversion_wires_the_index_into_the_global_gather_path,
    publish_chains_conversion_stays_silent_on_none
  • Full cargo test/nextest for this binary is not runnable in this
    container: it transitively links most of the workspace and exceeds
    the environment's disk allowance (documented limitation, same as
    prior PRs on this branch)
  • Live verification on Railway after deploy: confirm
    cgroup_memory.current_bytes returns toward baseline after a
    chains-touching request instead of staying pinned at ~5.7GB

🤖 Generated with Claude Code

https://claude.ai/code/session_01NMeiLmtDKhomJNSo2ecbJw


Generated by Claude Code

…ather path

main.rs's boot sequence converted the .chains sidecar to Lance but
discarded the returned OrdinalIndex (bound to `_index`), so
CHAINS_INDEX was never populated. gather_chains()'s
`CHAINS_INDEX.get()?.as_ref()?` therefore always short-circuited to
None, and every tile/feature request needing chain geometry
permanently fell back to the eager open_chains() singleton — a
OnceLock populated once on first use and never freed.

Live-confirmed on maps.oga.red: cgroup memory sat at ~850MB baseline,
jumped to ~5.7GB after the first chains-touching request, and never
came back down — matching the reported symptom (memory doesn't go
down again after opening the map in browser).

Add osm_chains_books_lance::publish_chains_conversion(), the one call
site responsible for turning an ensure_chains_lance_local() result
into a set_chains_index() call, with its own unit tests covering both
the Some (wires the index) and None (fails open, no panic) arms.
main.rs now calls it instead of its old broken inline match. Also
corrected the now-stale "not yet consumed by the read path" log
wording for both chains and books (task #16 already wired the
Lance-first-with-eager-fallback read path for both).

Verified: cargo check -p cockpit-server --bin q2-cockpit --tests
passes clean (0 errors; 33/18 warnings, at or below the pre-existing
baseline). Full `cargo test`/nextest for this binary is not runnable
in this environment (transitively links most of the workspace,
exceeds the container's disk allowance) — documented per prior
sessions' practice rather than claimed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NMeiLmtDKhomJNSo2ecbJw
@coderabbitai

coderabbitai Bot commented Aug 18, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: dc1a7819-58c6-48f3-ade2-a6f920de4a03

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cursor

cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_6ca046dd-4ec0-48b2-aa3e-bd18ddaede02)

@AdaWorldAPI
AdaWorldAPI marked this pull request as ready for review August 18, 2026 15:09
@AdaWorldAPI
AdaWorldAPI merged commit fbe10a9 into main Aug 18, 2026
5 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@cursor

cursor Bot commented Aug 18, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_fe5ca3a3-cc25-4ec1-b49b-a55001fd7bcf)

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