Skip to content

test(pipeline): add Scala and Perl coverage and fix discovered defects - #52

Open
ciriacairic wants to merge 12 commits into
cregit-codev:masterfrom
ciriacairic:test/scala-and-perl-tests
Open

test(pipeline): add Scala and Perl coverage and fix discovered defects#52
ciriacairic wants to merge 12 commits into
cregit-codev:masterfrom
ciriacairic:test/scala-and-perl-tests

Conversation

@ciriacairic

Copy link
Copy Markdown

Summary

  • add ScalaTest coverage for the three legacy Scala pipeline modules (slickGitLog, persons, and remapCommits)
  • add black-box Test::More coverage for all eight Perl pipeline scripts
  • exercise existing blobExec tests and all new Scala/Perl suites in GitHub Actions
  • document the complete test matrix and reproducible local commands
  • fix production defects exposed while characterizing and reviewing the tested behavior

Production fixes uncovered by the tests

  • preserve the correct child/parent order and zero-based indexes for Git grafts, support grafted merges and bare repositories, and replace recorded parents with graft parents in SQLite
  • compare Person values by their fields instead of hash code alone, normalize email components with a locale-independent lowercase operation, and write the identity spreadsheet columns in the documented order
  • reject unknown tokenizer parsers correctly and avoid empty tokens caused by leading whitespace
  • propagate tokenizer failures without publishing a poisoned memoized result
  • return a non-zero status when the blame or HTML repository driver reports per-file failures

The successful-path formats and contracts remain unchanged. The behavior changes are limited to incorrect metadata and failure paths that previously produced wrong output or reported success.

Coverage

The added suites use temporary Git repositories, real SQLite databases and XLS/HTML/blame artifacts. External commands are stubbed only where the test is specifically about a repository-level driver.

  • legacy Scala: 39 tests across slickGitLog, persons, and remapCommits
  • Perl: 94 assertions across 8 test files
  • existing CI coverage retained: 37 blobExec tests, 5 C/C++ golden comparisons, and 14 Rust tokenizer tests

Lucca Oliveira added 12 commits August 12, 2026 09:50
Promote the nested remove_trailing_space and the graft-line split (as
parseGraftLine) to gitLogToDB methods, behavior unchanged, so they are
reachable from tests. The suite exercises them directly plus
git_commits_iterator/findGrafts/isBare against JGit fixture repos with
pinned identities and dates.
Lift the nested splitEmail/dealWithSingleWords defs and extract the
transitive email-merge fold (unifyByEmail) and preferred-name pick
(preferredName) out of main, behavior unchanged. The suite pins down
strip_accents, Person equality semantics, key building, and the
transitive merge that is the heart of the module.
Extract the footer parsing from git_commits_iterator into
extractOriginalCid(cid, message), behavior unchanged, and pin down its
edge cases: footer on/not on the last line, empty and newline-only
messages, uppercase or short shas falling back to cid.
The autodetect path guarded on "defined defined($parsers{language})" -
a doubled defined() over a bareword key - which is always true, so the
check could never fire. Use the intended $parsers{$language} lookup.
Defensive only: today every extension in %extensions maps to a defined
parser, so no observable behavior changes.
prove-run t/ suites for tokenizeSrcMl.pl (golden files mirroring the
srcMLtoken pattern, committed under tokenize/t/expected/), tokenize.pl
(dispatch parity with the direct tokenizer run), tokenBySha.pl (stubbed
BFG_TOKENIZE_CMD: memoization, cache hits, extension mapping, env
validation) and formatBlame.pl/blameRepoFiles.pl (on-the-fly fixture
repos with pinned dates; blame format, renames, filtering, overwrite).
All tests run the scripts as subprocesses; no script refactoring.
prettyPrint is deliberately not covered (needs fixture SQLite DBs for
low marginal value).
sbt builds become 'test assembly'/'test one-jar', and a prove step runs
the Perl suites after srcml2token is built (the golden tests need it).
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