Skip to content

v1.2.1 — SQLite when UNIQUE fix, README sync#8

Merged
Cedar17 merged 7 commits into
masterfrom
dev
Jun 23, 2026
Merged

v1.2.1 — SQLite when UNIQUE fix, README sync#8
Cedar17 merged 7 commits into
masterfrom
dev

Conversation

@Cedar17

@Cedar17 Cedar17 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Summary

Merge devmaster for the v1.2.1 release. Combines two rounds of changes:

v1.2.0 — SQLite when UNIQUE fix

The when attribute (boolean condition distinguishing timing arcs sharing the same related_pin) was not extracted, not stored in the DB, and not part of the UNIQUE constraint. This caused INSERT OR IGNORE to silently discard 77.7% of timing LUT entries on a production PDK dataset.

Key changes:

  • DDL: add "when" TEXT column, include in UNIQUE constraint
  • Bind empty when as "" not NULL (avoid SQLite NULL-in-UNIQUE dedup trap)
  • LibFile::writeToDB extracts arc.value("when", "") from JSON
  • TDD: 3 new tests, 3 existing tests updated
  • New doc: doc/sqlite_dedup_analysis.md

v1.2.1 — CLI help text sync

  • src/main.cpp: parse subcommand description updated to mention --db SQLite mode
  • README.md: help section synced with actual ./zlibvalidation -h output

Files changed

CMakeLists.txt, README.md, doc/ChangeLog.md, doc/sqlite_dedup_analysis.md, include/LibDatabase.hpp, include/version.h, src/LibDatabase.cpp, src/LibFile.cpp, src/main.cpp, test/test_libdb.cpp, test/test_libfile_db.cpp

Cedar17 and others added 7 commits May 13, 2026 10:58
Introduce LibDatabase class and writeToDB() integration to persist
Liberty LUT entries into a SQLite database via 'parse --db' options.

- LibDatabase: RAII wrapper with prepared INSERT statement,
  float32 BLOB conversion, and WAL journal mode
- LibFile::writeToDB(): iterate cells->pins->timing_arcs->arc_types,
  write each LUT as a row in lut_entries with full hierarchy context
- CLI: add --db, --pvt-corner, --aged-year, --lib-json flags to 'parse'
- CMake: link SQLiteCpp to main target
- Tests: 8 GoogleTest cases covering write, read, UNIQUE constraint,
  BLOB round-trip, idempotent write, and NULL scenario_id invariant
- Rename --pvt-corner to --pvt (generic, not aging-specific)
- Make --aged-year optional (default 0.0, suitable for non-aging libs)
- Remove --lib-json: DB mode no longer writes JSON, JSON and DB
  output are now orthogonal (parse=JSON, parse --db=DB only)
- Clarify process parameter doc: stores raw .lib integer, not
  mapped to SS/FF/TT (caller's responsibility via --pvt)
…dup data loss

The `when` attribute (boolean condition distinguishing timing arcs sharing
the same related_pin) was not extracted, not stored in the DB, and not part
of the UNIQUE constraint. This caused INSERT OR IGNORE to silently discard
77.7% of timing LUT entries on a production PDK dataset (counter reported
35560, DB stored only 7936).

Changes:
- DDL: add "when" TEXT column (between timing_type and arc_type), include
  in UNIQUE(file_path, pvt_corner, aged_year, cell_name, output_pin,
  related_pin, "when", arc_type)
- INSERT/bind: sync column with placeholder; bind empty when as "" not NULL
  (SQLite NULL-in-UNIQUE would let unconditional arcs bypass idempotent
  re-writes and cause data duplication)
- Extraction: LibFile::writeToDB reads arc.value("when", "") from JSON
- TDD: 3 new tests (DifferentWhenSameKeyBothPersisted in libdb layer,
  WhenConditionPreserved and MultipleWhenArcsAllPersisted in integration
  layer); 3 existing tests updated for when column
- Docs: doc/sqlite_dedup_analysis.md (new analysis), doc/ChangeLog.md
  (2026-06-23 entry), README.md (SQLiteCpp dependency)
- Version: bump 1.1.3 -> 1.2.0

Verified on a production PDK (531 cells, 6943 when conditions):
- DB entries recovered from 7936 to 35536 (99.9% recovery)
- Conditional arcs: 27772 all preserved
- Idempotent re-write: count unchanged

Co-Authored-By: Claude <noreply@anthropic.com>
The parse subcommand description in main.cpp was outdated — it omitted the
--db SQLite output mode that was added earlier. Updated both the CLI string
and the README help section to match.

- src/main.cpp: update parse description to mention --db SQLite mode
- README.md: sync help output with actual ./zlibvalidation -h
- Version: bump 1.2.0 -> 1.2.1

Co-Authored-By: Claude <noreply@anthropic.com>
@Cedar17
Cedar17 merged commit 36510dd into master Jun 23, 2026
1 check 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.

1 participant