Skip to content

Improve session rendering and file mention handling#241

Merged
andagaev merged 1 commit into
mainfrom
session-render
Jul 24, 2026
Merged

Improve session rendering and file mention handling#241
andagaev merged 1 commit into
mainfrom
session-render

Conversation

@andagaev

@andagaev andagaev commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator
  • Render issue-backed prompts through Askama and centralize debounced file-index loading.
  • Share fuzzy file-entry ranking between runtime selection and UI suggestions.
  • Project one coherent FrameTime snapshot per render and inject clock offsets into animations, timers, and activity-day calculations.
  • Persist session activity timestamps from the injected clock so local-day aggregation and feature tests stay timezone-independent.
  • Patch coverage corrections exercise all affected paths, with 100% local patch coverage and all required Agentty checks passing.

@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR refactors several cross-cutting concerns to improve testability and timezone correctness. It introduces a FrameTime snapshot struct that captures a single coherent clock reading per render frame, moves fuzzy file-entry ranking from the infra layer into the domain layer, migrates activity-timestamp aggregation from SQLite localtime to Rust-side clock-injected offsets, and centralises @-mention index loading in TaskService.

  • Clock injection end-to-end: SessionLoadInput now carries a Clock reference; record_session_creation_activity calls insert_session_creation_activity_at with the injected clock's timestamp; FrameTime consumes a single clock.now_system_time() call and threads unix_seconds, unix_millis, and local_utc_offset_seconds through all render paths, eliminating multiple independent SystemTime::now() reads per frame.
  • Domain-layer fuzzy ranking: filter_entries and its scoring helpers are moved from infra/file_index.rs to domain/file_entry.rs, letting the runtime at-mention handler and UI suggestion rendering share the same ranking logic without depending on the infra layer.
  • Issue-session prompt templating: The hardcoded format!("Address this issue: {issue_url}") call is replaced with a compiled Askama template, with a matching unit test asserting the rendered output.

Confidence Score: 5/5

Safe to merge — the changes are a well-tested structural refactoring with no behaviour changes in production paths.

All changes are either moving code between modules without altering logic, or wiring an already-tested clock abstraction through new call sites. The removed SQLite localtime aggregation is replaced by an equivalent Rust-side calculation that is independently unit-tested with fixed-offset clock fixtures, including a boundary test at day transitions. The new FrameTime snapshot eliminates clock drift between render sub-calls. No database schema changes, no new external dependencies, and all former API surface consumers are updated consistently.

No files require special attention. The activity aggregation migration (load.rs, activity.rs) is the highest-complexity change and is covered by the new record_session_creation_activity_uses_injected_clock and daily_activity_uses_clock_offset_for_each_timestamp tests.

Reviews (6): Last reviewed commit: "Improve session rendering and file menti..." | Re-trigger Greptile

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@andagaev
andagaev force-pushed the session-render branch 4 times, most recently from c1aa4b1 to 5f1620b Compare July 24, 2026 05:24
- Issue-backed prompts render through Askama, and debounced file-index loading stays centralized.
- Fuzzy file-entry ranking serves runtime selection and UI suggestions.
- One `FrameTime` snapshot supplies animation, timer, and activity-day clock values for each render.
- Injected clocks persist activity timestamps and keep local-day aggregation and feature tests timezone-independent.
@sonarqubecloud

Copy link
Copy Markdown

@andagaev
andagaev marked this pull request as ready for review July 24, 2026 05:40
@andagaev
andagaev requested a review from minev-dev as a code owner July 24, 2026 05:40
@andagaev
andagaev merged commit 1b1f140 into main Jul 24, 2026
20 checks passed
@andagaev
andagaev deleted the session-render branch July 24, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant