Skip to content

fix(query): normalize missing callstack attribution - #166

Merged
codeasier merged 1 commit into
mainfrom
fix/issue-163-missing-callstack
Oct 3, 2026
Merged

codeasier merged 1 commit into
mainfrom
fix/issue-163-missing-callstack

Conversation

@codeasier

Copy link
Copy Markdown
Owner

📝 Description

  • Normalize empty strings, NULL text/IDs, and missing allocation-event/callstack joins to [missing callstack] in both SQL layouts of active_memory_callstack_at_event.
  • Merge missing dynamic attribution before top_n, preserving bytes, requested bytes, block counts, and category. Use an explicit normalized grouping key to avoid SQLite resolving GROUP BY callstack to the source column. Nonempty v1 groups use text; v2 groups use callstackId per repository guidance.
  • Raise this template’s shared semantics_version to 2 because merging affects ranked groups and percentages. Document whitespace/literal-label boundaries and that display labels are not unique identities.
  • Update the peak skill interpretation paragraph and its identical bundled copy, including guidance for older empty-label output.

🔗 Related Issue

Fixes #163

🧪 Testing

  • Tests added/updated
  • Manual testing completed

All local Python commands used /Users/test1/liuyekang/miniconda3/bin/python, with this worktree’s src first on PYTHONPATH. Pytest ran from the worktree root with an isolated HOME and the existing user site retained; no editable install was changed.

  • python -m pytest tests/test_fixture_provenance.py -q — 7 passed before deserializing suites.
  • Regression-first check reproduced 9 failing cases before the fix.
  • Focused checks: callstack layout compatibility, peak templates, semantic metadata, CLI/API contracts, peak skill, bundled skills — 98 passed.
  • python -m pytest tests/query tests/core/test_query_service.py tests/core/test_capability_service.py tests/core/test_report_service.py tests/test_cli.py tests/test_cli_json.py tests/test_api.py tests/test_contract_cli_api.py tests/skills tests/test_bundled_skills.py -q — 555 passed.
  • python -m ruff check . — passed.
  • python -m black --check . — 155 files unchanged.
  • python -m basedpyright --pythonpath /Users/test1/liuyekang/miniconda3/bin/python --outputjson — 61 files analyzed, 0 errors, 831 informational/non-gating warnings.
  • git diff --check — passed.

Coverage includes both layouts, mixed empty/NULL/dangling/missing joins, normal stacks, whitespace and literal-label boundaries, static/preexisting separation, bytes/requested-bytes/block conservation, top_n, min_size, max_rows percentage denominators, and CLI/API capabilities/template-info/result consistency.

✅ Checklist

  • Code follows project guidelines
  • Documentation updated (if applicable)
  • No new warnings introduced
  • Changes tested locally

Snapshot Runtime Provenance

  • Snapshot provenance evaluation completed when snapshot runtime files change
    Snapshot provenance decision: no-update
    Snapshot provenance no-update reason: Only one query YAML, regression tests, and peak skill interpretation copies change; snapshot runtime, import behavior, and database schema are untouched.

📸 Screenshots (if applicable)

Not applicable.

📋 Additional Notes

  • Local validation covers the relevant complete suites, not the entire repository suite. The environment emits a pytest-asyncio fixture-loop-scope deprecation warning; type warnings remain informational under the repository gate.
  • Overlap with pt-snap-helper and the diagnostic skills contradict each other on prerequisite probing #162: skills/pt-snap-memory-peak-breakdown/SKILL.md and src/pt_snap_cli/bundled_skills/pt-snap-memory-peak-breakdown/SKILL.md. This PR edits only the static/preexisting/dynamic interpretation paragraph, away from the preflight changes.
  • No other query templates, specs, or superpowers files are included.

@codeasier
codeasier merged commit 5ca0f0a into main Oct 3, 2026
6 checks passed
@codeasier
codeasier deleted the fix/issue-163-missing-callstack branch October 3, 2026 19:18
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.

Capabilities doc says [missing callstack], but the template returns an empty string

1 participant