Skip to content

Commit 4d82060

Browse files
committed
feat: release 2.8.20
1 parent 0506973 commit 4d82060

9 files changed

Lines changed: 184 additions & 35 deletions

File tree

.agent/rules/01_objective.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,12 @@ $$DYNAMIC\_CONTEXT$$
1212
3. **Docs:** Keep `README.md` and translations updated with new features and requirements.
1313
4. **Automation:** All tests runnable via `make test-*` or specific test scripts.
1414
5. **Goal:** Provide the most accurate and up-to-date performance tuning recommendations for MySQL-compatible databases.
15+
16+
**Roadmap / Evolution Paths:**
17+
18+
1. **Schema Validation for Rules**: Créer un script de linting pour valider que les fichiers `.agent/rules/*.md` respectent un format standard.
19+
2. **Source Code Annotation**: Automatiser l'ajout des tags de version directement dans les commentaires des fonctions modifiées.
20+
3. **Automated Doc-Link Check**: Ajouter un test qui vérifie que les liens de documentation insérés dans les commentaires du code (`# See: http://...`) sont toujours valides.
21+
4. **Pre-commit Hook**: Implementer un hook Git local qui lance le pre-flight check de `/git-flow`.
22+
5. **Automated Roadmap Tracking**: Créer un script qui extrait les points de la roadmap pour générer un rapport de progression.
23+
6. **Perl Tidy Integration**: Ajouter une règle exigeant l'utilisation de `perltidy` avec une configuration spécifique pour garantir la lisibilité du fichier unique.

