Skip to content

fix(codecharta): merge without a terminal, apply directory excludes to DependaCharta, optionally limit git history - #146

Merged
peuf0u merged 1 commit into
mainfrom
fix/codecharta-non-interactive-merge-and-excludes
Nov 5, 2026
Merged

peuf0u merged 1 commit into
mainfrom
fix/codecharta-non-interactive-merge-and-excludes

Conversation

@peuf0u

@peuf0u peuf0u commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Three fixes to universal-codecharta-snapshot, found while adopting the CodeCharta workflow in repos that weren't greenfield. One new optional input; existing callers keep the current behaviour.

 snapshot()
   run_dependacharta
+    hide each extra_excludes entry that is an existing directory
+    (empty dir mounted over /source/<path>)
   ccsh unifiedparser / tokei
-  ccsh gitlogparser repo-scan
+  if git_log_since
+    git log … -m --since=<date> + git ls-files → ccsh gitlogparser log-scan
+  else
+    ccsh gitlogparser repo-scan
   dependachartaimport / edgefilter
-  ccsh merge
+  ccsh merge -f
  1. The merge step crashed on CI. When the input maps share no top-level folder, ccsh merge asks for confirmation in a terminal session (MergeFilter.continueIfIncompatibleProjects). The runner has no terminal, so the run dies with IllegalStateException: Unable to create a system terminal. -f only skips that check.
  2. extra_excludes didn't apply to DependaCharta. The pinned fork (fork-v0.2.1) has no exclude option, so a vendored tree was analysed file by file. In an Android app with a ~2,900-file engine export, DependaCharta took 13 of the job's 15 minutes and the run was cancelled. An entry that names an existing directory is now hidden by mounting an empty directory over it. Regex and file patterns still apply only to ccsh and tokei. It works with any DependaCharta image.
  3. Some history can't be parsed. In a repo whose tree was replaced in a single commit (thousands of deletions, directory renames), the CodeCharta git log parser loses every file created afterwards: the git map held 11 of ~1,000 files. That map then has no top-level overlap with the others, which triggers (1). git_log_since builds the same log repo-scan generates, limited with --since, and feeds it to log-scan.

Evidence

Run locally with codecharta.sh snapshot and codecharta/codecharta-analysis:1.143.0:

Case Before After
Swift repo with a replaced tree, git_log_since: <date after the replace> git map 11 leaves → merge prompts → crash git map 858 leaves; final map: 611 Swift files with complexity, 484 with commit data
Kotlin repo, extra_excludes: <engine export dir> DependaCharta 3,309 files, 13 min on CI → cancelled DependaCharta: excluding directory …; 1,264 files, no nodes from the excluded tree; final map written
git_log_since: not-a-date — map written (git log --since is lenient)

actionlint and shellcheck -S warning are clean. The excludes path was also run under bash 3.2: empty arrays are expanded safely with set -u.

Merge Danger

Door: two-way

Blast Radius: CodeCharta consumers

  • Merge -f: changes nothing when the maps overlap, which is the normal case.
  • Directory excludes: callers already passing extra_excludes with directory paths will now also have those directories left out of the DependaCharta graph. That's the documented intent of the input, but their graphs will lose those nodes.
  • git_log_since: has no effect when unset.

Needs a release (bump-action-refs.sh) before consumers can use git_log_since.

…o DependaCharta, optionally limit git history

- ccsh merge gets -f: when the input maps share no top-level folder it asks
  for confirmation in a terminal session, which crashes on CI.
- extra_excludes entries that name an existing directory are hidden from
  DependaCharta by mounting an empty directory over them; the pinned image
  has no exclude option, so a large vendored tree was analyzed file by file
  and could exceed the 15-minute job timeout.
- New git_log_since input limits the history the git metrics are built
  from, for repos whose older history the git log parser cannot follow.
@peuf0u
peuf0u merged commit a5f4c24 into main Nov 5, 2026
2 checks passed
@peuf0u
peuf0u deleted the fix/codecharta-non-interactive-merge-and-excludes branch November 5, 2026 15:17
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