Skip to content
Draft
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Unreleased

### Fixed

- **`promptise audit verify` wrapped its output at 80 columns when piped** -- a script reading the output got `last_hash <hash> (seq` and `N)` on separate lines, which broke extracting the hash for `--anchor`. Lines are no longer broken to fit the width.

## 1.10.1 — 2026-10-24

### Security
Expand Down
6 changes: 6 additions & 0 deletions docs/resources/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ All notable changes to Promptise Foundry are documented here.

---

## Unreleased

### Fixed

- **`promptise audit verify` wrapped its output at 80 columns when piped** -- a script reading the output got `last_hash <hash> (seq` and `N)` on separate lines, which broke extracting the hash for `--anchor`. Lines are no longer broken to fit the width.

## v1.10.1 — 2026-10-24

### Security
Expand Down
6 changes: 4 additions & 2 deletions src/promptise/audit_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@
no_args_is_help=True,
help="Check the HMAC-chained audit logs written by AuditMiddleware.",
)
_console = Console()
_err = Console(stderr=True)
# soft_wrap: a line is never broken to fit the width, so output piped to a
# script keeps "last_hash <hash> (seq N)" and "<file>:<line>: ..." on one line.
_console = Console(soft_wrap=True)
_err = Console(stderr=True, soft_wrap=True)


@audit_app.command("verify")
Expand Down
11 changes: 11 additions & 0 deletions tests/test_audit_log_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import json
import logging
import os
import re
from pathlib import Path
from typing import Any

Expand Down Expand Up @@ -357,6 +358,16 @@ def _cli(*args: str, env: dict[str, Any] | None = None) -> Any:


class TestCli:
def test_piped_output_keeps_each_line_whole(self, log: Path) -> None:
"""At the 80 columns of a pipe, the last_hash line used to wrap."""
runner = CliRunner(
env={"COLUMNS": "80", "PROMPTISE_NO_DOTENV": "1", "PROMPTISE_AUDIT_SECRET": KEY}
)
result = runner.invoke(app, ["audit", "verify", str(log)])
assert result.exit_code == 0, result.output
[line] = [ln for ln in result.output.splitlines() if ln.startswith("last_hash ")]
assert re.fullmatch(r"last_hash [0-9a-f]{64} \(seq \d+\)", line), line

def test_intact_log_exits_zero_and_never_prints_the_key(self, log: Path) -> None:
result = _cli(str(log), env={"PROMPTISE_AUDIT_SECRET": KEY})
assert result.exit_code == 0, result.output
Expand Down
Loading