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
36 changes: 32 additions & 4 deletions src-tauri/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,7 @@ pub struct GitHubWorkItem {
pub title: String,
pub url: String,
pub state: String,
pub created_at: String,
pub updated_at: String,
pub labels: Vec<GitHubLabel>,
pub assignees: Vec<GitHubAssignee>,
Expand Down Expand Up @@ -1704,9 +1705,9 @@ fn git_github_work_items_for(
};
let limit = limit.clamp(1, 100).to_string();
let fields = if kind == "pr" {
"number,title,url,state,updatedAt,labels,assignees,isDraft"
"number,title,url,state,createdAt,updatedAt,labels,assignees,isDraft"
} else {
"number,title,url,state,updatedAt,labels,assignees"
"number,title,url,state,createdAt,updatedAt,labels,assignees"
};
let mut args = vec![
kind.to_string(),
Expand Down Expand Up @@ -1750,9 +1751,9 @@ fn git_github_work_item_for(
let repo = format!("{owner}/{name}");
let number = number.to_string();
let fields = if kind == "pr" {
"number,title,url,state,updatedAt,labels,assignees,isDraft"
"number,title,url,state,createdAt,updatedAt,labels,assignees,isDraft"
} else {
"number,title,url,state,updatedAt,labels,assignees"
"number,title,url,state,createdAt,updatedAt,labels,assignees"
};
let json = gh_checked(
root,
Expand Down Expand Up @@ -2721,6 +2722,8 @@ fn parse_github_work_items(
url: String,
state: String,
#[serde(default)]
created_at: String,
#[serde(default)]
updated_at: String,
#[serde(default)]
labels: Vec<RowLabel>,
Expand All @@ -2738,6 +2741,7 @@ fn parse_github_work_items(
title: row.title,
url: row.url,
state: row.state.to_lowercase(),
created_at: row.created_at,
updated_at: row.updated_at,
labels: row
.labels
Expand Down Expand Up @@ -5328,6 +5332,7 @@ mod tests {
"title": "Promo codes fail to apply",
"url": "https://github.com/acme/web/issues/5138",
"state": "OPEN",
"createdAt": "2026-08-20T09:00:00Z",
"updatedAt": "2026-08-27T08:00:00Z",
"labels": [{"name": "bug", "color": "d73a4a"}],
"assignees": [{"login": "maya"}]
Expand All @@ -5345,6 +5350,9 @@ mod tests {
"https://avatars.githubusercontent.com/maya?s=64"
);
assert!(!items[0].draft);
let payload = serde_json::to_value(&items[0]).unwrap();
assert_eq!(payload["createdAt"], "2026-08-20T09:00:00Z");
assert_eq!(payload["updatedAt"], "2026-08-27T08:00:00Z");
}

#[test]
Expand All @@ -5363,6 +5371,26 @@ mod tests {
assert_eq!(items[0].repo, "acme/web");
}

#[test]
fn github_work_item_creation_time_reaches_frontend() {
for (kind, resource) in [("pr", "pull"), ("issue", "issues")] {
let json = r#"{
"number": 12,
"title": "Checkout",
"url": "https://github.com/acme/web/pull/12",
"state": "OPEN",
"createdAt": "2026-09-01T08:00:00Z",
"updatedAt": "2026-09-11T08:00:00Z"
}"#;
let json = json.replace("/pull/", &format!("/{resource}/"));
let item = parse_github_work_item(&json, kind, "acme/web").unwrap();
let payload = serde_json::to_value(item).unwrap();
assert_eq!(payload["kind"], kind);
assert_eq!(payload["createdAt"], "2026-09-01T08:00:00Z");
assert_eq!(payload["updatedAt"], "2026-09-11T08:00:00Z");
}
}

Comment thread
coderabbitai[bot] marked this conversation as resolved.
#[test]
fn parse_github_work_item_reads_view_shape() {
let json = r#"{
Expand Down
1 change: 1 addition & 0 deletions src/lib/githubTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type GithubWorkItem = {
title: string;
url: string;
state: string;
createdAt?: string;
updatedAt: string;
labels: GithubLabel[];
assignees: GithubAssignee[];
Expand Down
11 changes: 11 additions & 0 deletions src/surfaces/InboxView.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ function renderDetail(
}

describe("InboxDetail layout", () => {
it("shows when a PR was created alongside its last update", () => {
const markup = renderDetail({
...item({ kind: "pr" }),
createdAt: "2026-09-01T08:00:00Z",
});
expect(markup).toContain("Created ");
expect(markup).toContain('dateTime="2026-09-01T08:00:00Z"');
expect(markup).toContain("Updated ");
expect(renderDetail(item({ kind: "pr" }))).not.toContain("Created ");
});

it("keeps issue identity and actions outside the body scroller", () => {
const markup = renderDetail(item({ projectPath: "/tmp/local-project" }));
const headerIndex = markup.indexOf("data-inbox-detail-header");
Expand Down
11 changes: 11 additions & 0 deletions src/surfaces/InboxView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1685,6 +1685,17 @@ export function InboxDetail({
)}
</>
) : null}
{item.createdAt && formatRelativeTime(item.createdAt) ? (
<>
<span aria-hidden>·</span>
<time
dateTime={item.createdAt}
title={new Date(item.createdAt).toLocaleString()}
>
Created {formatRelativeTime(item.createdAt)}
</time>
</>
) : null}
{formatRelativeTime(item.updatedAt) ? (
<>
<span aria-hidden>·</span>
Expand Down
Loading