Skip to content

test: replace forged history snapshot fixtures with real captures - #3846

Merged
trissim merged 1 commit into
mainfrom
pi-pr-salvage-3801-fixture
Nov 1, 2026
Merged

trissim merged 1 commit into
mainfrom
pi-pr-salvage-3801-fixture

Conversation

@trissim

@trissim trissim commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

1 fixture correction; 1 file, +57/-27. Delete the entire fake RecordedNames / SimpleNamespace source family. Salvage the real-capture scenario from retained 39e793eecceabee4b9396b389f456291f5214dbb, preserving all 23 assertions. Three existing lexical test bodies remain AST-identical. No production code changes.

This repairs the fixture left by merged #3801. The original author branch and the retained integration commit are untouched. Authorization: claude-ai53689; pi-pr-salvage retains correction/follow-through, while pi-commander/claude-ai retain integration and landing.

Before → after

Before, tests/test_display_reference_scan.py:25-48 declared a fake provenance object, nested namespace incarnations, and a two-part (key, revision) identity. The lexical helper also put strings where DisplayReference instances belong. The test exercised those imitations, not HistorySource's actual capture contract.

After:

  • Lexical setup uses existing CurrentDisplayReferences and RecordedThreadIncarnation, not string-valued targets.
  • The existing comms fixture (tests/conftest.py:545) owns a real isolated installed bus. The test declares a channel/thread through their existing owners.
  • HistorySource.capture_original (historical_views.py:341) reads the actual registry document/revision and bus identity/revision. Its snapshot_identity (:336) owns the three-part key: source, bus revision, registry FileObservation.
  • DisplayReferences.for_source (display_references.py:169) and CurrentDisplayReferences(SnapshotRestored, DisplayReferences) (:241) remain the unmodified projection/cache/restoration owners. No replacement class, alternate cache, alias or compatibility reader.

Formal finding: BOUND-2 / MEMB-5. Fact: captured snapshot identity and provenance shape. At: old tests/test_display_reference_scan.py:25-48. Derive: declaration/capture. By: HistorySource.snapshot_identity / capture_original, historical_views.py:336-348. Paper1 §1 / Theorem 4.7: the namespace is a competing statement of a fact already declared; Corollary 4.10: passing a fake-source test does not establish the real relationship.

Behavior the retained scenario checks — UNRUN here

  • Same real capture reuses its projected answer; None retains the current context.
  • Recorded incarnations and current channel references survive projection.
  • A real registry rename changes only the registry portion of the captured key; the old capture retains its own namespace.
  • A real Bus.append / PublicRecord.from_message changes only the bus portion; equal projected values still have separate per-snapshot instances.
  • Pickle restoration preserves declared values but starts a fresh derived cache.

The 23 assertions are AST-identical to the retained scenario. Only its setup moves to this module, reusing the canonical comms fixture and actual declaration APIs rather than importing the other module's local fixture. An actual channel is declared before capture. tests/test_sidebar_observation.py is untouched, avoiding that shared file's retained PR.

Source evidence and limits

Before editing, NRA's existing parse_python_module_roots and ModuleSyntaxIndex covered 1,885 modules / 8,829 class declarations / 536 relevant sites / 0 parse omissions, across Core src/tests/tools at P859 bdfce35bf plus owned Toad src/tests at historical bedb4d840. The latter is explicitly not post-P859 dependency qualification. Relevant declaration/producer/consumer sites and all original class bases are retained in core3801-fixture-53689/source-map-before.json.

Current main was fetched and the owned branch advanced to db5faf131; all seven checked production/fixture dependencies (historical_views, display_references, registry_provenance, thread_identity, registry_document, messages, tests/conftest.py) are byte-unchanged from the retained source map. Main's unrelated deletions/moves remain intact. All 13 returned open PRs were checked; none touched this test path.

After editing: NRA reparse + compile, exact comparison of the three existing lexical tests and 23 retained assertions, and git diff --check all passed. Whole Core src/tests/tools and owned Toad src/tests searches found no remaining caller of the deleted test helper/class/test name; the Toad path was positively witnessed with LinkContext first. These are source observations, not an executed NRA migration, MRO/class execution, module-import proof or behavioral pass.

No pytest, full suite, local NRA gate, provider/native run, installed-package edit or production mutation was launched by this unit. No source-absence tests were added.

Integration outcome

Merged, squash 2f5ce2a978f9f8934eb778ab1fc53ad02929dfef. Forge state/head/merge were independently read back; Git confirms that squash is an ancestor of current main 20e6b883a182ce359445c893a030b5c2b5f74d26, and the test blob at the reviewed b14b83a2c62d8abba6fab8fc335f25a9e4903276, squash and that main is byte-identical.

Integration owner claude-ai reports in #comms53892: CPython3.14 container venv; tests/test_display_reference_scan.py: 4 collected, 4 passed, rc0, using the reviewed head's test file on main d7bb89a42. That includes the real capture/rename/append/restoration scenario test_source_projection_reuses_real_captures_without_merging_revisions and all three lexical cases. This worker did not independently run or observe that process; the original merger message owns the execution report. No reassurance rerun is requested.

The fixture has landed; this outcome does not qualify any production runtime or native-package fixture. #3820's installed startup/compaction journey remains open.

This test-only fix makes no installed UI, latency, production startup or compaction claim. #3820's accepted prepared-prefix evidence remains scoped separately; its production journey is still open.

Assumed: this isolated fixture has no concurrent external registry/bus writer. The unchanged captured-source contract excludes arbitrary external mutation of provenance dictionaries. The first source projection may walk names; this patch makes no first-load timing claim.

The snapshot no longer has to pass a test against its cardboard stunt double.

Salvage real-capture assertions from retained 39e793 without its production changes. Delete RecordedNames and the two-part namespace source; lexical cases use declared reference types. Runtime selection remains with integration; no unit pytest or local gate.
Copilot AI balanced review requested due to automatic review settings November 1, 2026 22:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@trissim
trissim merged commit 2f5ce2a into main Nov 1, 2026
8 checks passed
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.

2 participants