Skip to content

Name review snapshots by naja's content hash - #35

Merged
xtofalex merged 2 commits into
mainfrom
content-hash-snapshots
Nov 11, 2026
Merged

xtofalex merged 2 commits into
mainfrom
content-hash-snapshots

Conversation

@xtofalex

Copy link
Copy Markdown
Contributor

Why

A review snapshot was named by the sha256 of its naja-if dump. The dump records the producer's naja version, so the same netlist got a different id with each naja build, and threads written on one machine could show as other_snapshot on another.

What

  • Snapshot id = NLUniverse.getContentHash() (naja #514, najaeda >= 0.7.35). The hash is the same after a naja-if reload, so a reopened snapshot resolves its threads exact. A fresh load of the HDL/Liberty sources gets the same id only when naja assigns the same ids (file order matters). That is accepted: reopen the snapshot instead.
  • Dumped on first thread only, straight into the review directory: written to a staging directory and then renamed, so the first writer of an id wins.
  • One design DB per review: opening a thread is refused while the universe holds several user DBs. The snapshot dumps only the top DB, so it would not reload under its own id.
  • load_review_snapshot() now returns the loaded top design (it returned None), and it warns when the reloaded netlist doesn't hash to its folder name.
  • Tests:
    • A stored snapshot reopened in a fresh process hashes to its name, and its thread resolves exact.
    • Opening a thread is refused when the universe holds several design DBs.
    • The anonymous-instances fixture now destroys the DB it creates.
  • najaeda floor 0.7.35: protocol.py, pyproject.toml, the CI matrix, and the thirdparty/naja submodule (v0.7.35).
  • Docs: docs/review_format.md (Snapshots section) and CLAUDE.md.

Tested

  • pytest python/tests: 181 passed on najaeda 0.7.35.
  • Native macOS build against naja v0.7.35, ctest: 244/244 passed.
  • Linux native CI has not been run against the new submodule yet.

Known limits

  • A naja-if reload still loses Liberty sequential modeling, so flops in a reopened snapshot draw as boxes. This is a naja issue.
  • No test yet checks that the C++ and Python hashes match. It comes with native review support.

A snapshot id was the sha256 of the naja-if dump, which includes the
producer's version, so the same netlist got a different id per naja
build. Use NLUniverse.getContentHash() (najaeda >= 0.7.35) instead: it
survives a naja-if reload, so a reopened snapshot resolves its threads
exact.

- The dump is written only when a thread is first opened on a design,
  straight into the review (staging dir + rename, first writer wins).
- Opening a thread is refused while the universe holds several design
  DBs: the snapshot holds only the top one, so it wouldn't reload under
  its own id.
- load_review_snapshot() returns the loaded top (it returned None) and
  warns when the reloaded netlist doesn't hash to its name.
- The anonymous-instances fixture destroys the DB it creates.
- najaeda floor and thirdparty/naja moved to 0.7.35.
@xtofalex
xtofalex merged commit b551073 into main Nov 11, 2026
15 checks passed
@xtofalex
xtofalex deleted the content-hash-snapshots branch November 11, 2026 12:35
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.

1 participant