Skip to content

Code audit: fix 67 bugs across 8 core files#22

Open
iahncajigas wants to merge 2 commits intomasterfrom
audit/code-fixes-2026-03-10
Open

Code audit: fix 67 bugs across 8 core files#22
iahncajigas wants to merge 2 commits intomasterfrom
audit/code-fixes-2026-03-10

Conversation

@iahncajigas
Copy link
Collaborator

Summary

  • Comprehensive 5-phase code audit of all 15 nSTAT core classes
  • 67 bug fixes across 8 files, all tagged with inline % FIX: comments
  • Added AUDIT_REPORT.md with full findings and verification commands
  • Updated README.md with audit summary

Critical bugs fixed

  • FitResult.m — KS test used sampleRate as bin width instead of 1/sampleRate
  • DecodingAlgorithms.misa(x,'nan') always false; ExplambdaDeltaCubed used .^2 instead of .^3
  • CIF.msymvar() reordered variables alphabetically, breaking matlabFunction argument ordering
  • SignalObj.mfindPeaks('minima') returned maxima; sOBj typo crashed findGlobalPeak; handle aliasing mutated inputs in arithmetic
  • nspikeTrain.m — Burst detection off-by-one and wrong append order

Code quality

  • 22 eval()feval() conversions (SignalObj.m)
  • 11 silent catch → named exception captures
  • 7 roundnround (removes Mapping Toolbox dependency)
  • log(0) guards, div-by-zero guards, float index fixes
  • fitType validation, deprecated function annotations

Files changed (11)

File Changes
SignalObj.m 22 eval→feval, typos, minima fix, handle aliases, CI fix
FitResult.m delta bug, 3 log guards, 6 silent catches
DecodingAlgorithms.m 3 isnan, 4 ld^3, 1 Q-index
nspikeTrain.m div-by-zero, burst fix, 7 roundn, close-all, histc annotations
CIF.m 16 symvar fixes, fitType validation, simget annotations
FitResSummary.m 3 silent catches
History.m magic number, 2 float index, array growth
Analysis.m magic number annotation
getPaperDataDirs.m 1 silent catch
AUDIT_REPORT.md New — full audit report
README.md Audit summary section

Test plan

  • Verify all 5 paper examples run without error
  • Confirm grep -rc '% FIX:' *.m returns 67 tags across 8 files
  • Run KS goodness-of-fit test with sampleRate != 1 to confirm delta fix
  • Test findPeaks('minima') returns actual minima
  • Test CIF construction with non-alphabetical variable names

🤖 Generated with Claude Code

iahncajigas and others added 2 commits March 11, 2026 06:25
Critical fixes: inverted sampleRate in KS test (FitResult), isa(x,'nan')
always-false checks in decoding (DecodingAlgorithms), symvar alphabetical
reordering breaking CIF argument order, ExplambdaDeltaCubed using ld^2
instead of ld^3, findPeaks('minima') returning maxima (SignalObj), handle
aliasing in arithmetic operators (SignalObj), burst detection off-by-one
(nspikeTrain), sOBj/crosscor typos (SignalObj).

Also: 22 eval->feval conversions, 11 silent catch->named exception,
7 roundn->round (removes Mapping Toolbox dep), log(0) guards,
div-by-zero guards, floating-point index fixes, fitType validation.

All changes tagged with inline '% FIX:' comments. See AUDIT_REPORT.md
for full details.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Documents the 67 bug fixes applied across 8 core files during the
2026-03-10 codebase audit, with links to the full AUDIT_REPORT.md.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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