sinmonto 0.1.0rc3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sinmonto-0.1.0rc3/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
- sinmonto-0.1.0rc3/.github/ISSUE_TEMPLATE/feature_request.md +25 -0
- sinmonto-0.1.0rc3/.github/pull_request_template.md +25 -0
- sinmonto-0.1.0rc3/.github/workflows/publish.yml +33 -0
- sinmonto-0.1.0rc3/.github/workflows/tests.yml +36 -0
- sinmonto-0.1.0rc3/.gitignore +16 -0
- sinmonto-0.1.0rc3/AGENTS.md +50 -0
- sinmonto-0.1.0rc3/CHANGELOG.md +89 -0
- sinmonto-0.1.0rc3/CLAUDE.md +1 -0
- sinmonto-0.1.0rc3/CONTRIBUTING.md +120 -0
- sinmonto-0.1.0rc3/LICENSE +193 -0
- sinmonto-0.1.0rc3/PKG-INFO +112 -0
- sinmonto-0.1.0rc3/README.md +87 -0
- sinmonto-0.1.0rc3/docs/constitution-finale.md +131 -0
- sinmonto-0.1.0rc3/docs/constitution-noyau.md +407 -0
- sinmonto-0.1.0rc3/docs/contrat-vivant-gabarit.md +97 -0
- sinmonto-0.1.0rc3/docs/journal-integration.md +468 -0
- sinmonto-0.1.0rc3/docs/roadmap-vision.md +49 -0
- sinmonto-0.1.0rc3/examples/end_to_end.py +125 -0
- sinmonto-0.1.0rc3/pyproject.toml +50 -0
- sinmonto-0.1.0rc3/scripts/test_all.sh +18 -0
- sinmonto-0.1.0rc3/sinmonto/__init__.py +96 -0
- sinmonto-0.1.0rc3/sinmonto/_context.py +291 -0
- sinmonto-0.1.0rc3/sinmonto/_core.py +308 -0
- sinmonto-0.1.0rc3/sinmonto/_dsl.py +475 -0
- sinmonto-0.1.0rc3/sinmonto/_engine.py +532 -0
- sinmonto-0.1.0rc3/sinmonto/_exceptions.py +97 -0
- sinmonto-0.1.0rc3/sinmonto/_testing.py +70 -0
- sinmonto-0.1.0rc3/sinmonto/_trace.py +78 -0
- sinmonto-0.1.0rc3/sinmonto/_version.py +12 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Rapport de bug
|
|
3
|
+
about: Signaler un comportement incorrect du moteur
|
|
4
|
+
title: "[bug] "
|
|
5
|
+
labels: bug
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Comportement attendu
|
|
9
|
+
|
|
10
|
+
## Comportement observé
|
|
11
|
+
|
|
12
|
+
## Reproduire
|
|
13
|
+
|
|
14
|
+
```python
|
|
15
|
+
# le plus petit exemple possible qui démontre le problème
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Environnement
|
|
19
|
+
- Version de `sinmonto` (`sinmonto.__version__`) :
|
|
20
|
+
- Python (`python3 --version`) :
|
|
21
|
+
- OS / environnement (Termux, Linux, macOS...) :
|
|
22
|
+
|
|
23
|
+
## Sortie du mini-runner (si pertinent)
|
|
24
|
+
Colle ici la sortie de `python3 -m sinmonto._<module>` ou de la trace
|
|
25
|
+
d'erreur complète.
|
|
26
|
+
|
|
27
|
+
## Note
|
|
28
|
+
Preview `0.x` : certaines limitations sont **volontaires**, pas des bugs —
|
|
29
|
+
signaux dérivés non traités, `duration_ms` à zéro, etc. Vérifie la section
|
|
30
|
+
« Limitations connues » du [`README.md`](../README.md) avant d'ouvrir.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Demande de fonctionnalité
|
|
3
|
+
about: Proposer une évolution
|
|
4
|
+
title: "[feat] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## Le problème ou le besoin
|
|
9
|
+
Quel cas d'usage manque aujourd'hui (fintech, fraude, IoT, e-commerce...) ?
|
|
10
|
+
|
|
11
|
+
## Solution proposée
|
|
12
|
+
Décris ce que tu aimerais voir, de préférence en termes d'API ou de
|
|
13
|
+
comportement observable.
|
|
14
|
+
|
|
15
|
+
## Le filtre v1.0
|
|
16
|
+
Est-ce que ça rapproche réellement la v1.0, ou est-ce un besoin qui peut
|
|
17
|
+
attendre ? (Si c'est la seconde réponse, ce n'est pas un problème — ça a
|
|
18
|
+
sa place dans `docs/roadmap-vision.md` plutôt que dans le code immédiat.)
|
|
19
|
+
|
|
20
|
+
## Alignement avec la constitution
|
|
21
|
+
- [ ] Cette proposition respecte les 10 décisions verrouillées (`docs/constitution-finale.md` §2)
|
|
22
|
+
- [ ] Elle n'ajoute aucune dépendance externe au noyau
|
|
23
|
+
- [ ] Elle reste explicable (traçable dans `ConditionTrace`/`DecisionTrace`)
|
|
24
|
+
|
|
25
|
+
## Alternatives envisagées
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
## Résumé
|
|
2
|
+
Décris en quelques lignes ce que fait cette PR. `Closes #...` si applicable.
|
|
3
|
+
|
|
4
|
+
## Type de changement
|
|
5
|
+
- [ ] Correction de bug
|
|
6
|
+
- [ ] Documentation uniquement
|
|
7
|
+
- [ ] Comportement / API (décrire l'impact ci-dessous)
|
|
8
|
+
- [ ] Scaffolding / outillage
|
|
9
|
+
|
|
10
|
+
## Checklist
|
|
11
|
+
- [ ] J'ai lu `docs/constitution-finale.md` §2 et cette PR ne contredit
|
|
12
|
+
aucune des 10 décisions verrouillées.
|
|
13
|
+
- [ ] Tests concernés lancés localement (`python3 -m sinmonto._...`, voir
|
|
14
|
+
`CONTRIBUTING.md`), tous verts.
|
|
15
|
+
- [ ] `python3 examples/end_to_end.py` passe.
|
|
16
|
+
- [ ] Aucun import direct hors `from sinmonto import ...` (surface
|
|
17
|
+
`sinmonto.__all__` uniquement).
|
|
18
|
+
- [ ] Doc mise à jour si le comportement observable change (`README.md`,
|
|
19
|
+
`CHANGELOG.md`, ou `docs/`).
|
|
20
|
+
|
|
21
|
+
## Impact sur la surface publique
|
|
22
|
+
- [ ] Aucun changement de contrat public
|
|
23
|
+
- [ ] Changement de contrat public — expliqué ci-dessous
|
|
24
|
+
|
|
25
|
+
## Notes pour la revue
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
name: publish to PyPI
|
|
2
|
+
|
|
3
|
+
# Déclenchement manuel uniquement (bouton "Run workflow") -- une publication
|
|
4
|
+
# PyPI ne peut pas être annulée une fois faite, mieux vaut un geste explicite
|
|
5
|
+
# à chaque fois plutôt qu'un déclenchement automatique sur un push ou un tag.
|
|
6
|
+
on:
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
publish:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- uses: actions/checkout@v4
|
|
14
|
+
|
|
15
|
+
- name: Set up Python
|
|
16
|
+
uses: actions/setup-python@v5
|
|
17
|
+
with:
|
|
18
|
+
python-version: "3.12"
|
|
19
|
+
|
|
20
|
+
- name: Install build tools
|
|
21
|
+
run: pip install build twine
|
|
22
|
+
|
|
23
|
+
- name: Build sdist + wheel
|
|
24
|
+
run: python -m build
|
|
25
|
+
|
|
26
|
+
- name: Check artifacts before upload
|
|
27
|
+
run: twine check dist/*
|
|
28
|
+
|
|
29
|
+
- name: Publish to PyPI
|
|
30
|
+
env:
|
|
31
|
+
TWINE_USERNAME: __token__
|
|
32
|
+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
33
|
+
run: twine upload dist/*
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: tests
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
fail-fast: false
|
|
14
|
+
matrix:
|
|
15
|
+
python-version: ["3.11", "3.12", "3.13"]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
21
|
+
uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Module tests
|
|
26
|
+
run: |
|
|
27
|
+
python3 -m sinmonto._exceptions
|
|
28
|
+
python3 -m sinmonto._core
|
|
29
|
+
python3 -m sinmonto._trace
|
|
30
|
+
python3 -m sinmonto._testing
|
|
31
|
+
python3 -m sinmonto._context
|
|
32
|
+
python3 -m sinmonto._dsl
|
|
33
|
+
python3 -m sinmonto._engine
|
|
34
|
+
|
|
35
|
+
- name: End-to-end example
|
|
36
|
+
run: python3 examples/end_to_end.py
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Instructions pour toute IA (Claude Code, Cursor, Copilot, ou autre) travaillant sur ce dépôt. Lis ceci avant de toucher au code.
|
|
4
|
+
|
|
5
|
+
## Ce projet en une phrase
|
|
6
|
+
|
|
7
|
+
`sinmonto` — moteur de décision événementiel, explicable, en Python pur, zéro dépendance. Voir `README.md` pour l'usage, `docs/constitution-finale.md` et `docs/constitution-noyau.md` pour l'architecture complète.
|
|
8
|
+
|
|
9
|
+
## Règles non négociables
|
|
10
|
+
|
|
11
|
+
Ne propose jamais d'architecture alternative aux 10 décisions ci-dessous. Ne les redébats pas. Si une impossibilité technique apparaît en implémentant réellement (pas en théorie), signale-la explicitement — ne la contourne pas en silence, ne modifie pas la spec toi-même pour l'éviter.
|
|
12
|
+
|
|
13
|
+
1. Pas de réseau Rete complet — indexation alpha légère uniquement (par nom de champ).
|
|
14
|
+
2. `Context` mutable pendant un cycle, figé en `FrozenContext` immuable à la fin (`commit()`) — jamais d'immuabilité totale à la façon persistante.
|
|
15
|
+
3. `Signal` (déclencheur, porte `entity_id`) et `Fact` (information) sont deux types distincts.
|
|
16
|
+
4. Effects-as-data : aucune règle n'exécute d'effet de bord. Elle retourne des `Effect` décrits ; un exécuteur séparé les applique.
|
|
17
|
+
5. Explicabilité native : chaque condition, vraie ou fausse, doit être traçable via l'arbre `ConditionTrace`.
|
|
18
|
+
6. Pas de durabilité multi-jours dans le cœur. `ContextStore`/`FactStore` abstraits, implémentations en mémoire par défaut.
|
|
19
|
+
7. Temps injecté (`Clock`), jamais `time.time()` dans le moteur.
|
|
20
|
+
8. `engine.compile()` verrouille la configuration ; aucune règle ajoutée après sans lever `EngineAlreadyCompiledError`.
|
|
21
|
+
9. `__slots__` sur les objets internes chauds — jamais sur le `payload` utilisateur (reste un `dict` libre, exposé en lecture seule via `MappingProxyType`).
|
|
22
|
+
10. Protocole `Evaluable` commun, classes distinctes (`Rule`, futures `Transition`) qui l'implémentent — pas de type générique fourre-tout.
|
|
23
|
+
|
|
24
|
+
## Conventions de nommage et de fichiers
|
|
25
|
+
|
|
26
|
+
- Tous les fichiers internes sont préfixés `_` (`_core.py`, `_engine.py`...), sans exception. Seul `__init__.py` est un chemin d'import public garanti — voir `docs/constitution-finale.md` §8.
|
|
27
|
+
- Les 37 noms de `sinmonto.__all__` sont le contrat public stable (`from sinmonto import <nom>`). Ne jamais documenter ni recommander un import qualifié par module (`sinmonto._core.Fact`). (Avant 2026-08, cette ligne disait « seul `sinmonto.Symbole` » — un placeholder jamais rempli, corrigé en revue croisée.)
|
|
28
|
+
- PEP8 strict. Verbes pour les actions (`evaluate`, `compile`, `commit`), noms pour les objets.
|
|
29
|
+
|
|
30
|
+
## Tests
|
|
31
|
+
|
|
32
|
+
Chaque module a son propre bloc `if __name__ == "__main__":` en bas de fichier, zéro dépendance de test (`_testing.py`, mini-runner interne). Pour tester un module isolément :
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
python3 -m sinmonto._core # depuis le dossier PARENT de sinmonto/
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Les imports internes sont relatifs (`from ._core import Fact`) — un module ne peut donc pas s'exécuter avec `python3 _core.py` en direct, seulement via `-m`.
|
|
39
|
+
|
|
40
|
+
## État actuel (v0.1.0rc2 — preview technique)
|
|
41
|
+
|
|
42
|
+
Fait et testé de bout en bout (41 tests, modules + intégration) : objets fondamentaux, contexte à deux phases avec persistance (`ContextStore`), trace d'explication en arbre, DSL avec opérateurs, moteur avec indexation alpha, tie-breaking déterministe, gestion d'erreur (`continue`/`fail_fast`/`fail_loud`).
|
|
43
|
+
|
|
44
|
+
Corrigé en revue croisée multi-IA (2026-08) — voir `docs/journal-integration.md` : atomicité réelle des règles (snapshot/restore de `ctx`, y compris mutation directe), copie profonde du contexte, validation `Signal.entity_id`/opérateurs de condition/kind composite/retours d'action, copie défensive de `Fact._payload`, `causality` chaînée, code de sortie non nul du mini-runner sur échec.
|
|
45
|
+
|
|
46
|
+
Pas encore fait, ne pas assumer que c'est câblé : file d'attente des signaux dérivés (`max_derived_depth`), mesure réelle de `duration_ms`, aplatissement des AND chaînés dans la trace. Voir `docs/roadmap-vision.md` et `docs/journal-integration.md` pour le détail et l'historique complet des décisions.
|
|
47
|
+
|
|
48
|
+
## Processus
|
|
49
|
+
|
|
50
|
+
Toute évolution architecturale (pas une simple implémentation) passe par `docs/contrat-vivant-gabarit.md` — mission écrite, rapport structuré en retour, synthèse avant verrouillage. Ne pas modifier `docs/constitution-finale.md` unilatéralement.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
Toutes les modifications notables de ce projet sont documentées dans ce fichier.
|
|
4
|
+
Le format est basé sur [Keep a Changelog](https://keepachangelog.com/fr/1.1.0/),
|
|
5
|
+
et ce projet adhère au [Semantic Versioning](https://semver.org/lang/fr/)
|
|
6
|
+
(les versions `0.x.y` sont instables par convention — l'API n'est pas encore figée).
|
|
7
|
+
|
|
8
|
+
L'historique détaillé — comment chaque bug a été trouvé et corrigé, y compris
|
|
9
|
+
les fausses pistes — vit dans [`docs/journal-integration.md`](docs/journal-integration.md).
|
|
10
|
+
Ce fichier-ci reste volontairement lisible en quelques minutes.
|
|
11
|
+
|
|
12
|
+
## [Unreleased]
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
- Racine du dépôt allégée : les documents de gouvernance (constitutions, journal
|
|
16
|
+
d'intégration, roadmap, contrat vivant) déplacés vers `docs/`. Aucun changement
|
|
17
|
+
fonctionnel du noyau.
|
|
18
|
+
|
|
19
|
+
## [0.1.0rc3] - 2026-08-07
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- `Fact.payload` / `Effect.payload` : copie **profonde** (`copy.deepcopy`) au lieu
|
|
23
|
+
d'une copie superficielle — une valeur imbriquée (liste, dict) mutée après
|
|
24
|
+
construction ne pouvait plus corrompre l'objet, mais restait encore accessible
|
|
25
|
+
en mutation directe à travers le proxy. `Effect.payload` n'avait auparavant
|
|
26
|
+
aucune protection du tout.
|
|
27
|
+
- Packaging : `CLAUDE.md` (symlink vers `AGENTS.md`) correctement préservé lors
|
|
28
|
+
de la création d'archives (`zip -y`).
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
- La garantie de déterminisme bit-à-bit (mêmes entrées ⇒ même sortie) exclut
|
|
32
|
+
désormais explicitement `DecisionTrace.trace_id` (UUID généré à chaque
|
|
33
|
+
évaluation, non reproductible par construction).
|
|
34
|
+
|
|
35
|
+
## [0.1.0rc2] - 2026-08-07
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
- Atomicité réelle des règles : snapshot de `ctx._values` avant chaque
|
|
39
|
+
`rule.evaluate()`, restauré si la règle lève une exception — une mutation
|
|
40
|
+
directe via `ctx.set()` ne survit plus à un crash.
|
|
41
|
+
- Validation `Signal.entity_id` contre `fact.entity_id` (`ValueError` explicite
|
|
42
|
+
si les deux sont fournis et diffèrent).
|
|
43
|
+
- Validation à la construction des opérateurs `FieldCondition` et des `kind`
|
|
44
|
+
de `CompositeCondition` (`InvalidConditionError` immédiate).
|
|
45
|
+
- `InvalidEffectError` sur un retour d'action non reconnu, ou un retour direct
|
|
46
|
+
d'`EvaluationResult` (désormais interdit — pouvait écraser la trace déjà
|
|
47
|
+
calculée par la règle).
|
|
48
|
+
- Copie défensive de `Fact._payload` à la construction.
|
|
49
|
+
- `causality` chaînée : `(fact.fact_id, *fact.causality)` pour un fait,
|
|
50
|
+
`(signal.signal_id,)` pour un timer (au lieu de vide).
|
|
51
|
+
- Code de sortie non nul du mini-runner de tests (`_testing.py`) en cas
|
|
52
|
+
d'échec — exploitable en CI.
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
- Copie profonde du contexte à `commit()` et au rechargement d'un
|
|
56
|
+
`FrozenContext` existant — un objet imbriqué muté après coup ne corrompt
|
|
57
|
+
plus rétroactivement un état déjà figé.
|
|
58
|
+
- `InMemoryFactStore(max_facts=0)` lève un `ValueError` clair au lieu d'un
|
|
59
|
+
`IndexError` obscur.
|
|
60
|
+
|
|
61
|
+
### Changed
|
|
62
|
+
- Contrat public clarifié : les 37 noms de `sinmonto.__all__` sont la
|
|
63
|
+
surface stable, remplaçant un placeholder de documentation ("Symbole")
|
|
64
|
+
jamais réellement implémenté.
|
|
65
|
+
- Version, licence (Apache-2.0) et nom du package verrouillés de façon
|
|
66
|
+
cohérente dans tous les fichiers de gouvernance.
|
|
67
|
+
|
|
68
|
+
## [0.1.0-rc1] - 2026-08-04
|
|
69
|
+
|
|
70
|
+
### Added
|
|
71
|
+
- Première version assemblée et testée de bout en bout du noyau `sinmonto`.
|
|
72
|
+
- Objets fondamentaux : `Fact`, `Signal`, `Effect`, `Decision`, `EvaluationResult`,
|
|
73
|
+
horloge injectée (`Clock` / `ManualClock`).
|
|
74
|
+
- Contexte à deux phases (`EvaluationContext` mutable → `FrozenContext` immuable
|
|
75
|
+
via `commit()`), avec persistance par entité (`ContextStore` /
|
|
76
|
+
`InMemoryContextStore`).
|
|
77
|
+
- DSL de conditions (`Field`, opérateurs, compositions AND/OR/NOT) et
|
|
78
|
+
décorateur `@rule`.
|
|
79
|
+
- Moteur (`DecisionEngine`) : indexation alpha légère, `compile()` /
|
|
80
|
+
`evaluate()`, politiques d'erreur `continue` / `fail_fast` / `fail_loud`.
|
|
81
|
+
- Traces d'explication en arbre (`ConditionTrace`, `RuleTrace`, `DecisionTrace`).
|
|
82
|
+
- Tie-breaking déterministe à priorité égale (ordre d'insertion stable).
|
|
83
|
+
- Suite de tests interne sans dépendance externe (mini-runner par module +
|
|
84
|
+
`examples/end_to_end.py`).
|
|
85
|
+
|
|
86
|
+
### Known limitations (assumées, documentées dès le départ)
|
|
87
|
+
- Signaux dérivés acceptés par l'API mais non traités (pas de cascade de règles).
|
|
88
|
+
- `RuleTrace.duration_ms` toujours à zéro (non mesuré).
|
|
89
|
+
- Pas de fenêtres temporelles, de FSM, ni de `engine.replay()`.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
AGENTS.md
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Contribuer à sinmonto
|
|
2
|
+
|
|
3
|
+
Merci de t'intéresser à `sinmonto` (*Sɛ́n mɔto*, fon pour « moteur de règle »).
|
|
4
|
+
|
|
5
|
+
Ce projet a été développé en solo depuis un téléphone (Termux, Android — pas
|
|
6
|
+
de PC), avec une gouvernance multi-IA inhabituelle : les décisions
|
|
7
|
+
architecturales passent par des revues croisées documentées, pas par une
|
|
8
|
+
seule opinion. Une contribution externe est bienvenue, dans ce cadre.
|
|
9
|
+
|
|
10
|
+
## Avant de commencer
|
|
11
|
+
|
|
12
|
+
1. Lis [`README.md`](README.md) — usage et limitations connues.
|
|
13
|
+
2. Lis [`docs/constitution-finale.md`](docs/constitution-finale.md) §2 — les
|
|
14
|
+
**10 décisions architecturales verrouillées**. Elles ne se redébattent pas
|
|
15
|
+
dans une issue ou une PR. Si une impossibilité technique réelle apparaît
|
|
16
|
+
en implémentant (pas en théorie), signale-la explicitement — ne la
|
|
17
|
+
contourne pas en silence.
|
|
18
|
+
3. Si tu touches au noyau : [`AGENTS.md`](AGENTS.md) pour les conventions de
|
|
19
|
+
code et la routine de vérification exacte.
|
|
20
|
+
|
|
21
|
+
## Les 10 décisions verrouillées
|
|
22
|
+
|
|
23
|
+
1. Pas de réseau Rete complet — indexation alpha légère uniquement.
|
|
24
|
+
2. `Context` mutable pendant un cycle d'évaluation, figé en `FrozenContext`
|
|
25
|
+
immuable à la fin (`commit()`).
|
|
26
|
+
3. `Signal` (déclencheur) et `Fact` (information) sont deux types distincts.
|
|
27
|
+
4. Effects-as-data : aucune règle n'exécute d'effet de bord — elle retourne
|
|
28
|
+
des `Effect` décrits, un exécuteur séparé les applique.
|
|
29
|
+
5. Explicabilité native — chaque condition, vraie ou fausse, doit être
|
|
30
|
+
traçable.
|
|
31
|
+
6. Pas de durabilité multi-jours dans le cœur (`ContextStore`/`FactStore`
|
|
32
|
+
abstraits, implémentations mémoire par défaut).
|
|
33
|
+
7. Temps injecté (`Clock`), jamais `time.time()` dans le moteur.
|
|
34
|
+
8. `engine.compile()` verrouille la configuration.
|
|
35
|
+
9. `__slots__` sur les objets internes chauds — jamais sur le `payload`
|
|
36
|
+
utilisateur.
|
|
37
|
+
10. Protocole `Evaluable` commun, classes distinctes qui l'implémentent.
|
|
38
|
+
|
|
39
|
+
## Le filtre v1.0
|
|
40
|
+
|
|
41
|
+
Avant de proposer une fonctionnalité : *« est-ce que ça rapproche réellement
|
|
42
|
+
la v1.0, ou est-ce qu'on rêve d'une fonctionnalité qui n'a peut-être jamais
|
|
43
|
+
besoin d'exister maintenant ? »* Si c'est la seconde réponse, l'idée a sa
|
|
44
|
+
place dans [`docs/roadmap-vision.md`](docs/roadmap-vision.md), pas dans le
|
|
45
|
+
noyau tout de suite.
|
|
46
|
+
|
|
47
|
+
## Installer et lancer les tests
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/RuleLabs/sinmonto.git
|
|
51
|
+
cd sinmonto
|
|
52
|
+
pip install -e .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Zéro dépendance de runtime ni de test — pas de `pytest`. Chaque module a son
|
|
56
|
+
propre bloc `if __name__ == "__main__":` qui fait tourner le mini-runner
|
|
57
|
+
interne (`_testing.py`). Depuis la racine du dépôt :
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
python3 -m sinmonto._exceptions
|
|
61
|
+
python3 -m sinmonto._core
|
|
62
|
+
python3 -m sinmonto._trace
|
|
63
|
+
python3 -m sinmonto._testing
|
|
64
|
+
python3 -m sinmonto._context
|
|
65
|
+
python3 -m sinmonto._dsl
|
|
66
|
+
python3 -m sinmonto._engine
|
|
67
|
+
python3 examples/end_to_end.py
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
*(`./scripts/test_all.sh` fait tourner cette liste en une commande.)*
|
|
71
|
+
|
|
72
|
+
Les imports internes sont relatifs : un module ne s'exécute pas avec
|
|
73
|
+
`python3 sinmonto/_core.py` en direct, uniquement via `python3 -m sinmonto._core`
|
|
74
|
+
depuis le dossier **parent** de `sinmonto/`. Un échec sort avec un code non
|
|
75
|
+
nul (`os._exit(1)`), exploitable en CI.
|
|
76
|
+
|
|
77
|
+
## Comment proposer un changement
|
|
78
|
+
|
|
79
|
+
**Typo, lien cassé, correction de doc** — PR directe, pas besoin d'issue.
|
|
80
|
+
|
|
81
|
+
**Correction de bug** — Ouvre une issue courte (comportement attendu vs
|
|
82
|
+
observé, comment reproduire, sortie du mini-runner si pertinent). Une PR
|
|
83
|
+
peut suivre immédiatement si tu as déjà le correctif.
|
|
84
|
+
|
|
85
|
+
**Évolution architecturale** (nouvelle fonctionnalité, changement de
|
|
86
|
+
comportement, nouvelle primitive) — Ouvre une issue d'abord. Ne commence pas
|
|
87
|
+
le code avant que la direction soit validée. Ces décisions passent par le
|
|
88
|
+
processus du **contrat vivant** ([`docs/contrat-vivant-gabarit.md`](docs/contrat-vivant-gabarit.md)) :
|
|
89
|
+
mission écrite, revues croisées, rapport structuré, synthèse avant
|
|
90
|
+
verrouillage. Tu peux y participer — proposer une mission, répondre à un
|
|
91
|
+
rapport — mais la décision finale revient au mainteneur.
|
|
92
|
+
|
|
93
|
+
### Ce qu'on attend dans une PR
|
|
94
|
+
- Un changement net, un périmètre clair — pas de refonte cachée dans un
|
|
95
|
+
patch de trois lignes.
|
|
96
|
+
- Les tests concernés lancés localement, et `examples/end_to_end.py`.
|
|
97
|
+
- La doc mise à jour (`README.md`, `CHANGELOG.md`, ou `docs/`) si le
|
|
98
|
+
comportement visible change.
|
|
99
|
+
- Aucun import direct depuis un module interne (`from sinmonto._core import
|
|
100
|
+
Fact`) — seule la surface `sinmonto.__all__` (37 noms) est garantie.
|
|
101
|
+
|
|
102
|
+
## Le ton attendu
|
|
103
|
+
|
|
104
|
+
[`docs/journal-integration.md`](docs/journal-integration.md) documente
|
|
105
|
+
honnêtement les bugs, les fausses pistes et les erreurs de revue — la
|
|
106
|
+
tienne y compris, le cas échéant. Ce n'est pas une gêne à cacher, c'est une
|
|
107
|
+
valeur du projet. *« J'ai d'abord essayé X, ça ne marchait pas parce que Y,
|
|
108
|
+
j'ai finalement opté pour Z »* est un format de description de PR
|
|
109
|
+
parfaitement valide ici — préférable à un historique lissé.
|
|
110
|
+
|
|
111
|
+
## Revue
|
|
112
|
+
|
|
113
|
+
Le dépôt est géré en solo, en preview 0.x. Le délai de réponse peut varier
|
|
114
|
+
selon la disponibilité du mainteneur (depuis son téléphone). Pas d'exigence
|
|
115
|
+
de SLA ; un ping poli après deux semaines sans nouvelles est bienvenu.
|
|
116
|
+
|
|
117
|
+
## Licence
|
|
118
|
+
|
|
119
|
+
En contribuant, tu acceptes que ta contribution soit publiée sous la licence
|
|
120
|
+
du projet : [Apache License 2.0](LICENSE).
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the
|
|
44
|
+
purposes of this License, Derivative Works shall not include works
|
|
45
|
+
that remain separable from, or merely link (or bind by name) to the
|
|
46
|
+
interfaces of, the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including the
|
|
49
|
+
original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright
|
|
52
|
+
owner or by an individual or Legal Entity authorized to submit on
|
|
53
|
+
behalf of the copyright owner. For the purposes of this definition,
|
|
54
|
+
"submitted" means any form of electronic, verbal, or written
|
|
55
|
+
communication sent to the Licensor or its representatives,
|
|
56
|
+
including but not limited to communication on electronic mailing
|
|
57
|
+
lists, source code control systems, and issue tracking systems that
|
|
58
|
+
are managed by, or on behalf of, the Licensor for the purpose of
|
|
59
|
+
discussing and improving the Work, but excluding communication that
|
|
60
|
+
is conspicuously marked or otherwise designated in writing by the
|
|
61
|
+
copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
96
|
+
Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing
|
|
142
|
+
the origin of the Work and reproducing the content of the NOTICE
|
|
143
|
+
file.
|
|
144
|
+
|
|
145
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
146
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
147
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
148
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
149
|
+
implied, including, without limitation, any warranties or
|
|
150
|
+
conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS
|
|
151
|
+
FOR A PARTICULAR PURPOSE. You are solely responsible for
|
|
152
|
+
determining the appropriateness of using or redistributing the
|
|
153
|
+
Work and assume any risks associated with Your exercise of
|
|
154
|
+
permissions under this License.
|
|
155
|
+
|
|
156
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
157
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
158
|
+
unless required by applicable law (such as deliberate and grossly
|
|
159
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
160
|
+
liable to You for damages, including any direct, indirect, special,
|
|
161
|
+
incidental, or consequential damages of any character arising as a
|
|
162
|
+
result of this License or out of the use or inability to use the
|
|
163
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
164
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
165
|
+
other commercial damages or losses), even if such Contributor
|
|
166
|
+
has been advised of the possibility of such damages.
|
|
167
|
+
|
|
168
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
169
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
170
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
171
|
+
or other liability obligations and/or rights consistent with this
|
|
172
|
+
License. However, in accepting such obligations, You may act only
|
|
173
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
174
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
175
|
+
defend, and hold each Contributor harmless for any liability
|
|
176
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
177
|
+
of your accepting any such warranty or additional liability.
|
|
178
|
+
|
|
179
|
+
END OF TERMS AND CONDITIONS
|
|
180
|
+
|
|
181
|
+
Copyright 2026 Clarel Gnimadi
|
|
182
|
+
|
|
183
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
184
|
+
you may not use this file except in compliance with the License.
|
|
185
|
+
You may obtain a copy of the License at
|
|
186
|
+
|
|
187
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
188
|
+
|
|
189
|
+
Unless required by applicable law or agreed to in writing, software
|
|
190
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
191
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
192
|
+
See the License for the specific language governing permissions and
|
|
193
|
+
limitations under the License.
|