Skip to content

fix(resolve): copy the membership through the catalog on refresh, and cache a refused detach (#1502) - #1503

Merged
athvin merged 1 commit into
mainfrom
perf/1429-detach-membership
Nov 30, 2026
Merged

athvin merged 1 commit into
mainfrom
perf/1429-detach-membership

Conversation

@athvin

@athvin athvin commented Nov 30, 2026

Copy link
Copy Markdown
Owner

Closes #1502

Part of #1429. #1429 stays open until er-dev measures p95 under 300 ms.

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

  • The serving in-memory session refreshes itself.
    • er_cli::attach_lake attaches the catalog.
    • detach_corpus lists the corpus's data files and copies entity_membership into the session temp table __resolve_membership through the catalog (Session::copy_lake_table), so delete files and inlined rows apply exactly.
    • Session::detach_lake then releases the file lock, whatever the refresh did.
    • Only the standardized corpus needs to be plain data files.
  • A refused detach returns its reason. The server logs it once (resolve reads this dataset through the lake) and records it per change stamp (ResolveCache::refuse). A fallback dataset then opens the lake once per call, and no detach is retried until the catalog changes.

Why

On er-dev bbf4e4a6 (#1500), the lake-free path never ran: persistent=false on 61/61 calls, and wall time was about 500 ms worse (p50 2176 / p95 2535 ms).

  • detach_corpus refused p3live, most likely because its entity_membership carries delete files or inlined rows from many incremental runs.
  • The refusal wasn't cached, so each call opened the lake twice.

Proof

  • a_detached_resolve_matches_the_lake_resolve: the serving session refreshes itself (attach, detach_corpus, detach_lake) after the lake session releases the file catalog, and its answers equal the lake resolve (decision, candidates, probabilities, entity ids, snapshot), twice.
  • pg_launch_proof (local DuckDB-file lake, a run writing it between resolves) passes.
  • Resolve tests (8) and the freeform_sql gate pass.
  • make check: exit 0.

Risk & rollback

  • Lock time: the file catalog is held only during a refresh, which copies a narrow 4-column membership.
  • Detach: it runs even after a failed refresh.
  • Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: unclosed

  • main is green with this change on it — the merge SHA, and the run
    that proves it. A later head SHA with this commit as an ancestor counts;
    a cancelled run with zero jobs does not:
  • images built, or correctly never ran because nothing that goes into
    an image changed:
  • deploy converged — proved by a line the running process emitted, not
    by the image digest and not by the workflow conclusion:
  • the push-only surface no pull request can pre-test (deploy, drift,
    kind's nightly leg) is green, or knowingly red for a reason that is not
    this change:
  • the board card reached Done through the automation rather than by
    hand, and the issue closed:
  • follow-ups are open for everything deferred here — numbers:
  • what was learned is written down where the next session will find it
    (a skill, a reference, memory) — or nothing new was learned:

Specific to this change

  • er-dev resolve latency on p3live after deploy, 55 calls, with persistent=true (or the logged refusal reason):

🤖 Generated with Claude Code

… cache a refused detach (#1502)

On er-dev bbf4e4a the lake-free path never ran (persistent=false on 61/61),
and wall time rose about 500 ms. p3live's entity_membership has delete files or
inlined rows, so detach_corpus refused. Nothing cached the refusal, so every
call opened the lake twice: the failed detach, then the fallback.

- The serving in-memory session refreshes itself. er_cli::attach_lake attaches
  the catalog, detach_corpus lists the corpus's data files and copies
  entity_membership into the session temp table __resolve_membership through
  the catalog (Session::copy_lake_table), so deletes and inlined rows apply
  exactly. Then Session::detach_lake releases the lock, whatever the refresh
  did. Only the corpus must be plain data files.
- A refusal returns its reason. The server logs it once and records it per
  change stamp (ResolveCache::refuse), so a fallback dataset opens the lake
  once per call, as before #1500, and no detach is retried until the catalog
  changes.

a_detached_resolve_matches_the_lake_resolve now refreshes the serving session
itself (attach, detach_corpus, detach_lake) after the lake session releases
the file catalog, and still equals the lake resolve. pg_launch_proof (local
DuckDB-file lake, with a run writing it between resolves) passes. Resolve tests
(8) and the freeform_sql gate pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch was previously deployed

1 inactive deployment
marketing-preview — ad417fd7 Deployed Nov 30, 2026 by athvin via remove closed PR previews #197
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.

Resolve's lake-free session falls back on p3live, and retries the fallback every call (#1429 follow-up)

2 participants