Skip to content

Add CI workflows, linting configuration, and code quality improvements - #64

Open
corylanou wants to merge 4 commits into
mainfrom
pr-63-clean
Open

Add CI workflows, linting configuration, and code quality improvements#64
corylanou wants to merge 4 commits into
mainfrom
pr-63-clean

Conversation

@corylanou

@corylanou corylanou commented Aug 5, 2025

Copy link
Copy Markdown
Collaborator

Summary

This PR adds comprehensive CI/CD infrastructure, linting configuration, and various code quality improvements to the LTX project.

Changes Made

CI/CD Infrastructure

  • Added GitHub Actions workflows:
    • test-and-lint.yml: Runs tests across Go 1.22, 1.23, 1.24, executes linters (go fmt, go vet, staticcheck, revive), and builds the project
    • race-detection.yml: Prepared for future race condition testing (currently disabled)
  • Added .revive.toml: Comprehensive linting configuration with appropriate rules for the project

Code Quality Improvements

  • Fixed all linter warnings across the codebase:
    • Added missing package documentation comments
    • Fixed receiver naming consistency
    • Removed unused parameters and return values
    • Improved error handling patterns
    • Fixed variable naming (e.g., SQLITE_DATABASE_HEADER_STRINGsqliteDatabaseHeaderString)
    • Added missing JSON marshaling documentation
    • Fixed type assertion safety checks
    • Replaced deprecated math/rand.Read with crypto/rand.Read in tests
    • Renamed variables to avoid shadowing built-in functions (min/max → minTXID/maxTXID)

Documentation Updates

  • Enhanced README.md:
    • Improved formatting with proper markdown headers
    • Added detailed checksum design documentation explaining database vs file checksums
    • Clarified security considerations for page index inclusion in file checksums
    • Fixed header layout table to show accurate field offsets and sizes

Build Configuration

  • Updated .gitignore: Added Go binary exclusions (cmd/ltx/ltx, ltx)

File Changes Summary

  • CI/CD: Added 2 new GitHub Actions workflows (123 lines)
  • Linting: Added .revive.toml configuration (56 lines)
  • Code fixes: Updated 16 Go files to address linter warnings (including test files)
  • Documentation: Enhanced README with checksum design section

Test Plan

  • All tests pass across Go 1.22, 1.23, 1.24
  • No linting issues (go fmt, go vet, staticcheck, revive)
  • Builds successfully

🤖 Generated with Claude Code

corylanou and others added 4 commits August 5, 2025 17:08
- Added GitHub Actions workflows for testing and linting
- Added revive linting configuration
- Fixed all linter warnings across the codebase
- Enhanced README with checksum design documentation
- Added comprehensive test for page index checksum validation
- Updated .gitignore with Go binary exclusions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This test was already merged in PR #61 and should not be included
in this CI/linting PR.
- Replace deprecated math/rand.Read with crypto/rand.Read
- Rename min/max variables to minTXID/maxTXID to avoid shadowing built-ins

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Clarify flag field references new flags section
- Add details about when WAL fields are zero
- Improve salt field descriptions for journal/compacted cases
- Clarify node ID field behavior when unset
- Add Header flags section documenting LZ4 compression flag

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@corylanou

Copy link
Copy Markdown
Collaborator Author

Assessed this while clearing the backlog. The tooling in here is worth having, but the PR as a whole has gone stale enough that rebasing it is probably the wrong move.

Every core file it touches was rewritten last week.

File Last changed on main
checksum.go #89 — exclude lock page, close files
cmd/ltx/apply.go #91 — honor checksum-free files
cmd/ltx/encode_db.go #90 — write valid snapshots safely
ltx.go #92 — format documentation
README.md #92 — format documentation

This branch dates from Aug 2025 and its code changes predate all of that, plus the LZ4 block-format switch in #73. GitHub already reports it CONFLICTING/DIRTY. Reconciling 18 files of year-old changes against work that just landed is a lot of risk for changes whose value has largely been overtaken.

The CI and lint config is the part still worth taking, and it's cleanly separable — .github/workflows/test-and-lint.yml, .github/workflows/race-detection.yml, and .revive.toml are all new files with no conflicts. That's also the highest-value part: #81 and #82 shipped broken through three releases precisely because there were no tests under cmd/ltx and no lint gate. Those exist now, but nothing enforces coverage of new commands.

Suggested split: open a fresh PR carrying just the workflow files and .revive.toml, and close this one. That gets the tooling in within a day instead of a rebase slog, and lets the code changes be re-evaluated on their own merits against current main rather than smuggled in behind a CI change.

Two things to fix in the config before it lands.

The Go matrix here is ['1.22', '1.23', '1.24']. #78 raises the module floor to 1.26 because crypto/hpke does not exist before then, so that matrix and #78 cannot both be right. Even without #78, main is on 1.24 today, so testing 1.22 and 1.23 tests configurations the module already declares unsupported.

The .gitignore addition covers cmd/ltx/ltx and ltx but not dist/, which is the one that actually bites — see #93. dist/ltx is a committed binary and dist/ is where both the documented release build and the E2E script write, so it gets dirtied routinely. Worth folding that in.

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.

2 participants