Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

chore(health): keep only the current bump note on the analyzer stamp (#4669)

Raghav Chamadiya079dc8be8964
diff --git a/packages/core/src/repowise/core/analysis/health/engine.py b/packages/core/src/repowise/core/analysis/health/engine.py
index 37747d772..84767c7bf 100644
--- a/packages/core/src/repowise/core/analysis/health/engine.py
+++ b/packages/core/src/repowise/core/analysis/health/engine.py
@@ -109,311 +109,8 @@ log = structlog.get_logger(__name__)
# as migrations. Stored origins decide health and dead-code scope, so those
# files re-score.
#
-# v42: a JavaScript-family file under a ``tests/`` folder inside a ``src`` tree
-# is production unless its name or a test directory says otherwise, and the
-# cross-file assertion pass reads the stored test flag, which moves scope and
-# findings for those files.
-#
-# v41 (also): a loop that grows only by reading tables that do not grow with
-# the repository is bounded (``perf.table_scale``), so its causes leave the queue.
-# v41 (also): ``docs`` / ``docs_src`` count as a docs root only at the
-# repository root or beside a docs-site generator's config, so a product's
-# ``app/docs/`` route is production and stored ``code_origin`` is re-read.
-# v41: ``brain_method`` is advisory, so every stored score that carried one
-# moves. Parameter counts exclude every comment kind and discover C/C++
-# declarators and Kotlin lists; cached walks refresh the total, typed and scalar
-# counts, enabling primitive_obsession in those languages.
-# History findings de-stack before the history cap (``scoring.destacked``).
-# Defect code categories follow a saturating curve scaled by their cap, findings on
-# one function group, and critical size findings scale past their threshold
-# (``shape_curve``).
-#
-# v40: an Extract Method plan names its helper with a placeholder
-# (``extracted_helper``, numbered when taken in scope) and asks the agent applying
-# it to rename it, so every stored plan's ``suggested_name``, header and call text
-# change. Plan ids do not depend on the name and hold.
-#
-# v39: a Python module named like a test outside every test
-# directory is production code when the nearest pytest config's ``testpaths``
-# or ``python_files`` leaves it out (``core/test_selection.py``). Its
-# ``is_test`` flag flips, and the biomarkers and ``has_test_file`` now read that
-# stored flag instead of re-classifying the path, so such a module joins the
-# production scores and findings. A callback passed to a chained or curried
-# call (``it.each([...])(...)``, ``z.object({...}).superRefine(...)``) is named
-# by the call's dotted path without its arguments, so findings and perf hits
-# inside one get a new ``function_name`` and a new public id; triage stored on
-# the old id no longer attaches.
-#
-# v38: Split File's co-change edge reads per-function commit
-# sets (the 50 newest distinct commits of each function, stored on
-# ``git_function_blame``), and a class takes the union of its methods' sets
-# instead of blame over its whole span. Group membership is a kernel input to
-# the ``split_file`` id, so ``REFACTORING_MODEL_VERSION`` moved 3 -> 4 with it:
-# every refactoring id now carries the ``refac4_`` prefix, and a held ``refac3_``
-# id reports ``stale_model``.
-#
-# v37: schema migrations are ``tooling`` in the performance
-# ``execution_context`` (any ``migrations/`` directory, Rails ``db/migrate``,
-# Alembic ``alembic/versions``). The context is stored on every performance
-# opportunity and is a kernel input to its id, so ``PERFORMANCE_MODEL_VERSION``
-# moved 2 -> 3 with it: every performance id now carries the ``perf3_`` prefix,
-# and a held ``perf2_`` id reports ``stale_model`` instead of a silent miss.
-#
-# v37 (also): refactoring plans credit what they remove. Extract Method, Extract
-# Class (``god_class``) and Extract Helper claim the share of the finding that
-# moves, a span must clear a minimum-worth floor, ``slice_nloc`` counts code
-# lines only, and JSX prop plumbing earns no Extract Method. Stored plans and
-# opportunities change, and ``REFACTORING_MODEL_VERSION`` moved with this.
-# v37 (also): the walker records ``dispatch_share`` and ``deprecated`` per
-# function, which a cached v36 walk does not carry, and each file metric gains
-# ``code_origin``. Complexity findings copy ``dispatch_share`` into their
-# details and findings on a deprecated function gain ``deprecated: true``. No
-# CCN, threshold, weight or score moves.
-# v37 (also): a finding inside a function or class records that symbol's first
-# line (``details["symbol_line"]``) and its public id is anchored on the symbol
-# plus the offset into it, hashing no metric values, so every stored finding id
-# moves once.
-# v37 (also): the walker records each function's deepest nested block and each
-# performance hit's loop header line; size findings carry ``deepest_block`` and
-# performance findings ``loop_line`` in their details, both outside the id
-# kernel. A cached v37 walk without them reads the defaults (absent).
-# v37 (also): a perf hit inside a lambda with no named function around it is
-# named for that lambda (``build``, ``it callback``), so its stored
-# ``function_name`` and public id change; top-level script code still carries
-# none. The v3 performance model also keys one opportunity per intervention, so
-# every stored opportunity id and the id stamped on every perf finding change.
-# ``lazy_load_in_loop`` findings carry ``details["orm"]``, which moves their
-# public ids and, for Django, their performance weight (0.4 -> 0.7).
-#
-# v36 (also): which files are tests changed (``repowise.core.test_paths``).
-# Compound directories headed by a test word (``e2e-tests/``, ``pkg_tests/``,
-# ``integration_test/``) became test trees, and ``test``/``.test.`` filenames
-# stopped counting on configuration (``tsconfig.test.json``, a workflow's
-# ``*.test.yml``) and on a bare non-Python ``test.ts``. Every biomarker that
-# exempts or targets tests reads that flag, so stored findings move.
-#
-# v35 (also): a multi-item ``with`` header is classified on its oracle rather
-# than on whichever context manager the author happened to type first.
-# ``assert_call_kinds`` is the language's plain call node, not an assertion
-# shape, so the header scan returned the first call it met and classified only
-# that one: ``with pytest.raises(E), atomic():`` counted nothing while
-# ``with atomic(), pytest.raises(E):`` counted one. Each item is classified now,
-# and a declining call's arguments are not scanned, so an assertion passed as an
-# argument still does not stand in for the header's oracle.
-#
-# v36: files a package manifest declares (package.json ``bin``, a built
-# ``main`` mapped to its source, a distribution's package ``__init__``) are
-# entry points, so perf findings reachable from them are marked so.
-#
-# v35: the update's full re-score reads every stored git column, so the
-# percentile gates of ``prior_defect`` and ``co_change_scatter`` see their
-# inputs, and it keeps the stored blame-marker findings it cannot recompute.
-# A store an older re-score wrote is missing those findings.
-#
-# v34: ``hidden_coupling`` is advisory: still detected and stored, it no longer
-# deducts from the defect score, so every stored score that carried one moves.
-#
-# v33: git history windows are measured from the indexed commit's committer
-# date instead of wall-clock time, by default. ``code_age_volatility`` and the
-# per-function blame rollup read line ages from the same anchor, so a store
-# scored against wall-clock time holds different windowed findings for any repo
-# whose last commit is not today.
-#
-# v32: the history (organizational) cap follows the file's structure half,
-# ``history_cap(structure)`` in scoring.py, so every stored score that carries
-# a history deduction, and the refactoring impact figures, move.
-#
-# v31: Pascal opts into assertion detection (``assert_call_kinds``): DUnit's
-# ``Check``/``CheckEquals``/``Fail`` family (a new ``asserts/lexicon.py`` row,
-# broad tier) and DUnitX's ``Assert.*`` plus the RTL's own ``Assert(cond, msg)``
-# (narrow tier, no row needed -- ``Assert`` itself is an assert-prefixed
-# identifier). A new ``expr_stmt_kinds`` field tells the walker that a call in
-# flat statement position sits under a node named ``statement``, not the
-# hardcoded ``expression_statement`` every other mapped grammar uses.
-# ``block_kinds`` also gains ``statements`` (plural) -- a ``try``'s guarded
-# body and its ``except``/``finally`` clauses use that distinct container, not
-# ``block``, so every assertion inside a ``try ... finally Free; end`` (close
-# to universal in Delphi tests) was invisible before this: measured on a real
-# ~150-file Delphi codebase's Test*.dpr suite, assertion coverage moved from
-# 66/120 files (1844 assertions) to 86/120 (2873). ``large_assertion_block`` /
-# ``duplicated_assertion_block`` now fire for Pascal; ``assertion_free_test``
-# deliberately does not -- it gates on a ``SHIPPING_LANGUAGES`` allowlist that
-# needs its own measured-precision pass before Pascal joins it.
-#
-# v30: a Pascal call to a zero-argument procedure may omit its parentheses
-# entirely (``Q.Open;``), which produces no ``exprCall`` node at all -- just a
-# bare ``identifier`` / ``exprDot`` under a ``statement`` wrapper, invisible to
-# the whole performance pass regardless of sink kind. The new
-# ``bare_call_wrapper_kinds`` / ``PerfDialect.bare_statement_call`` hook (a
-# no-op for every language that does not map it) tells that shape apart from
-# the wrapper's other tenants (``Exit;`` / ``inherited;``), so ``Q.Open;`` now
-# finds the same ``io_in_loop`` as ``Q.Open();`` already did.
-#
-# v29: Pascal's ``uses`` clause now feeds ``io_boundaries.collect_io_names``
-# (``FireDAC`` / ``ADODB`` -> db, ``IdHTTP`` / ``System.Net.HttpClient`` ->
-# network), and the Pascal ``PerfDialect`` gates ``TDataSet.Open`` /
-# ``.ExecSQL`` / ``.Post`` and an HTTP client's ``.Get`` / ``.Post`` on that
-# evidence -- a loop calling one of these now produces a ``db`` / ``network``
-# ``io_in_loop`` where before it stayed silent (filesystem/subprocess only).
-#
-# v28: Pascal's ``foreach`` (``for x in collection do``) was absent from its
-# ``loop_kinds``, so a for-in loop contributed no CCN and opened no nesting
-# level -- stored complexity / nesting for any Pascal function using one
-# understates both. Pascal also gained a ``PerfDialect`` (filesystem /
-# subprocess sinks by RTL/VCL/FPC name), so ``io_in_loop`` / ``hot_path_sync_io``
-# now fire for it instead of the pass silently skipping every Pascal file.
-#
-# v27: a new marker, ``lazy_load_in_loop`` (a lazy relationship read on each
-# iteration of a loop over its rows); and ``unbounded_read_reduced_in_memory`` now
-# runs on ``init`` too, where it never ran before. A v26 store built by ``init`` has
-# neither marker; one built by ``update`` has the second.
-#
-# v26: ``.all()`` on an imported or module-global name (a plugin registry) is not a
-# db sink, a SQL string saying ``LIMIT n`` caps a read, and a batched read is never
-# proven for ``session.get`` or beside a call made for its effect; a v25 store differs.
-#
-# v25: repetition with nothing to change (a filesystem or subprocess boundary, or
-# a loop already walking chunks) is stored as ``expected``; a v24 store says investigate.
-#
-# v24: ``session.get(Model, key)`` is a db sink, an awaited TS limiter closure runs
-# in its loop, and Go/Java loops report chunking; a v23 store has none of them.
-#
-# v23: loop-shaped perf findings carry the loop's magnitude, the bulk form of a
-# per-key sink and any concurrency bound around it; a v22 store has none.
-#
-# v22: perf findings in a chunked loop carry ``chunked_iteration``, and
-# ``unbounded_read_reduced_in_memory`` is a new marker; a v21 store has neither.
-#
-# v21 moves two stored counts, both of which were order-dependent in the same
-# way. ``assertion_count`` rises on such a header. ``mock_setup_count`` falls on
-# it, because ``mock_walk._count_body_setup`` skips a statement
-# ``_is_assertion_statement`` admits and that predicate runs this same branch --
-# ``with patch(...), pytest.raises(E):`` already counted no mock setup in v20,
-# and the reversed spelling now agrees with it. Both feed
-# ``mock_saturated_test``, one per side of its ratio, and it is advisory.
-#
-# ``assertion_blocks`` does not move at all: a ``with`` header is capped at the
-# broad tier, so it can never join a narrow run. Verified set-for-set against
-# v20 on four corpora, with the average defect score unmoved on all four and no
-# ``mock_saturated_test`` finding gained or lost. The two calibrated block
-# markers read that field alone and are untouched, and every reader of the two
-# counts above is advisory, so no score moves. Python is the only language that
-# maps ``with_kinds`` and opts into assertion detection, so no other language's
-# rows change. A cached v20 walk carries the old counts, and this stamp is what
-# re-walks them.
-#
-# v20: every marker now reads ``FileContext.all_functions``, the full
-# walked list, where eleven of them used to read a ``function_metrics`` map keyed
-# by function name. That key kept one row per distinct name, so a file's anonymous
-# ``it`` callbacks collapsed into one and a method shadowed its same-named
-# neighbour on another class. What moves is how much of that walk each marker
-# sees, on every scoring marker at once, which makes persisted rows wrong. The
-# walk itself is unchanged, but this stamp keys the walk and duplication-token
-# caches, so bumping it re-walks and re-tokenizes anyway.
-#
-# v20: ``assertion_free_test`` stops reading a containing symbol as the test.
-# ``ExecutionGraphIndex.resolve_function`` falls back to the innermost symbol
-# whose range holds the start line, which tolerates a decorator offset but also
-# answers a wrapper declaration -- a TS ``const suite = describe(...)`` spans
-# every callback inside it -- for every test in it at once. One delegating test
-# then suppressed its silent siblings through that wrapper's edge. The oracle
-# pass now asks for the function rather than its enclosure, so those findings
-# come back, and nothing re-mints the rows a v19 store suppressed except this
-# stamp.
-#
-# v20 also reads a hand-rolled ``raise`` / ``throw`` as an oracle, for which the
-# walker records one new ``FunctionComplexity`` field, ``raise_count``, that a
-# cached v19 walk does not carry at all. It is its own field rather than a term
-# in ``assertion_count`` precisely so that it moves nothing calibrated:
-# ``mock_saturated_test`` and ``large_assertion_block`` read ``assertion_count``
-# and ``assertion_blocks`` directly and are untouched. Only
-# ``assertion_free_test`` and the oracle pass behind it read the new field, both
-# through ``asserts/predicate.checks_something``, and both as a boolean.
-#
-# v20 finally reads an assertion call from a position ``_assertion_tier`` never
-# classifies, because that pass classifies statements: a ``const e =
-# expect(x)`` is a declaration and a ``return expect(x).toBe(1)`` is a return,
-# and neither reaches it. ``checks_something`` asks ``called_names`` for a
-# callee under ``NARROW_PREFIXES`` as a floor under the count, and the walker
-# now collects those names through nested function bodies rather than stopping
-# at them -- a function nested in an already-collected one is never collected
-# as an entry of its own, so its calls were recorded nowhere at all. The
-# *counts* still stop at a nested function, so ``assertion_count`` is
-# bit-identical to v19; only the name sets widen, and a cached v19 walk carries
-# the narrower ones. No score moves; the marker is advisory.
-#
-# v19: ``assertion_free_test`` resolves a test's oracle across file
-# boundaries, on a call edge rather than by name, so a test that delegates its
-# checks to a helper in another module is no longer called assertion-free. The
-# resolution itself is a graph pre-pass, but the walker also records one new
-# ``FunctionComplexity`` field for it, ``bare_called_names``, which a cached
-# v18 walk does not carry at all: it is the subset of ``called_names`` whose
-# call site had no receiver, and the pass pairs it with a file-scoped call edge.
-# The marker also reports fewer findings than a v18 store holds, and nothing
-# re-mints those rows except this stamp. It counts nothing, so no score moves.
-#
-# v17: the walker records one new ``FunctionComplexity`` field,
-# ``called_names``, which a cached v16 walk does not carry at all. It feeds the
-# advisory ``assertion_free_test``, which no longer calls a test assertion-free
-# when it handed its checks to a function in the same file that asserts. It
-# counts nothing, so no calibrated marker reads it and no score moves.
-#
-# v16: the health pass reads a ``.tsx`` file with the JSX grammar.
-# It arrives tagged ``typescript``, and the grammar that tag selects errors on
-# the first ``<Component />``, so a cached v15 walk stored an ERROR-recovered
-# tree. Three things stored under it change for ``.tsx`` files and nothing
-# else: ``assertion_count`` and ``assertion_blocks`` (assertions after the
-# first element were not seen at all), the clone token stream the duplication
-# detector hashes, and the dataflow CFG. Function names change too -- recovery
-# swallowed whole source spans into the callee name, and those accidentally
-# unique names were defeating ``function_metrics``' name key, so the two
-# calibrated block markers see a ``.tsx`` file the way they have always seen a
-# ``.ts`` one. Non-``.tsx`` files are byte-identical, verified file for file.
-#
-# v15: ``assertion_free_test`` landed, and the walker records two new
-# ``FunctionComplexity`` fields for it (``verification_count``, ``is_test_case``)
-# that a cached v14 walk does not carry. It also widens ``assertion_count`` in
-# every language that counts assertions at all -- a ``with`` header, a
-# property-terminated chain, a lambda body, a private ``_assert*`` helper and
-# Java's split call shape all reach the broad tier now -- so the advisory
-# ``mock_saturated_test`` divides by a different, larger denominator than a v14
-# walk stored. The narrow tier the calibrated block markers read is unchanged,
-# verified run-for-run against v14 on four corpora, so no score moves.
-#
-# v14: the assertion count gained a per-language broad tier, so a Go
-# or JS/TS file's ``assertion_count`` changes from what a cached v13 walk stored
-# for it. The narrow tier the calibrated block markers read is unchanged, so no
-# score moves; this stamp is what re-walks the files whose advisory denominator
-# does. Go's row changes no finding until Go also has a mock dialect — it is
-# there for the markers that read this count next.
-#
-# v13: ``mock_saturated_test`` gained a TypeScript / JavaScript
-# vocabulary, so a TS or JS file's ``mock_setup_count`` changes from the zero a
-# cached v12 walk stored for it.
-#
-# v12: ``mock_saturated_test`` landed and the walker records two new
-# ``FunctionComplexity`` fields, which a cached v11 walk does not carry.
-#
-# v11: F# and Objective-C gained working complexity node maps and Elixir lost
-# its broken one, so stored complexity changes for files in those languages.
-#
-# v10: non-code files stopped being scored and the deduction was split into its
-# structure and history halves, stored per file.
-#
-# v9: C gained a complexity node map. ``LANGUAGE_NODE_MAPS`` had no
-# ``c`` entry, so every C file scored as if it had no branches: ``max_ccn`` and
-# the maintainability index were computed off an empty node set and persisted
-# that way. The map is present now, so a C file's stored complexity metrics and
-# the findings keyed off them change on the next update. C-free repos are
-# unaffected; the stamp is what makes a C repo re-score instead of waiting out
-# the decay timer.
-#
-# v8: paired-test detection changed. ``_has_paired_test_file`` had
-# ``test_<stem>.py`` hardcoded, so the prefix layout only ever matched Python;
-# it now follows the file's own suffix, and ``<stem>_spec`` joins the suffix
-# forms. Files that were counted untested and are not become tested, which
-# moves untested-hotspot findings and the scores that carry them, on every
-# language with a prefix or spec convention rather than Ruby alone.
+# Earlier bumps and their reasons: ``git log -S"HEALTH_ANALYZER_VERSION =" -p``
+# on this file.
HEALTH_ANALYZER_VERSION = 43