feat: times in the reader's own zone; the audit log shows exact moments (milestone 490)
- users.time_zone (0034). An account without one takes the browser's zone on its first page (POST /account/time-zone/adopt, never over a choice made by hand); the session follows the account on every request. - /account: who you are and the zone every page writes its times in, reached from your name in the sidebar. - formatting.when: 'Today 06:58', 'Yesterday 23:41', 'Tue 6 Oct 14:12', '6 Oct 2025 14:12', 24-hour, in the reader's zone; |ago's hover is the exact local moment instead of UTC; tz_label() for column headers. - Audit log: When (EDT) with exact times, one detail fact a line, on classes. - tzdata in the image, and the airgapped smoke checks a zone resolves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,3 +86,24 @@ async def test_the_row_says_what_was_done_not_its_code(app):
|
||||
assert 'title="monitor.disabled">paused monitor</td>' in page
|
||||
assert "dry run</span>" in page and "False" not in page
|
||||
assert '<option value="monitor." selected>Monitors</option>' in page
|
||||
|
||||
|
||||
async def test_each_entry_shows_its_exact_moment_in_the_readers_zone(app):
|
||||
"""Milestone 490: a record is read for when, not how long ago."""
|
||||
from quart import session
|
||||
from steward.core import formatting as f
|
||||
events = [{"event": _ev("host", "h1", "host.renamed"), "detail": {}, "entity": None,
|
||||
"facts": [{"label": "was", "text": "web-0", "url": None},
|
||||
{"label": "AI token", "text": "#1", "url": None}]}]
|
||||
async with app.test_request_context("/audit/"):
|
||||
session["tz"] = "America/New_York"
|
||||
page = await render_template("audit/list.html", events=events, after=None, action_filter="")
|
||||
ny = f.zone("America/New_York")
|
||||
assert f"<th>When ({f.tz_label(ny)})</th>" in page
|
||||
# 12:00 UTC is 08:00 in New York, and the hover names the zone.
|
||||
assert f'<td class="nowrap">{f.when(events[0]["event"].timestamp, ny)}</td>' in page
|
||||
assert "08:00:00 EDT" in page and " ago<" not in page
|
||||
# One fact a line, labels quiet, and the table on classes.
|
||||
assert '<div><span class="tone-dim">was</span> web-0</div>' in page
|
||||
table = page[page.index('<table class="table">'):]
|
||||
assert "style=" not in table
|
||||
|
||||
Reference in New Issue
Block a user