Title: classMap nesting, and so code object ids, depend on call order within a module · Issue #388 · getappmap/appmap-python · GitHub
Open Graph Title: classMap nesting, and so code object ids, depend on call order within a module · Issue #388 · getappmap/appmap-python
X Title: classMap nesting, and so code object ids, depend on call order within a module · Issue #388 · getappmap/appmap-python
Description: Summary The classMap position of a class, and therefore the code object id of its methods, depends on the order in which functions in its module are first called during a recording. If a module-level function is called before a method of...
Open Graph Description: Summary The classMap position of a class, and therefore the code object id of its methods, depends on the order in which functions in its module are first called during a recording. If a module-lev...
X Description: Summary The classMap position of a class, and therefore the code object id of its methods, depends on the order in which functions in its module are first called during a recording. If a module-lev...
Opengraph URL: https://github.com/getappmap/appmap-python/issues/388
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"classMap nesting, and so code object ids, depend on call order within a module","articleBody":"## Summary\n\nThe classMap position of a class, and therefore the code object id of its methods,\ndepends on the order in which functions in its module are first called during a\nrecording. If a module-level function is called before a method of a class in the same\nmodule, the module is written as a `class` node and the class is nested inside it. If\nthe method is called first, the module is a `package` node. The same method then has a\ndifferent id in different recordings (`demo/util::Box#get` versus `demo/util/Box#get`),\nso tools that match or compare code objects across recordings treat them as two\nfunctions.\n\n## Environment\n\n- appmap (Python agent) 3.0.1\n- Python 3.10, Ubuntu, pytest\n\n## Steps to reproduce\n\n```sh\nmkdir repro && cd repro\npython3 -m venv .venv\n.venv/bin/pip install appmap pytest\nmkdir -p demo tests\ntouch demo/__init__.py\ncat > demo/util.py \u003c\u003c'PY'\ndef helper(x):\n return x + 1\n\n\nclass Box:\n def get(self):\n return 1\nPY\ncat > tests/test_util.py \u003c\u003c'PY'\nfrom demo.util import Box, helper\n\ndef test_method_first():\n assert helper(Box().get()) == 2\n\ndef test_function_first():\n helper(1)\n assert Box().get() == 1\nPY\ncat > appmap.yml \u003c\u003c'YML'\nname: demo\nlanguage: python\nappmap_dir: tmp/appmap\npackages:\n- path: demo\nYML\n.venv/bin/appmap-python .venv/bin/python -m pytest -q\npython3 - \u003c\u003c'PY'\nimport json, glob\nfor f in sorted(glob.glob('tmp/appmap/pytest/*.json')):\n def walk(n, p):\n p = p + [f\"{n['type']}:{n['name']}\"]\n if n['type'] == 'function':\n print(' ', ' > '.join(p))\n for c in n.get('children', []):\n walk(c, p)\n print(f.split('/')[-1])\n for n in json.load(open(f))['classMap']:\n walk(n, [])\nPY\n```\n\n## Expected\n\n`Box.get` has the same classMap path in both recordings, with `util` as a `package`\nnode in both.\n\n## Actual\n\n```\ntest_function_first.appmap.json\n package:demo > class:util > function:helper\n package:demo > class:util > class:Box > function:get\ntest_method_first.appmap.json\n package:demo > package:util > class:Box > function:get\n package:demo > package:util > function:helper\n```\n\nThe call events are the same in both cases (`defined_class` `demo.util.Box`, method\n`get`). Only the classMap differs.\n\nFirst seen on a real project indexed with `appmap index` (CLI 3.206.0) and read through\n`appmap query mcp`. There, `endaq.device.https_interface.HTTPSCommandInterface`\nmethods appear as `endaq/device/https_interface::HTTPSCommandInterface#_writeCommand` in\none recording and `endaq/device/https_interface/HTTPSCommandInterface#_writeCommand` in\nanother, and a `get_call_tree` focus on one id does not match the other recording.\n","author":{"url":"https://github.com/apps/devin-ai-integration","@type":"Person","name":"devin-ai-integration"},"datePublished":"2026-11-09T17:40:22Z","url":"https://github.com/getappmap/appmap-python/issues/388"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0acc4986-5bb8-8c38-6e96-7074c8f2505d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 86D4:177CF7:16D87FA:1D169F5:6B031025 |
| html-safe-nonce | a43ba59559096129a08238d237c297351784fbb75230b5ebfb01a06975fa3578 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NkQ0OjE3N0NGNzoxNkQ4N0ZBOjFEMTY5RjU6NkIwMzEwMjUiLCJ2aXNpdG9yX2lkIjoiMzcyMTQxMTY0NDE5MTA4NDU4MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | c5b3f8b876c3748ee68cb85370bf538f81245e4840f3d08a5fdbadc16daf7bcf |
| hovercard-subject-tag | issue:6291380509 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getappmap/appmap-python/388/issue_layout |
| twitter:image | https://opengraph.githubassets.com/782e7b289051eb884dc9ea5d4c0c7d820c50d3ebee58c5e5c400cc930fab48f2/getappmap/appmap-python/issues/388 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/782e7b289051eb884dc9ea5d4c0c7d820c50d3ebee58c5e5c400cc930fab48f2/getappmap/appmap-python/issues/388 |
| og:image:alt | Summary The classMap position of a class, and therefore the code object id of its methods, depends on the order in which functions in its module are first called during a recording. If a module-lev... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | devin-ai-integration[bot] |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/getappmap/appmap-python git https://github.com/getappmap/appmap-python.git |
| octolytics-dimension-user_id | 46610017 |
| octolytics-dimension-user_login | getappmap |
| octolytics-dimension-repository_id | 314785884 |
| octolytics-dimension-repository_nwo | getappmap/appmap-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 314785884 |
| octolytics-dimension-repository_network_root_nwo | getappmap/appmap-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width