Watch
1
0
Fork
You've already forked SouveraineOS
0

docs: archive the memory write-path audit

This commit is contained in:
Fimeg 2026-08-07 16:16:31 -04:00
commit 5cc4020c92
2 changed files with 71 additions and 0 deletions

View file

@ -31,6 +31,10 @@ that owns its subject. Four live ones were promoted to `docs/` instead, as
`FIRST-CLASS-APPS.md`, `SHELL-ECOSYSTEM.md`, `SETTINGS-AUTHORITY.md` and
`AUDIO-PRIVACY.md`.
The substrate memory write-path audit joined this archive on 2026-08-07 after
the stale-index, delete, recursive status and sync paths were fixed and proved
by Gitea run 1246.
## TASK-26 was never written and no longer needs to be
It had two subjects and both closed. `blueline-proximity-lock` as a second

View file

@ -0,0 +1,67 @@
---
task_id: souveraine-memory-write-path-audit-001
title: "Memory writes must persist the git index"
status: landed
priority: high
phase: memory
created: 2026-08-07
landed: 2026-08-07
implementation: souveraine 0c9db09, 9ceaf61
verification: Gitea Actions run 1246
---
# Memory write-path audit
## Outcome
Confirmed. The failure had four parts:
1. `init()` staged its two seed files and wrote a tree, but never persisted
`.git/index`.
2. `commit()` did the same after every `add_path()`.
3. `delete()` unlinked the file and called `commit()`, whose absent-path case
staged nothing. There was no `remove_path()` anywhere in the module.
4. `status()` did not read the index. It counted only root-level Markdown on
disk, while memory lives in nested directories. That was the independent
`Files: 0` bug.
`sync()` was innocent: it pushes `HEAD` exactly, including a malformed tree.
The frontmatter YAML issue is separate and was not changed here.
## Reproduction found on disk
The original report was exact:
| Commit | Tree change |
|--------|-------------|
| `f3d80cb` | added `system/projects/souveraineos.md` |
| `c60fbf4` | added `journal/2026-08-06.md` and silently deleted `souveraineos.md` |
Both files remained in the working tree. The affected repository is
`~/.souveraine/agents/99dd3a18-3e43-4160-9eec-b2ddb2b2a751/memory`.
It was audited read-only; its unrelated dirty state was not reconciled by this
task.
## Landed repair
- Persist the initial index before the initial tree is committed.
- Base every later path-scoped commit on `HEAD`. This makes the repair safe for
legacy repositories whose index was already stale, without committing other
working-tree files.
- Stage missing requested paths with `remove_path()`.
- Persist the index before writing the commit tree.
- Count Markdown recursively from disk for status.
## Pipeline proof
Gitea run 1246's `rust-test` job passed all named regressions:
- `consecutive_writes_survive_in_head_and_index`
- `next_write_repairs_a_legacy_stale_index`
- `delete_survives_in_head_and_index`
- `sync_pushes_instance_branch_to_bare_remote`
The main suite reported 309 passed and 0 failed. No local build was substituted
for the pipeline.