Skip to content

fix(pull): полный pull записывает хеш-память своей базы (#53) - #343

Merged
zeegin merged 11 commits into
masterfrom
claude/peaceful-pascal-s8eqtj
Oct 5, 2026
Merged

zeegin merged 11 commits into
masterfrom
claude/peaceful-pascal-s8eqtj

Conversation

@zeegin

@zeegin zeegin commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

Closes #53. Доводит до слияния #109 (@korolevpavel): его коммиты сохранены с авторством, сверху — правки по ревью мейнтейнера.

Что делает #109

  • Успешный полный pull в формате DESIGNER (Конфигуратор, ibcmd, агент) записывает хеши опубликованного дерева, и следующий push без правок пропускает загрузку.
  • Хеши считаются по staging до публикации, пишутся после её успеха; отказ git, отмена или сбой публикации память не меняют. Ошибка обхода staging или записи памяти выгрузку не отбрасывает, а становится предупреждением.
  • Память лежит под базой: workPath/infobases/<имя>/hashes/<набор>.redb, с привязкой к адресу без учётных данных, каталогу и назначению набора. Чужая память — отказ без запуска исполнителя; база по строке соединения памяти не получает; кеш EDT общий.
  • Полный pull агента всегда выгружает дерево; инкрементальный по-прежнему пропускается по поколению.
  • Выбранный корень набора обходится при любом имени (fix(change-detection): набор с каталогом build, target, tmp не анализируется #302); полный pull отказывает, если цель содержит workPath.

Правки поверх #109

  • SourceSetContext::storage_path возвращает Option: у контекста без памяти пути к хранилищу нет, общий файл нельзя открыть, не обработав этот случай.
  • Привязка пишет назначение именем из YAML (SourceSetPurpose::as_str) вместо Debug; имена сервера и базы на кластере — без учёта регистра.
  • Адрес привязки собирается в config (AppConfig::infobase_memory_address), change_detection к platform не обращается.
  • Чужая память — отдельный ChangeDetectionError::ForeignMemory; отказ называет оба выхода: pull --mode full и push --full.
  • publish_full_dump проверяет цель, workPath и отмену до хеширования staging и ещё раз перед заменой каталога.
  • Загрузчик разбирает File= общей platform::connection::declared_parameter.
  • Страж a_full_pull_records_the_staged_tree_it_publishes, тест перепроверки workPath; тест с chmod 000 пропускается под root.
  • Правила: отказ о чужой памяти без непроверенного обещания атомарности, выбор корня — отдельное правило; CAPABILITIES, CONFIGURATION, DEEP_DIVE, SKILL, сайт и arc42 согласованы. Названо исключение tools.extensions (feat(memory): память по базе под workPath/infobases/<имя>/ — поколение, хеши, файл версий #214) и то, что первый push после обновления загружает всё дерево: старые общие хеши не мигрируются.

Проверки

  • cargo test --locked --no-fail-fast: 1667 passed, 2 ignored, 1 failed — platform::git::tests::an_unreadable_subdirectory_is_unknown_not_clean, не из этого PR: падает только под root (контейнер проверки).
  • cargo fmt --check, cargo clippy --all-targets -D warnings — чисто.
  • Ревью: корректность, Rust-эксперт, устройство модулей со сверкой с spec/rules, мутации; повторный проход по правкам.

Без живого прогона 1С; сквозные сценарии tests/cli_pull_memory.rs только Unix. Поколение агента, файл версий и слияние по объектам остаются в #214/#215/#217.

🤖 Generated with Claude Code

https://claude.ai/code/session_01GBuAmsnz6pUay4rcYs4V4U


Generated by Claude Code

Summary by CodeRabbit

  • New Features
    • Successful full Designer pulls now establish a baseline for later pushes. An unchanged push to the same named base and source set can skip loading.
    • Baselines are kept separate for named bases; ad hoc connections do not reuse them.
  • Bug Fixes
    • Pushes refuse to use baseline data belonging to a different base or source set, with guidance to recover.
    • Full pulls are blocked when the target contains the work directory, including through symlink aliases.
    • Full agent pulls now run even when the recorded generation is unchanged.
    • After an update, the first ordinary push may load the full source tree.

korolevpavel and others added 11 commits September 14, 2026 14:40
- bind change-detection snapshots to their source and infobase
- commit staged dump hashes with durable publication recovery
- cover identity, cancellation and dump-to-build regressions
- reject dump targets containing canonical workPath state
- scan selected source roots while retaining child exclusions
- cover aliases, dump-to-build stability and user edits
- merge current upstream master and replace the unsafe publication-intent protocol
- scope Designer hashes by named infobase and bind snapshots without credentials or executor choice
- prepare staging hashes and record them only after successful full publication for every exporter
- preserve dump output on memory errors and restrict workPath containment checks to full pulls
- keep EDT export caches shared and add publication, isolation and CLI regression guards
- reconcile product rules, architecture notes and runner guidance with the implementation
- refresh source binding after publication can replace a symlink without rescanning staged bytes
- normalize whitespace around File connection keys before runtime and snapshot use
- distinguish native canonical path names without lock-specific case folding or lossy UTF-8
- guard source symlinks, relative connection spelling and exact path bindings with regressions
- Include the Windows partial-load file ownership fix from #334.
- Verify the merged tree with 1652 passing tests and independent reviews.
- Narrow snapshot binding to identity and its seven checks.
- Relocate partial hash guarantees and evidence without closing #214 gaps.
- Preserve the reintroduction guard in arc42 and validate the rule registry.
- Preserve detached client ownership and updated cancellation probes from master.

- Validate full pull snapshots with the complete test suite and independent reviews.
- storage_path returns None for memory-less contexts, so no code can reach the old shared file without handling it
- bindings use the stable YAML purpose name and case-insensitive server addresses; address built in config, not change_detection
- foreign memory is a typed ChangeDetectionError::ForeignMemory naming both exits: full pull or push --full
- publish_full_dump rechecks target, workPath and cancellation before hashing staging; debug log restored
- loader File= normalization reuses platform::connection::declared_parameter
- guard a_full_pull_records_the_staged_tree_it_publishes; test for the workPath recheck; root-safe staging-scan test
- rules, CAPABILITIES, CONFIGURATION, DEEP_DIVE, SKILL, site and arc42 aligned; upgrade note on unmigrated memory

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GBuAmsnz6pUay4rcYs4V4U
…eview notes

- publish_full_dump rechecks target and workPath again after hashing staging
- server and infobase names in the binding are lowercased beyond ASCII
- rule keeps "loading old sources does not repair a failed pull"; CAPABILITIES names the tools.extensions exception with #214
- root-skipped staging-scan test says why it skipped; persists_snapshot documented as storage_path().is_some()

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GBuAmsnz6pUay4rcYs4V4U
- move the #302 root-selection obligation out of the on-demand analysis rule into its own rule with its own check

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GBuAmsnz6pUay4rcYs4V4U
@coderabbitai

coderabbitai Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

🧰 Additional context used
📚 Code guidelines (6)
spec/arc42/05-building-block-view.md — auto-discovered
spec/arc42/06-runtime-view.md — auto-discovered
docs/CONFIGURATION.md — auto-discovered
docs/CAPABILITIES.md — auto-discovered
spec/rules/README.md — auto-discovered
spec/arc42/architecture.md — auto-discovered

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a7b722b5-aac6-4750-bc77-fa0ba2223a0b
📥 Commits

Reviewing files that changed from the base of the PR and between 5b87c39 and 5ff7009.

📒 Files selected for processing (40)
  • SKILL/SKILL.md
  • SKILL/references/troubleshooting.md
  • docs/CAPABILITIES.md
  • docs/CONFIGURATION.md
  • docs/DEEP_DIVE.md
  • docs/site/architecture.html
  • docs/site/sources.html
  • spec/arc42/05-building-block-view.md
  • spec/arc42/06-runtime-view.md
  • spec/arc42/08-cross-cutting-concepts.md
  • spec/arc42/12-glossary.md
  • spec/rules/use-cases/a-base-named-by-a-connection-string-leaves-no-memory.md
  • spec/rules/use-cases/a-selected-root-is-scanned-whatever-its-name.md
  • spec/rules/use-cases/an-unchanged-generation-is-not-dumped.md
  • spec/rules/use-cases/changes-are-detected-on-demand.md
  • spec/rules/use-cases/foreign-memory-is-not-used.md
  • spec/rules/use-cases/full-pull-preserves-its-work-path.md
  • spec/rules/use-cases/full-pull-records-the-published-tree.md
  • spec/rules/use-cases/hash-memory-is-scoped-to-its-base-and-source.md
  • spec/rules/use-cases/memory-lives-under-the-base-it-describes.md
  • src/change_detection/analyzer.rs
  • src/change_detection/hash_storage.rs
  • src/change_detection/scanner.rs
  • src/change_detection/source_sets.rs
  • src/config/loader.rs
  • src/config/model.rs
  • src/config/validate.rs
  • src/domain/source_set.rs
  • src/platform/connection.rs
  • src/support/path.rs
  • src/use_cases/build_project.rs
  • src/use_cases/build_project/helpers.rs
  • src/use_cases/dump_config.rs
  • src/use_cases/dump_config/agent.rs
  • src/use_cases/tool_extension.rs
  • tests/architecture_guardrails.rs
  • tests/cli_build.rs
  • tests/cli_build_agent.rs
  • tests/cli_dump_agent.rs
  • tests/cli_pull_memory.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The change scopes Designer source hashes to named infobases and source sets. Full Designer pulls prepare hashes from staging and record them after publication. Full pulls also reject targets containing workPath. Agent full dumps continue when the generation is unchanged.

Changes

Designer Hash Memory and Full Pulls

Layer / File(s) Summary
Infobase-scoped hash identity
src/domain/source_set.rs, src/change_detection/hash_storage.rs, src/change_detection/source_sets.rs, src/platform/connection.rs, src/support/path.rs, src/config/*, docs/CONFIGURATION.md, docs/CAPABILITIES.md, docs/DEEP_DIVE.md, spec/arc42/*, spec/rules/use-cases/*, tests/cli_build.rs, src/use_cases/build_project.rs
Source-set contexts now support infobase-specific, shared, or disabled snapshot memory. Designer snapshot paths and identities use the infobase, address, source path, purpose, and source-set name. Documentation and tests describe and check this separation.
Snapshot validation and scanning
src/change_detection/analyzer.rs, src/change_detection/scanner.rs, src/use_cases/build_project/helpers.rs, src/use_cases/tool_extension.rs, spec/rules/use-cases/changes-are-detected-on-demand.md, spec/rules/use-cases/a-selected-root-is-scanned-whatever-its-name.md
Analysis rejects nonblank snapshots bound to a different identity and skips persistence when memory is disabled. Full snapshots can be prepared before storage is updated. Scanning includes an explicitly selected root even when its name is normally ignored.
Full-dump publication and snapshot commit
src/use_cases/dump_config.rs, src/use_cases/dump_config/agent.rs, tests/cli_pull_memory.rs, tests/cli_dump_agent.rs, tests/architecture_guardrails.rs, docs/CAPABILITIES.md, docs/DEEP_DIVE.md, spec/rules/use-cases/full-pull-*, SKILL/SKILL.md
Designer and ibcmd full dumps share a publication flow that prepares hashes from staging and commits them after publication. Full-dump targets containing workPath are rejected, while incremental and partial pulls retain their prior allowance. Agent full dumps are not skipped for unchanged generations. Added tests cover publication, memory updates, retries, and base isolation.

Priority: ➖ Normal

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant DumpProvider
  participant publish_full_dump
  participant ChangeDetectionAnalyzer
  participant TargetDirectory
  participant HashStorage
  DumpProvider->>publish_full_dump: Provide staged tree
  publish_full_dump->>ChangeDetectionAnalyzer: Prepare snapshot from staging
  publish_full_dump->>TargetDirectory: Publish staged tree
  publish_full_dump->>ChangeDetectionAnalyzer: Commit snapshot after publication
  ChangeDetectionAnalyzer->>HashStorage: Store snapshot with identity
Loading

Suggested reviewers: alkoleft

Merge Risk: ⚪ Minimal · up to 5ff70

The change scopes Designer hash memory to a named infobase and source set, and a successful full pull now records the baseline for the next unchanged push. No concrete merge-blocking risk was identified in the supplied evidence.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 5ff70

Base-specific snapshot ownership and guarded publication reduce wrong-target reuse. No introduced security vulnerability was established in the examined paths, but concurrency enforcement and broader runtime coverage remain incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The affected trust decision is whether source changes require loading into the selected infobase. Named configuration and extension baselines are separated by base and source set. EDT analysis remains shared, while normal full-pull target selection excludes external-purpose source sets.

Trust Boundaries and Controls

  • observed — Ownership is checked before hashes are used for change analysis. A foreign nonblank snapshot returns a distinct error rather than being silently reused or rebound; the error identifies explicit full pull and full push as recovery choices.
  • observed — Destructive publication retains its consent guard and interruption check. The PR adds canonical workPath-containment rejection, while existing target validation rejects canonical-path changes, project-root replacement, workPath replacement, and filesystem-root replacement.

Resilience and Maintainability Implications

  • observed — Hash entries, ownership identity, watermark, and generation are updated within one database write transaction that rejects an unexpected generation. CLI and production MCP build/dump callers route through workspace-lock wrappers, and dump retains its target lock through publication and memory handling.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 62.70% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 126 functions across 20 files. (20 skippe… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: a full pull records hash memory for its infobase.
Linked Issues check ✅ Passed [#53] Full Designer pulls hash staging before publication and commit that snapshot only after publication succeeds. Infobase and source-set identity prevent reuse of another base’s memory. The `first_…
Out of Scope Changes check ✅ Passed The changed identity, storage, publication, scanner, and agent paths support [#53]. They bind snapshots to the correct base and source, capture the complete selected tree, or protect and commit the pu…
Full details: Docstring Coverage

Explanation

Docstring coverage is 62.70% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 126 functions across 20 files. (20 skipped: 20 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Comment @coderabbitai help to get the list of available commands.

@zeegin
zeegin merged commit 130b8bc into master Oct 5, 2026
6 checks passed
zeegin added a commit that referenced this pull request Oct 5, 2026
…имени (#351)

* fix(change-detection): корень набора с именем служебного каталога анализируется (#302)

- тесты: набор с корнем `build` и порождённая копия EDT `workPath/designer/build`
  анализируются через SourceSetsService, правка в корне видна, а правка
  в служебном `build` внутри набора — нет
- INV.USE-CASES.CHANGES-ARE-DETECTED-ON-DEMAND: служебные и порождённые каталоги
  пропускаются только внутри набора, корень сканируется всегда; новые тесты в check
- тест сканера на выбранный корень перенесён после импортов модуля тестов
- сама правка обхода (`depth() == 0` в filter_entry) уже в master с #343

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GaCotKhgD8MYAPKjaPPWKh

* spec(rules): корень набора держит одно правило

- CHANGES-ARE-DETECTED-ON-DEMAND ссылается на A-SELECTED-ROOT-IS-SCANNED-WHATEVER-ITS-NAME вместо повтора
- сквозные тесты корня с именем build и копии EDT перенесены в check правила о корне

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GaCotKhgD8MYAPKjaPPWKh

* test(change_detection): pin the generated designer root before the scan

- replace the self-fulfilling file assertion with a check that the EDT set named build maps to workPath/designer/build

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GaCotKhgD8MYAPKjaPPWKh

---------

Co-authored-by: Claude <noreply@anthropic.com>
@zeegin zeegin mentioned this pull request Oct 6, 2026
@zeegin zeegin added this to the v0.12 milestone Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(change-detection): full dump оставляет hash snapshot устаревшим

3 participants