Skip to content

Commit 2ee602f

Browse files
authored
Merge pull request #870 from jmrenouard/master
V2.8.20
2 parents 0b4d8ae + 64419c3 commit 2ee602f

File tree

1,109 files changed

+5797
-8751
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,109 files changed

+5797
-8751
lines changed

.agent/rules/00_constitution.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
# **AI CONTEXT SPECIFICATIONS & PROJECT CONSTITUTION**
6+
7+
$$SYSTEM\_CRITICAL$$
8+
Notice to the Agent: This document constitutes the unique and absolute source of truth for the project. Its prior consultation is imperative before any technical intervention.
9+
10+
Make mysqltuner.pl the best performance tuning advisor
11+
12+
Large insights
13+
Good advices
14+
Well documented solution

.agent/rules/01_objective.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
## **2\. 🎯 OPERATIONAL OBJECTIVE**
2+
3+
$$DYNAMIC\_CONTEXT$$
4+
5+
* **Status:** \[IN PROGRESS\]
6+
* **Priority Task:** Maintain and enhance `mysqltuner.pl`, a Perl script for MySQL/MariaDB database performance tuning. Ensure single-file architecture and high reliability through automated testing.
7+
8+
**Success Criteria:**
9+
10+
1. **Architecture:** No splitting of the main file; all logic resides in `mysqltuner.pl`.
11+
2. **Quality:** 100% of new features validated through TDD.
12+
3. **Docs:** Keep `README.md` and translations updated with new features and requirements.
13+
4. **Automation:** All tests runnable via `make test-*` or specific test scripts.
14+
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/02_architecture.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
## **3\. 🏗️ TECHNICAL ENVIRONMENT & ARCHITECTURE**
6+
7+
$$IMMUTABLE$$
8+
Component Map:
9+
Modification prohibited without explicit request.
10+
11+
| File/Folder | Functionality | Criticality |
12+
| :--- | :--- | :--- |
13+
| mysqltuner.pl | **Main script - SINGLE FILE ARCHITECTURE ENFORCED** | 🔴 CRITICAL |
14+
| Makefile | Command orchestrator (Test, Build, Lint) | LOW |
15+
| Dockerfile | Containerized execution environment | 🟡 MEDIUM |
16+
| .agent/ | Agent-specific rules and workflows | LOW |
17+
| documentation/ | Technical documentation and reports | 🟡 HIGH |
18+
| tests/ | Test suite for validator and tuning logic | 🟡 HIGH |
19+
20+
**Technology Stack:**
21+
22+
* **Language:** Perl (Core script)
23+
* **Testing:** Perl (prove, Test::More)
24+
* **Automation:** Makefile, Bash, Docker, Python, Per
25+
* **DBMS Compatibility:** MySQL, MariaDB, Percona, AWS, AWS Aurora, Docker, GCP, Azure

.agent/rules/03_execution_rules.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
## **4\. ⚙️ EXECUTION RULES & CONSTRAINTS**
6+
7+
### **4.1. Formal Prohibitions (Hard Constraints)**
8+
9+
1. **SINGLE FILE:** Spliting `mysqltuner.pl` into modules is **strictly prohibited**.
10+
2. **NON-REGRESSION:** Deleting existing code is **prohibited** without relocation or commenting out.
11+
3. **NO BACKWARDS COMPATIBILITY BY DEFAULT:** Do not add backwards compatibility unless specifically requested; update all downstream consumers.
12+
4. **OPERATIONAL SILENCE:** Textual explanations/pedagogy are **proscribed** in the response. Only code blocks, commands, and technical results.
13+
5. **TDD MANDATORY:** Use a TDD approach. _Do not assume_ that your solution is correct. Instead, _validate your solution is correct_ by first creating a test case and running the test case to _prove_ the solution is working as intended.
14+
6. **WEB SEARCH:** Assume your world knowledge is out of date. Use your web search tool to find up-to-date docs and information.
15+
16+
### **4.2. Coding Guidelines**
17+
18+
- **SOLID Principles**: Follow Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion principles.
19+
- **DRY (Don't Repeat Yourself)**: Avoid code duplication; extract common logic into reusable functions within the single file.
20+
- **KISS (Keep It Simple, Stupid)**: Strive for simplicity. Avoid over-engineering.
21+
- **Clean Code**: Write readable, self-documenting code with meaningful names and small functions.
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.
33+
34+
### **4.3. Output & Restitution Format**
35+
36+
1. **NO CHATTER:** No intro or conclusion sentences.
37+
2. **CODE ONLY:** Use Search_block / replace_block format for files > 50 lines.
38+
3. **MANDATORY PROSPECTIVE:** Each intervention must conclude with **3 technical evolution paths** to improve robustness/performance.
39+
4. **MEMORY UPDATE:** Include the JSON MEMORY_UPDATE_PROTOCOL block at the very end.
40+
41+
### **4.4. Development Workflow**
42+
43+
1. **Validation by Proof:** All changes must be verifiable via `make test-*` or dedicated test scripts.
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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
## **5\. 📜 STATE MEMORY & HISTORY**
6+
7+
### **Contextual Consistency Protocols**
8+
9+
1. **History Update:** Add new entries to the top of Changelog if the action is correct and tested.
10+
Changelog is a file at root of this projet
11+
insure consistency between CURRENT_VERSION.txt
12+
MySQLtuner version inside mysqltuner.pl (begin of script this script and begin of pod doc =pod)
13+
Changelog last version
14+
15+
2. **Git Sync:** Consult git log \-n 15 to synchronize context.
16+
3. **Rotation:** FIFO Rotation (Max 600 lines). Remove oldest entries beyond 600 lines.
17+
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.
21+
22+
### **History Entry example**
23+
24+
1.0.9 2026-01-16
25+
26+
- chore: migrate HISTORY.md into Changelog and remove HISTORY.md.

.agent/rules/autolearning.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
trigger: always_on
3+
---
4+
5+
If new rules are invoqued with REMEMBER: in conversation
6+
Update this file with RULE: xxxx in .agent/rules/autolearning.md with this information under
7+
REMEMBER
8+
9+
REMENBER:
10+
Rule: Don't forget to updates this file with REMEMBER: tag

.agent/workflows/doc-sync.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
description: doc-sync
3+
---
4+
5+
# Doc Sync
6+
7+
You are a specialized agent for synchronizing documentation with code.
8+
9+
## When to use this workflow
10+
11+
- When the user types `/doc-sync`.
12+
- When they ask to update the documentation after code changes.
13+
14+
## Context
15+
16+
- The project uses Markdown documentation in the root folder.
17+
- List of documentation files:
18+
- [mariadb_support.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/mariadb_support.md)
19+
- [mysql_support.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/mysql_support.md)
20+
- [README.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/README.md)
21+
- [README.fr.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/README.fr.md)
22+
- [README.it.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/README.it.md)
23+
- [README.ru.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/README.ru.md)
24+
- [ROADMAP.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/ROADMAP.md)
25+
- [CONTRIBUTING.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/CONTRIBUTING.md)
26+
- [FEATURES.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/FEATURES.md)
27+
- [USAGE.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/USAGE.md)
28+
- [INTERNALS.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/INTERNALS.md)
29+
- [CODE_OF_CONDUCT.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/CODE_OF_CONDUCT.md)
30+
- [SECURITY.md](file:///home/jmren/GIT_REPOS/MySQLTuner-perl/SECURITY.md)
31+
32+
## Task
33+
34+
1. Identify recently modified files (via git diff or IDE history).
35+
2. For each file, spot public functions / classes.
36+
3. Update the corresponding sections in the relevant documentation files or `README.md`.
37+
4. Propose a clear diff and wait for validation before writing.
38+
39+
## Constraints
40+
41+
- Never delete documentation sections without explicit confirmation.
42+
- Respect the existing style (headings, lists, examples).
43+
- If information is uncertain, ask a question instead of making it up.
44+
- **IMPORTANT**: If new documentation files (`*.md`) are added to the repository, you MUST update this list in `doc-sync.md`.

.agent/workflows/git-flow.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
---
2+
description: Automate git-flow release process
3+
---
4+
5+
1. **Ensure clean working tree and Pre-flight Consistency Check**
6+
- Verify that `Changelog`, `CURRENT_VERSION.txt`, and `mysqltuner.pl` are synchronized.
7+
8+
```bash
9+
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."
27+
```
28+
29+
// turbo
30+
2. **Commit Current Changes**
31+
- Commit all pending changes including `Changelog` updates for the current version.
32+
33+
```bash
34+
git add .
35+
git commit -m "feat: release $CURRENT_VER"
36+
```
37+
38+
// turbo
39+
3. **Create Tag for Current Version with Changelog content**
40+
- Extract the latest release notes and create an annotated tag.
41+
42+
```bash
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"
46+
```
47+
48+
// turbo
49+
4. **Push Branch and Tag**
50+
- Push to the remote repository.
51+
52+
```bash
53+
git push origin main
54+
git push origin v$CURRENT_VER
55+
```
56+
57+
// turbo
58+
5. **Post-Push: Increment Version for Next Cycle**
59+
- Calculate the next patch version and update files.
60+
61+
```bash
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
68+
```
69+
70+
// turbo
71+
6. **Commit Version Bump**
72+
- Commit the incremented version for the next development cycle.
73+
74+
```bash
75+
git add CURRENT_VERSION.txt mysqltuner.pl Changelog
76+
git commit -m "chore: bump version to $NEW_VER"
77+
git push origin main
78+
```
79+
80+
// 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.

.agent/workflows/test-it.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
description: Run MySQLTuner tests against multiple database configurations
3+
---
4+
5+
# 🧪 Run Multi-DB Tests
6+
7+
This workflow automates the execution of `mysqltuner.pl` against various database versions using Docker environments.
8+
9+
## Prerequisite
10+
11+
- Docker and Docker Compose installed
12+
- `make` installed
13+
- https://github.com/jmrenouard/multi-db-docker-env
14+
- https://github.com/jmrenouard/test_db
15+
16+
## Steps
17+
18+
1. **Run the test script**
19+
// turbo
20+
21+
```bash
22+
bash build/test_envs.sh mysql84 mariadb1011
23+
```
24+
25+
> [!NOTE]
26+
> You can pass specific configurations as arguments to the script.
27+
> Example: `bash build/test_envs.sh mysql57 mariadb106 percona80`
28+
29+
1. **Check the results**
30+
The reports are generated in the `examples/` directory, organized by date and configuration name.
31+
32+
- `report.txt`: Summary of the test run.
33+
- `mysqltuner_output.txt`: Full output from MySQLTuner.
34+
- `execution.log`: Standard output/error from the run.
35+
36+
1. **Cleanup**
37+
The script automatically stops the containers, but you can manually ensure everything is clean:
38+
39+
```bash
40+
cd vendor/multi-db-docker-env && make stop
41+
```

0 commit comments

Comments
 (0)