Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

fix(web): show exact timestamps on the page view

Peterson Salmeafc6de8c8995
diff --git a/CHANGELOG.md b/CHANGELOG.md
index fee7fa0b..e2a49ce4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -12,6 +12,9 @@ version in [`docs/changelog/`](docs/changelog/):
## [Unreleased]
### Fixed
+- Fixed the `/web` page view showing only relative "Updated"/"Created" times;
+ hovering them now shows the exact timestamp, as the history and session views
+ already do. (#TBD)
- Fixed `memory_lint` reporting findings for TTL-expired pages. The lint pass
now omits expired pages before evaluating episodic staleness, rule suggestions,
duplicate titles, and vector or LLM contradiction candidates, preventing
diff --git a/crates/ai-memory-web/src/routes/page.rs b/crates/ai-memory-web/src/routes/page.rs
index 38a174cb..b3fb098f 100644
--- a/crates/ai-memory-web/src/routes/page.rs
+++ b/crates/ai-memory-web/src/routes/page.rs
@@ -145,6 +145,8 @@ pub(crate) async fn handler(
expired: meta.expired,
updated_relative: humanize(&meta.updated_at),
created_relative: humanize(&meta.created_at),
+ updated_at: meta.updated_at,
+ created_at: meta.created_at,
supersedes_path,
supersedes_href,
body_html: rendered.html,
diff --git a/crates/ai-memory-web/src/templates.rs b/crates/ai-memory-web/src/templates.rs
index 9fa37be0..c615dcf6 100644
--- a/crates/ai-memory-web/src/templates.rs
+++ b/crates/ai-memory-web/src/templates.rs
@@ -368,6 +368,10 @@ pub(crate) struct PageView {
pub updated_relative: String,
/// Humanised created timestamp.
pub created_relative: String,
+ /// Exact updated timestamp (ISO 8601), shown on hover.
+ pub updated_at: String,
+ /// Exact created timestamp (ISO 8601), shown on hover.
+ pub created_at: String,
/// Path of the page this supersedes, or empty string.
pub supersedes_path: String,
/// Link target for the superseded page, or empty string.
diff --git a/crates/ai-memory-web/templates/page.html b/crates/ai-memory-web/templates/page.html
index c81f49c4..60ffde57 100644
--- a/crates/ai-memory-web/templates/page.html
+++ b/crates/ai-memory-web/templates/page.html
@@ -35,11 +35,11 @@
expired
</span>
{% endif %}
- <span class="ml-1">Updated {{ updated_relative }}</span>
+ <span class="ml-1">Updated <time datetime="{{ updated_at }}" title="{{ updated_at }}">{{ updated_relative }}</time></span>
<span>·</span>
<a href="{{ history_href }}" class="text-blue-600 dark:text-blue-400 underline">History</a>
<span>·</span>
- <span>Created {{ created_relative }}</span>
+ <span>Created <time datetime="{{ created_at }}" title="{{ created_at }}">{{ created_relative }}</time></span>
{% if supersedes_path != "" %}
<span>·</span>
<span>Supersedes <a href="{{ supersedes_href }}" class="text-blue-600 dark:text-blue-400 underline">{{ supersedes_path }}</a></span>
diff --git a/crates/ai-memory-web/tests/suite/routes.rs b/crates/ai-memory-web/tests/suite/routes.rs
index c6b5948e..b00eaf72 100644
--- a/crates/ai-memory-web/tests/suite/routes.rs
+++ b/crates/ai-memory-web/tests/suite/routes.rs
@@ -300,6 +300,52 @@ async fn web_page_view_omits_author_chrome_for_anonymous_pages() {
);
}
+#[tokio::test]
+async fn web_page_view_exposes_exact_timestamps() {
+ // The relative "Updated 3 days ago" text hides the exact time; history and
+ // session views already expose it, so the page view must too.
+ let (_tmp, store, wiki) = setup().await;
+ let ws = store
+ .writer
+ .get_or_create_workspace("default")
+ .await
+ .unwrap();
+ let proj = store
+ .writer
+ .get_or_create_project(ws, "scratch", None)
+ .await
+ .unwrap();
+ wiki.write_page(wiki_req(ws, proj, "notes/times.md", "time body"))
+ .await
+ .unwrap();
+ let meta = store
+ .reader
+ .page_meta("default", "scratch", "notes/times.md")
+ .await
+ .unwrap()
+ .unwrap();
+
+ let app = router(store.reader.clone(), wiki.clone());
+ let resp = app
+ .oneshot(
+ Request::builder()
+ .uri("/w/default/scratch/p/notes/times.md")
+ .body(Body::empty())
+ .unwrap(),
+ )
+ .await
+ .unwrap();
+ assert_eq!(resp.status(), StatusCode::OK);
+ let body = axum::body::to_bytes(resp.into_body(), usize::MAX)
+ .await
+ .unwrap();
+ let text = std::str::from_utf8(&body).unwrap();
+ for (label, at) in [("Updated", &meta.updated_at), ("Created", &meta.created_at)] {
+ let tag = format!("<time datetime=\"{at}\" title=\"{at}\">");
+ assert!(text.contains(&tag), "{label} must carry {tag}: {text}");
+ }
+}
+
#[tokio::test]
async fn web_page_view_renders_author_chip_for_attributed_pages() {
let (_tmp, store, wiki) = setup().await;
@@ -455,19 +501,33 @@ async fn web_page_view_created_is_the_first_versions_date() {
}
};
+ // The relative value sits inside a `<time>` that carries the exact timestamp.
+ let shown = |text: &str, label: &str| -> String {
+ let start = text
+ .find(&format!("{label} <time"))
+ .unwrap_or_else(|| panic!("no {label} time: {text}"));
+ let rest = &text[start..];
+ let open = rest.find('>').unwrap() + 1;
+ let close = rest.find("</time>").unwrap();
+ rest[open..close].to_owned()
+ };
+
let text = get("/w/default/scratch/p/notes/versions.md").await;
- assert!(
- text.contains("Created 1 month ago"),
- "Created should be the oldest version's date: {text}"
+ assert_eq!(
+ shown(&text, "Created"),
+ "1 month ago",
+ "Created should be the oldest version's date"
);
- assert!(
- text.contains("Updated just now"),
- "Updated stays the latest version's date: {text}"
+ assert_eq!(
+ shown(&text, "Updated"),
+ "just now",
+ "Updated stays the latest version's date"
);
let text = get("/w/default/scratch/p/notes/single.md").await;
- assert!(
- text.contains("Created just now"),
- "a single-version page keeps its own date: {text}"
+ assert_eq!(
+ shown(&text, "Created"),
+ "just now",
+ "a single-version page keeps its own date"
);
// The JSON API reads the same page-level date, so SPA clients agree.