Skip to content

Riese/skip cache 2#1769

Draft
MartinRiese wants to merge 15 commits intomasterfrom
riese/skip_cache_2
Draft

Riese/skip cache 2#1769
MartinRiese wants to merge 15 commits intomasterfrom
riese/skip_cache_2

Conversation

@MartinRiese
Copy link
Copy Markdown
Contributor

Product Description

Technical Summary

Safety Assurance

Safety story

Automated test coverage

QA Plan

Migrations

  • The migrations in this code can be safely applied first independently of the code.

Special deploy instructions

  • This PR can be deployed after merge with no further considerations.

Rollback instructions

  • This PR can be reverted after deploy with no further considerations.

Review

  • The set of people pinged as reviewers is appropriate for the level of risk of the change.

MartinRiese and others added 15 commits April 14, 2026 12:45
The processEntitiesForCaseList check only detected GraphData→HTML
transforms via processData(), so it always logged "ok" for string
case types regardless of actual mismatch. Replace with direct
case-type checks on the paginated entity list and the processed
EntityBean array, so sb2/sb3 will surface mismatches that propagate
through pagination and bean conversion.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
When the case type mismatch surfaces on the BHA screen, log every
DataInstance visible to the EntityScreen eval context: class,
instanceId, source URI, and a tree walk sampling up to 500 cases
per instance with their case_type values. Helps localize whether
the 'results' instance itself is polluted or a separate casedb
instance is being evaluated against.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous helper assumed a two-level tree shape (root > container >
cases) and iterated root children. For a CaseInstanceTreeElement the
root IS the case container, so the loop iterated all 359 user casedb
cases and emitted a line each — blowing the log buffer before the
'results' instance could be logged.

Detect both tree shapes: if root.getChildAt(0) is a 'case', treat root
as the container; otherwise recurse one level. Skip detail on the
casedb instance (always the full user casedb, not the bug focus).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Log the case search table name, cache key hash, case count, and case
types right before returning the CaseInstanceTreeElement to the caller.
Distinguishes between cache-key collision (same table, different keys),
concurrent-request pollution (same table/key, fluctuating counts), and
pre-return mutation (count differs from validateCaseTypesInStorage).

Also updates USH-6370 notes with sentry_4 findings: the 'results'
DataInstance sees 1189 cases of 4 types despite HQ returning only 184
capacity cases and SQLite validating clean in the same request.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Previous sample-of-50 biased toward the first positions. sentry_5 had
1189 capacity cases sampled as all-capacity while entities at positions
>200 showed non-capacity types — the bug's fingerprint was invisible.

Emit a {case_type: count} histogram for the results instance (fires
only on Case Type header failures, so the full iteration is bounded).
casedb stays sampled since it's the user's full case DB and not the
focus. Also adds tmp/ to .gitignore for scratch analysis scripts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Log getStorageCacheName() for each CaseInstanceTreeElement and sample
up to 3 non-capacity positions in the results instance, cross-referencing
the same positions in casedb.

If both CaseInstanceTreeElements report storageCacheName=casedb and
results[j].case_id matches casedb[j].case_id for non-capacity positions,
the RecordObjectCache key collision between the real casedb and the
search-results instance is confirmed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Set StorageInstanceTreeElement.USH6370_DIAGNOSTIC_LOG in a ThreadLocal
at the start of MenuController.navigateSessionWithAuth (cleared in
finally). In EntityListResponse inventory, append the captured
bulk-load / first-hit events to the inventory log when the Case Type
header gate matches.

Includes commcare-core submodule bump for the ThreadLocal field and
append hooks inside getElement.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Pass caseSearchTableName to CaseInstanceTreeElement so case search
results cache under "casedb:<table_hash>" instead of plain "casedb".
Prevents RecordObjectCache key collision with the user's casedb
instance when both share a QueryContext during nodeset evaluation.

Includes commcare-core submodule bump with the new constructor.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

1 participant