Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/bernstein/core/persistence/journal.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def to_dict(self) -> dict[str, Any]:
"tool_result": self.tool_result,
"step_hash": self.step_hash,
"ts": self.ts,
"blob_refs": list(self.blob_refs),
"blob_refs": self.blob_refs.copy(),
}

@classmethod
Expand Down
9 changes: 3 additions & 6 deletions src/bernstein/core/persistence/journal_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def canonical_bytes(self) -> bytes:
"steps": self.steps,
"bernstein_version": self.bernstein_version,
"created_at": self.created_at,
"blob_digests": list(self.blob_digests),
"blob_digests": self.blob_digests.copy(),
"format_version": self.format_version,
}
return json.dumps(document, sort_keys=True, separators=(",", ":")).encode("utf-8")
Expand All @@ -105,7 +105,7 @@ def to_json(self) -> str:
"steps": self.steps,
"bernstein_version": self.bernstein_version,
"created_at": self.created_at,
"blob_digests": list(self.blob_digests),
"blob_digests": self.blob_digests.copy(),
"format_version": self.format_version,
},
sort_keys=True,
Expand Down Expand Up @@ -472,14 +472,11 @@ def open_receipt(receipt_path: Path): # type: ignore[no-untyped-def]
__all__ = [
"MANIFEST_NAME",
"ExportResult",
"JournalError",
"ReceiptError",
"ReceiptManifest",
"ReceiptVerificationResult",
"export_receipt",
"open_receipt",
"verify_receipt",
]


# Re-export so callers don't need a separate journal import for the symbol.
JournalError = JournalError
2 changes: 1 addition & 1 deletion src/bernstein/core/persistence/journal_publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _redact_value(value: Any) -> Any:

def _redact_row(row: dict[str, Any], policy: RedactionPolicy) -> dict[str, Any]:
"""Return a copy of *row* with redaction policy applied."""
redacted = dict(row)
redacted = row.copy()
for field_name in policy.redact_fields:
if field_name in redacted:
redacted[field_name] = _redact_value(redacted[field_name])
Expand Down
2 changes: 1 addition & 1 deletion src/bernstein/core/persistence/lineage_signer.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def register_attachment_parents(
A new list with attachment parents appended.
"""
seen: set[str] = set(parents)
out: list[str] = list(parents)
out: list[str] = parents.copy()
for digest in attachment_sha256s:
uri = build_attachment_parent_uri(digest)
if uri not in seen:
Expand Down
2 changes: 1 addition & 1 deletion src/bernstein/eval/incident_synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ def _source_incident_from_yaml(path: Path) -> str:
for line in path.read_text(encoding="utf-8").splitlines():
if line.startswith("source_incident:"):
raw = line.split(":", 1)[1].strip()
if len(raw) >= 2 and raw[0] == '"' and raw[-1] == '"':
if len(raw) >= 2 and raw[0] == '"' == raw[-1]:
raw = raw[1:-1].replace('\\"', '"').replace("\\\\", "\\")
return raw
except OSError:
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_journal_chain.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def test_journal_path_default_is_runtime_journal(self, tmp_path: Path) -> None:
# Single bucket file by default.
files = list(agent_dir.glob("*.jsonl"))
assert len(files) == 1
# File mode is owner-writeable; on POSIX must not be group/world-writable.
# File mode is owner-writable; on POSIX must not be group/world-writable.
if os.name == "posix":
mode = files[0].stat().st_mode & 0o777
assert (mode & 0o022) == 0, f"unsafe mode {oct(mode)}"
2 changes: 2 additions & 0 deletions tests/unit/test_readme_api_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@
"desktop-register",
# Bot-added: drift autofix (regen_contract_drift.py)
"supervisor",
# Bot-added: drift autofix (regen_contract_drift.py)
"schedule",
}
)

Expand Down
Loading