fix(ci): zot test schema parity + dockerignore theme path + hadolint DL3059
Some checks failed
CI / skinny-install (aco) (push) Successful in 1m7s
CI / skinny-install (api) (push) Successful in 35s
CI / skinny-install (bcda) (push) Successful in 36s
CI / skinny-install (bib) (push) Successful in 35s
CI / skinny-install (bls) (push) Successful in 32s
CI / skinny-install (ccw) (push) Successful in 35s
CI / skinny-install (cli) (push) Successful in 39s
CI / skinny-install (cms) (push) Failing after 0s
CI / skinny-install (conf) (push) Successful in 39s
CI / skinny-install (opps) (push) Successful in 36s
CI / skinny-install (perf) (push) Failing after 1s
CI / skinny-install (pfs) (push) Successful in 41s
CI / skinny-install (rex) (push) Successful in 36s
Deploy / build-scan-report (push) Failing after 39s
CI / lint-test (push) Failing after 10m14s

- tests/zot/test_db.py: seed itemTypes/fields/creatorTypes tables
  before Db.__init__ so _verify_schema_parity passes. Update hardcoded
  constant assertions to match Zotero 7 schema IDs.
- .dockerignore: un-exclude intermediate infra/marimo/ dir so BuildKit
  can descend into infra/marimo/theme/ (COPY was erroring with
  "not found" even though theme/** was un-excluded).
- .hadolint.yaml: suppress DL3059 (consecutive RUN — intentional for
  cache-layer control in docs.Dockerfile).
This commit is contained in:
kert
2026-04-16 10:39:39 -04:00
parent ec087900e0
commit eb55e2aa8d
3 changed files with 47 additions and 10 deletions

View File

@@ -15,10 +15,15 @@ tests/
infra/ infra/
# Carve out the pieces that feed image builds so they ride along in the # Carve out the pieces that feed image builds so they ride along in the
# build context. `infra/` is otherwise heavy (certs, state, configs). # build context. `infra/` is otherwise heavy (certs, state, configs).
# Docker needs each intermediate directory un-excluded explicitly:
# `!infra/marimo/` un-excludes the dir entry itself so BuildKit can
# descend into it; `!infra/marimo/theme/**` un-excludes the contents.
!infra/marimo/
!infra/marimo/theme/ !infra/marimo/theme/
!infra/marimo/theme/** !infra/marimo/theme/**
!infra/gitea/ !infra/gitea/
!infra/gitea/** !infra/gitea/**
!infra/images/
assets/ assets/
cloud/ cloud/
mirrors/ mirrors/

View File

@@ -6,3 +6,4 @@ ignored:
- DL4006 # Pipe to bash (accepted for zotero installer script) - DL4006 # Pipe to bash (accepted for zotero installer script)
- SC2015 # A && B || C pattern (intentional in multi-stage builds) - SC2015 # A && B || C pattern (intentional in multi-stage builds)
- SC2012 # ls vs find (ls is fine for known-safe filenames in our builds) - SC2012 # ls vs find (ls is fine for known-safe filenames in our builds)
- DL3059 # Multiple consecutive RUN (intentional for cache-layer granularity)

View File

@@ -132,9 +132,38 @@ CREATE TABLE IF NOT EXISTS itemNotes (
note TEXT, note TEXT,
title TEXT title TEXT
); );
CREATE TABLE IF NOT EXISTS itemTypes (
itemTypeID INTEGER PRIMARY KEY,
typeName TEXT
);
CREATE TABLE IF NOT EXISTS creatorTypes (
creatorTypeID INTEGER PRIMARY KEY,
creatorType TEXT
);
""" """
def _seed_schema_maps(con: sqlite3.Connection) -> None:
"""Populate lookup tables so ``_verify_schema_parity`` passes."""
for name, tid in TYPE_MAP.items():
con.execute(
"INSERT OR IGNORE INTO itemTypes (itemTypeID, typeName) VALUES (?, ?)",
(tid, name),
)
for name, fid in FIELD_MAP.items():
con.execute(
"INSERT OR IGNORE INTO fields (fieldID, fieldName) VALUES (?, ?)",
(fid, name),
)
for name, cid in CREATOR_TYPES.items():
con.execute(
"INSERT OR IGNORE INTO creatorTypes (creatorTypeID, creatorType) VALUES (?, ?)",
(cid, name),
)
def _seed_fields(con: sqlite3.Connection) -> None: def _seed_fields(con: sqlite3.Connection) -> None:
"""Insert field definitions so get_fields() can join by name.""" """Insert field definitions so get_fields() can join by name."""
for name, fid in FIELD_MAP.items(): for name, fid in FIELD_MAP.items():
@@ -156,9 +185,11 @@ def db(tmp_path) -> Db:
path = str(tmp_path / "zotero.sqlite") path = str(tmp_path / "zotero.sqlite")
con = sqlite3.connect(path) con = sqlite3.connect(path)
con.executescript(ZOTERO_SCHEMA) con.executescript(ZOTERO_SCHEMA)
# Seed lookup tables BEFORE Db.__init__ so _verify_schema_parity passes.
_seed_schema_maps(con)
con.commit()
con.close() con.close()
d = Db(path) d = Db(path)
_seed_fields(d.con)
yield d yield d
d.close() d.close()
@@ -481,7 +512,7 @@ class TestContextManager:
class TestConstants: class TestConstants:
def test_type_map_has_all_standard_types(self): def test_type_map_has_all_standard_types(self):
assert len(TYPE_MAP) == 36 assert len(TYPE_MAP) == 40
assert "journalArticle" in TYPE_MAP assert "journalArticle" in TYPE_MAP
assert "statute" in TYPE_MAP assert "statute" in TYPE_MAP
assert "report" in TYPE_MAP assert "report" in TYPE_MAP
@@ -490,16 +521,16 @@ class TestConstants:
def test_field_map_has_core_fields(self): def test_field_map_has_core_fields(self):
assert len(FIELD_MAP) >= 100 assert len(FIELD_MAP) >= 100
assert FIELD_MAP["title"] == 110 assert FIELD_MAP["title"] == 1
assert FIELD_MAP["url"] == 1 assert FIELD_MAP["url"] == 10
assert FIELD_MAP["abstractNote"] == 90 assert FIELD_MAP["abstractNote"] == 2
assert FIELD_MAP["extra"] == 22 assert FIELD_MAP["extra"] == 19
assert FIELD_MAP["DOI"] == 26 assert FIELD_MAP["DOI"] == 8
def test_creator_types_complete(self): def test_creator_types_complete(self):
assert len(CREATOR_TYPES) == 29 assert len(CREATOR_TYPES) == 37
assert CREATOR_TYPES["author"] == 1 assert CREATOR_TYPES["author"] == 10
assert CREATOR_TYPES["editor"] == 3 assert CREATOR_TYPES["editor"] == 12
# ── Structured reads ───────────────────────────────────────────── # ── Structured reads ─────────────────────────────────────────────