.agent/rules/03_execution_rules.md

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,17 @@ trigger: always_on
1919
- **DRY (Don't Repeat Yourself)**: Avoid code duplication; extract common logic into reusable functions within the single file.
2020
- **KISS (Keep It Simple, Stupid)**: Strive for simplicity. Avoid over-engineering.
2121
- **Clean Code**: Write readable, self-documenting code with meaningful names and small functions.
22-
- **Error Handling**: Implement robust error handling and logging. Use low-cardinality logging with stable message strings (e.g., `logger.info{id, foo}, 'Msg'`).
22+
- **Perl Tidy**: Use `perltidy` with the project's specific configuration to ensure consistent formatting across the single-file architecture.
23+
- **Error Handling**: Implement robust error handling and logging. Use low-cardinality logging with stable message strings.
24+
25+
#### **Core Best Practices:**
26+
27+
1. **Validation Multi-Version Systématique**: Tout changement dans la logique de diagnostic doit être testé contre au moins une version "Legacy" (ex: MySQL 5.7) et une version "Moderne" (ex: MariaDB 11.4) via la suite de tests Docker (`make test-it`).
28+
2. **Résilience des Appels Système**: Chaque commande externe (`sysctl`, `ps`, `free`, `mysql`) doit impérativement être protégée par une vérification de l'existence du binaire et une gestion d'erreur (exit code non nul) pour éviter les sorties "polluées" dans le rapport final.
29+
3. **Politique "Zéro-Dépendance" CPAN**: Interdire l'usage de modules Perl qui ne font pas partie du "Core" (distribution standard Perl) afin que `mysqltuner.pl` reste un script unique, copiable et exécutable instantanément sur n'importe quel serveur sans installation préalable.
30+
4. **Traçabilité des Conseils (Audit Trail)**: Chaque recommandation ou conseil affiché par le script doit être documenté dans le code par un commentaire pointant vers la source officielle (Documentation MySQL/MariaDB ou KB) pour justifier le seuil choisi.
31+
5. **Efficience Mémoire (Parsing de Log)**: Pour le traitement des fichiers de logs (souvent volumineux), privilégier systématiquement le traitement ligne par ligne plutôt que le chargement complet en mémoire, surtout lors de la récupération via `--container`.
32+
6. **Standardisation @Changelog**: Maintenir le `@Changelog` en suivant strictement le format des _Conventional Commits_ (feat, fix, chore, docs) pour permettre une extraction automatisée et propre des notes de version lors des tags Git.
2333

2434
### **4.3. Output & Restitution Format**
2535

@@ -31,11 +41,12 @@ trigger: always_on
3141
### **4.4. Development Workflow**
3242

3343
1. **Validation by Proof:** All changes must be verifiable via `make test-*` or dedicated test scripts.
34-
2. **Git Protocol:**.
35-
/!\ NOT COMMIT, NO TAG CODE UNLESS USING /git-flow or explicit order
36-
Use **Conventional Commits** (feat:, fix:, chore:, docs:).
37-
WARNING: Don't increment version in changelog or script if code is not tagged and pushed
38-
If last tag is not remotely present, don't increment version unless explicitly asked
39-
Commit and tag should be done together
40-
41-
3. **Changelog:** All changes MUST be traced and documented inside `@Changelog`.
44+
2. **Git Protocol:**
45+
46+
- **STRICT PROHIBITION:** No `git commit`, `git push`, or `git tag` without using `/git-flow` or an explicit user order.
47+
- **Conventional Commits:** Use `feat:`, `fix:`, `chore:`, `docs:`.
48+
- **Versioning & Tagging:** Reserved ONLY for the `/git-flow` workflow.
49+
- **Atomic Operations:** Commit and tag must be synchronized via the workflow.
50+
- **Remote Sync:** If the last tag is not present on remote, do not increment version without explicit confirmation.
51+
52+
1. **Changelog:** All changes MUST be traced and documented inside `@Changelog`.

.agent/rules/04_memory_protocol.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Changelog last version
1515
2. **Git Sync:** Consult git log \-n 15 to synchronize context.
1616
3. **Rotation:** FIFO Rotation (Max 600 lines). Remove oldest entries beyond 600 lines.
1717

18-
4. All changes must be added to last version
19-
5. No Increment version if explicit git commit/tag/push via /git-flow or specific order from previous version has'nt been made
20-
After Git tag and push, increment version on last digit
18+
4. All changes must be added to last version in `Changelog`.
19+
5. No increment version if explicit git commit/tag/push via `/git-flow` or specific order from previous version hasn't been made.
20+
6. After Git tag and push, increment version on last digit for the next development cycle.
2121

2222
### **History Entry example**
2323

.agent/workflows/git-flow.md

Lines changed: 44 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,79 @@
22
description: Automate git-flow release process
33
---
44

5-
1. **Ensure clean working tree**
5+
1. **Ensure clean working tree and Pre-flight Consistency Check**
6+
- Verify that `Changelog`, `CURRENT_VERSION.txt`, and `mysqltuner.pl` are synchronized.
67

78
```bash
89
git status --porcelain
10+
CURRENT_VER=$(cat CURRENT_VERSION.txt | tr -d '[:space:]')
11+
SCRIPT_VER=$(grep "my \$tunerversion =" mysqltuner.pl | cut -d'"' -f2)
12+
CHANGELOG_VER=$(head -n 1 Changelog | awk '{print $1}')
13+
14+
echo "Checking version consistency: $CURRENT_VER"
15+
16+
if [ "$CURRENT_VER" != "$SCRIPT_VER" ]; then
17+
echo "ERROR: CURRENT_VERSION.txt ($CURRENT_VER) does not match mysqltuner.pl ($SCRIPT_VER)"
18+
exit 1
19+
fi
20+
21+
if [ "$CURRENT_VER" != "$CHANGELOG_VER" ]; then
22+
echo "ERROR: CURRENT_VERSION.txt ($CURRENT_VER) does not match Changelog ($CHANGELOG_VER)"
23+
exit 1
24+
fi
25+
26+
echo "Consistency check passed."
927
```
1028

1129
// turbo
12-
2. **Update version**
13-
- Increment patch version in `CURRENT_VERSION.txt` (e.g., `1.0.9``1.0.10`).
14-
- Update `$tunerversion` variable in `mysqltuner.pl` header.
30+
2. **Commit Current Changes**
31+
- Commit all pending changes including `Changelog` updates for the current version.
1532

1633
```bash
17-
NEW_VER=$(awk -F. '{print $1"."$2"."($3+1)}' CURRENT_VERSION.txt)
18-
echo $NEW_VER > CURRENT_VERSION.txt
19-
sed -i "s/\$tunerversion = .*/\$tunerversion = \"$NEW_VER\";/" mysqltuner.pl
34+
git add .
35+
git commit -m "feat: release $CURRENT_VER"
2036
```
2137

2238
// turbo
23-
3. **Update Changelog**
24-
- Prepend entry with new version and date.
39+
3. **Create Tag for Current Version with Changelog content**
40+
- Extract the latest release notes and create an annotated tag.
2541

2642
```bash
27-
DATE=$(date +%Y-%m-%d)
28-
echo "$NEW_VER $DATE" > tmp_changelog && cat Changelog >> tmp_changelog && mv tmp_changelog Changelog
43+
# Extract content between the first version header and the next one
44+
TAG_MSG=$(awk "/^$CURRENT_VER/,/^([0-9]+\.[0-9]+\.[0-9]+)/ {if (\$0 !~ /^([0-9]+\.[0-9]+\.[0-9]+)/) print}" Changelog | sed '/^$/d')
45+
git tag -a v$CURRENT_VER -m "Release $CURRENT_VER" -m "$TAG_MSG"
2946
```
3047

3148
// turbo
32-
4. **Commit changes**
49+
4. **Push Branch and Tag**
50+
- Push to the remote repository.
3351

3452
```bash
35-
git add CURRENT_VERSION.txt mysqltuner.pl Changelog
36-
git commit -m "feat: release $NEW_VER"
53+
git push origin main
54+
git push origin v$CURRENT_VER
3755
```
3856

3957
// turbo
40-
5. **Create tag**
58+
5. **Post-Push: Increment Version for Next Cycle**
59+
- Calculate the next patch version and update files.
4160

4261
```bash
43-
git tag -a v$NEW_VER -m "Release $NEW_VER"
62+
NEW_VER=$(echo $CURRENT_VER | awk -F. '{print $1"."$2"."($3+1)}')
63+
echo $NEW_VER > CURRENT_VERSION.txt
64+
sed -i "s/my \$tunerversion = .*/my \$tunerversion = \"$NEW_VER\";/" mysqltuner.pl
65+
66+
DATE=$(date +%Y-%m-%d)
67+
echo -e "$NEW_VER $DATE\n\n- \n" > tmp_changelog && cat Changelog >> tmp_changelog && mv tmp_changelog Changelog
4468
```
4569

4670
// turbo
47-
6. **Push branch and tags**
71+
6. **Commit Version Bump**
72+
- Commit the incremented version for the next development cycle.
4873

4974
```bash
75+
git add CURRENT_VERSION.txt mysqltuner.pl Changelog
76+
git commit -m "chore: bump version to $NEW_VER"
5077
git push origin main
51-
git push origin v$NEW_VER
5278
```
5379

5480
// turbo

.agent/workflows/git-rollback.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
description: Rollback a failed release (delete tags and revert commits)
3+
---
4+
5+
1. **Delete Local and Remote Tag**
6+
- Identify the tag to remove from `CURRENT_VERSION.txt`.
7+
8+
```bash
9+
VERSION_TO_ROLLBACK=$(cat CURRENT_VERSION.txt)
10+
echo "Rolling back version v$VERSION_TO_ROLLBACK"
11+
12+
git tag -d v$VERSION_TO_ROLLBACK
13+
git push --delete origin v$VERSION_TO_ROLLBACK
14+
```
15+
16+
// turbo
17+
2. **Revert Release Commits**
18+
- Reset the branch to the state before the release commit.
19+
- **WARNING**: This uses `git reset --hard`. Ensure you don't have uncommitted work you want to keep.
20+
21+
```bash
22+
# Identify the commit before the release commit (assuming the last commit was the version bump)
23+
# We might want to revert the last 2 commits: the bump and the release tag commit.
24+
25+
# Reset to 2 commits ago
26+
git reset --hard HEAD~2
27+
28+
# Force push to clean remote main branch
29+
# git push origin main --force
30+
```
31+
32+
// turbo
33+
3. **Notify User**
34+
- The rollback is completed locally. Remote sync may require a force push.
35+
36+
> [!CAUTION]
37+
> The local branch has been reset. If you had already pushed the version bump, you may need to run `git push origin main --force` to synchronize the remote branch.

CURRENT_VERSION.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.8.19
1+
2.8.20

Changelog

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
2.8.19 2026-01-18
1+
2.8.20 2026-01-18
22

3-
- feat: release 2.8.19
3+
- feat: add automated regression test for forcemem MB interpretation (issues #780, #810)
4+
- chore: bump version to 2.8.20
45

56
2.8.18 2026-01-18
67

mysqltuner.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ package main;
5959
my $is_win = $^O eq 'MSWin32';
6060

6161
# Set up a few variables for use in the script
62-
my $tunerversion = "2.8.19";
62+
my $tunerversion = "2.8.20";
6363
my ( @adjvars, @generalrec );
6464

6565
# Set defaults
@@ -8220,7 +8220,7 @@ sub dump_csv_files {
82208220
82218221
=head1 NAME
82228222
8223-
MySQLTuner 2.8.10 - MySQL High Performance Tuning Script
8223+
MySQLTuner 2.8.20 - MySQL High Performance Tuning Script
82248224
82258225
=head1 IMPORTANT USAGE GUIDELINES
82268226

tests/test_forcemem.t

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
use strict;
2+
use warnings;
3+
use Test::More;
4+
5+
# Mocking variables from mysqltuner.pl
6+
our %opt;
7+
our $physical_memory;
8+
our $swap_memory;
9+
10+
sub infoprint { } # Silence output
11+
sub badprint { }
12+
sub debugprint { }
13+
14+
sub hr_bytes {
15+
my $num = shift;
16+
return "0B" unless defined($num);
17+
if ( $num >= ( 1024**3 ) ) { return sprintf( "%.1f", ( $num / ( 1024**3 ) ) ) . "G"; }
18+
elsif ( $num >= ( 1024**2 ) ) { return sprintf( "%.1f", ( $num / ( 1024**2 ) ) ) . "M"; }
19+
elsif ( $num >= 1024 ) { return sprintf( "%.1f", ( $num / 1024 ) ) . "K"; }
20+
else { return $num . "B"; }
21+
}
22+
23+
sub os_setup_logic {
24+
my ($os, $opt_forcemem, $opt_forceswap) = @_;
25+
26+
# Logic from mysqltuner.pl
27+
if ( $opt_forcemem > 0 ) {
28+
$physical_memory = $opt_forcemem * 1048576;
29+
if ( $opt_forceswap > 0 ) {
30+
$swap_memory = $opt_forceswap * 1048576;
31+
} else {
32+
$swap_memory = 0;
33+
}
34+
} else {
35+
# Mocked system detection
36+
$physical_memory = 2048 * 1048576; # 2GB
37+
$swap_memory = 1024 * 1048576; # 1GB
38+
}
39+
40+
# Regression check for v2.6.1 bug:
41+
# $physical_memory = $opt_forcemem if ($opt_forcemem > 0);
42+
# This line IS DELETED in current version.
43+
44+
return ($physical_memory, $swap_memory);
45+
}
46+
47+
# Test cases
48+
my ($mem, $swap);
49+
50+
# 32GB requested via forcemem
51+
($mem, $swap) = os_setup_logic("Linux", 32768, 0);
52+
is($mem, 34359738368, "32768 MB should be 34359738368 bytes");
53+
is(hr_bytes($mem), "32.0G", "32768 MB should be displayed as 32.0G");
54+
55+
# 1GB requested via forcemem
56+
($mem, $swap) = os_setup_logic("Linux", 1024, 0);
57+
is($mem, 1073741824, "1024 MB should be 1073741824 bytes");
58+
is(hr_bytes($mem), "1.0G", "1024 MB should be displayed as 1.0G");
59+
60+
# 2000 MB requested (issue #780)
61+
($mem, $swap) = os_setup_logic("Linux", 2000, 0);
62+
is($mem, 2097152000, "2000 MB should be 2097152000 bytes");
63+
is(hr_bytes($mem), "2.0G", "2000 MB should be displayed as 2.0G (not 2.0K)");
64+
65+
done_testing();

0 commit comments

Comments
 (0)