Skip to content

docs(graph): pin what an edge's age means, and record why F42 is not a leak - #185

Merged
Cipher208 merged 1 commit into
masterfrom
docs/edge-age-contract
Nov 3, 2026
Merged

Cipher208 merged 1 commit into
masterfrom
docs/edge-age-contract

Conversation

@Cipher208

Copy link
Copy Markdown
Owner

Что

F42 утверждал, что 30-дневный prune голодает: upsert обновляет created_at, поэтому мёртвое ребро никогда не доходит до stale-полосы и не умирает.

Механизм реален. Репро реальной _insert_edge на чистой базе: ребро 40 дней, ингибирование в 0, пересборка на 0.8 → rows_written=1, возраст 0.00 d. Равный и слабый повтор — настоящий no-op.

Голодания в данных нет. Замер 2026-11-03, мёртвые heuristic-рёбра:

база 25–30 д 30–31 д дальше
Hermes 56 650 189 0
CowAgent 1 765 2 0
Mimocode 24 961 0 120 (44.7 д)

Граница переходит пачками и чистится на следующем проходе NREM: prune отстаёт максимум на один проход, а не голодает. Одно чтение «0 за 30 дней» — момент, а не свойство: через 8 минут та же база дала 189.

Аудит обещал «~130k перезаписей/ночь» и голодание; измерено 39 251 перезапись в сутки, из них мёртвых 51.

Что реально не так

Семантика. created_at — это рождение ребра или последняя строго усиливающая пересборка, что позже. Независимого рождения нет: valid_from пуст у 100% строк во всех трёх базах (416 113 / 291 152 / 91 002). Это теперь записано и запинено, а не подразумевается.

  • _insert_edge: контракт + замер + прямая оговорка, что смена поведения (ребро начнёт затухать через 30 дней после первого появления) — продуктовое решение, а не багфикс;
  • модульный докстринг: убрано «all inserts are INSERT OR IGNORE — re-runs are no-ops», которое аудит называл ложным и которому новый контракт противоречит;
  • тест пинит все четыре случая: сильнее — refresh, равный — no-op, слабый — no-op, второе усиление — снова refresh.

Аномалия, зафиксирована без объяснения

Mimocode держит 120 мёртвых heuristic:tokens на 44.7 д, все проштампованы в пределах ~0.9 с 2026-09-19. Пропуск NREM через границу объяснил бы это, но это гипотеза о расписании той базы — в отчёте она помечена как гипотеза, не как факт.

Изменений поведения нет

AST идентичен базе после удаления докстрингов — проверено.

Проверка

  • 2824 passed;
  • ruff check чисто, ruff format 750 файлов, mypy 63 = baseline;
  • три прогона blind verifier. Первый: нашёл 120 рёбер Mimocode, опровергших «ни одно не перешло». Второй: «0 за границей» — артефакт момента, и моя причинная версия про F107 была выдумана. Третий: чисто, кроме устаревшего модульного докстринга — он исправлен здесь же.

Отчёт с замерами: локальный .compose/reports/2026-11-03-f42-dryrun.md.

…a leak

F42 claimed the 30-day NREM prune starves: the upsert refreshes `created_at`, so
a dead edge never reaches the stale band and never dies. The mechanism is real —
a 40-day edge that inhibition drove to weight 0 gets a fresh age when its miner
re-derives it at full strength — but the live bases do not show the starvation.

Measured 2026-11-03 (report: .compose/reports/2026-11-03-f42-dryrun.md), Hermes
dead heuristic edges: 56 650 inside the 25-30 d band, 189 just past 30 d, none
beyond. CowAgent 1 765 / 2 / 0. The boundary is crossed in batches and cleared
on the next NREM pass, so pruning lags by up to one pass rather than starving. A
single "0 past 30 d" reading is a moment, not a property: eight minutes later the
same base read 189.

What is actually wrong is semantic. `created_at` means the edge's birth or its
last WEIGHT-INCREASING re-derivation, whichever is later, and there is no way to
recover the birth: `valid_from` is NULL on all 416 113 / 291 152 / 91 002 rows of
the three bases. That is now written down and pinned instead of implied.

  - `_insert_edge` docstring: the contract, the measurement, and the explicit
    note that changing it is a product decision (every re-derived edge would
    start decaying 30 days after first sighting), not a bugfix.
  - module docstring: drops "all inserts are INSERT OR IGNORE — re-runs are
    no-ops", which the audit flagged as false and which the new contract
    contradicts.
  - test `test_remine_after_inhibition_refreshes_the_edge_age` pins all four
    cases: stronger refreshes the age, equal is a no-op, weaker is a no-op, a
    second stronger write moves it again.

One anomaly is recorded, not explained: Mimocode holds 120 dead
`heuristic:tokens` edges at 44.7 d, all stamped within ~0.9 s on 2026-09-19. A
skipped NREM pass over that boundary would explain it, but that is a hypothesis
about that base's schedule, not something these rows prove.

No behaviour changes: the AST is identical to the base aside from docstrings.
@coderabbitai

coderabbitai Bot commented Nov 3, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

CodeRabbit Verify

  • Run CodeRabbit Verify to test the changes in this pull request.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Nov 3, 2026
@Cipher208
Cipher208 merged commit 7fa60d0 into master Nov 3, 2026
19 checks passed
@Cipher208
Cipher208 deleted the docs/edge-age-contract branch November 3, 2026 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant