Skip to content

[BUG] Scanner: directories named log, logs, classes, docs (and other ambiguous names in IGNORED_DIRECTORIES) are skipped by name, hiding real source, and are not recorded as excluded #8708

Closed

Description

@squid-protocol

What happens

IGNORED_DIRECTORIES skips a directory by its name alone. Several of the names in that set are also ordinary source-directory names, so real first-party code is dropped from the scan, with no record of it: the skipped files are not listed in excluded_artifacts either.

Found while building a repository-history report on DPDK: its logging library, lib/log/ (log.c, rte_log.h and six more code files), is absent from every scan. rte_log, which had 7,608 callers in 2021 Q4 and was the most-called function in the project, simply disappears from the call graph, and the repository's hub list is wrong.

Where

  • gitgalaxy/standards/gitgalaxy_config.py, IGNORED_DIRECTORIES, section 8 "Transitory Runtime Data & Temp Files / Data": "tmp", "temp", "logs", "log" (about lines 259 to 263); also "classes", "docs"/"DOCS", "target", "site", "legal", "license(s)" and others in the same set.
  • gitgalaxy/core/aperture.py:452: self.ignored_directories = {d.lower() for d in ...}, so the match is case-insensitive.
  • The same set is read in gitgalaxy/core/guidestar_lens.py:467 and gitgalaxy/metrics/chronometer.py:302.

How to see it

  1. DPDK at c6d273ce156cc48ef90e64e93a2bba80c9d36345 (public, dpdk.org). git ls-tree -r --name-only HEAD lib/log lists 8 code files.
  2. Scan it. In the scan database: SELECT count(*) FROM file_data WHERE file_path LIKE 'lib/log/%' is 0, and the same query on excluded_artifacts is 0 too.
  3. SELECT count(*) FROM function_data WHERE func_name = 'rte_log' is 0 (the function is defined at lib/log/log.c:517).

Expected: the first-party library is scanned, or at least listed as excluded with a reason.

Class: ambiguous directory names in the blocklist

Names that are also real source directory names, matched by name only. Members checked by listing code files (.c .h .cc .cpp .hpp .py .go .rs .java .js .ts) under a directory of that name in 15 public repositories at HEAD (dpdk, mesa, curl, redis, openssl, libxml2, libgit2, expat, nDPI, harfbuzz, prometheus, sphinx, scapy, sqlmap, ripgrep):

member status evidence
log harmful: real source skipped dpdk lib/log/: 8 code files (log.c, rte_log.h, ...)
logs same mechanism no instance in the 15 repositories
classes harmful: real source skipped mesa src/nouveau/headers/nvidia/classes/: 129 headers (cl0039.h, ...)
docs / DOCS judgement call curl docs/examples/: 143 C example programs; mesa docs/_exts/: 20 Python files
target judgement call sphinx tests/roots/test-ext-autodoc/target/: 59 Python fixture files
tmp, temp, build, _build, dist, obj, site, legal, license(s) same mechanism no instance in the 15 repositories
third_party, thirdparty, vendor, 3rdparty, ... intended vendored code; out of scope (see #4545, #5464)

Precedent in the code

The same problem was already solved for two members: env, .env and virtualenv are decided by markers (aperture.looks_like_virtualenv, #4542), and vendored directories by evidence (aperture.VendorDirectoryDetector, #4545). The comment at aperture.py:51 states the rule: a name stays in the set only if "nobody names a source directory that".

Acceptance

  • Keep in the by-name set only names nobody uses for source (node_modules, .git, __pycache__, ...). Move the ambiguous members above to evidence-based detection (for example: skip a log or logs directory only when it holds no source-language files, or when its contents are runtime logs such as *.log).
  • Every directory pruned by name, or by evidence, is recorded in excluded_artifacts with a reason (ignored directory: <name>), so a scan states what it did not read.
  • A test with a fixture tree containing lib/log/log.c (scanned) and var/log/app.log (skipped and recorded).
  • Decide docs and target explicitly: example and fixture code is first-party but not product code; whichever way, it is recorded.
  • Re-bless any golden master that moves (lib/log/ adds functions to DPDK-like fixtures).

Impact

Every metric for the affected repository: function counts, the call graph and its hubs, comment and debt counts. The loss is silent, so a user cannot tell a hub is missing.

Activity

  1. added
    bug
    core-engine
    on Nov 19, 2026
  2. squid-protocol commented on Nov 21, 2026

    @squid-protocol
    OwnerAuthor

    Claimed by promoter-bot host melek, lease renewed 2026-11-21T21:53Z. It lapses after 6 h without a renewal. To take it back, assign someone or remove the claim:melek label.

  3. squid-protocol commented on Nov 21, 2026

    @squid-protocol
    OwnerAuthor

    Leftover from #8933: apply the evidence prune to the chronometer.py fallback walk (no-git-history path), which no longer prunes these names by name. Not in #8933 because of the 5-file cap. No scope change today.

  4. added a commit that references this issue on Nov 27, 2026
    505e14a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugclaim:melekcore-enginepriority: medium

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions