Skip to content

armgit / kwant

Public Imported from GitHub
0

Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.

0.7: direct commits show as normal landed cards; bigger phone targets on the Dev desk (#331)

Oleksandr Ivanchenko06a791f2b60e
diff --git a/frontend/src/components/DevDeskSlots.tsx b/frontend/src/components/DevDeskSlots.tsx
index 3dea55f0..d7e4dcad 100644
--- a/frontend/src/components/DevDeskSlots.tsx
+++ b/frontend/src/components/DevDeskSlots.tsx
@@ -59,7 +59,7 @@ export const Rollup: React.FC<RollupProps> = ({ cards = [], ...rest }) => {
export const LandedList: React.FC<LandedListProps> = ({ cards, reviews, now, onOpenReview }) => {
const parsed = useMemo(() => parseLandedCards(cards), [cards]);
const parsedReviews = useMemo(() => parseReviewCards(reviews), [reviews]);
- // Cards Iris's parser refuses (no PR number, wrong kind) still show, as the plain fallback row.
+ // Cards Iris's parser refuses (no PR number and no commit, wrong kind) still show, as the plain fallback row.
const refused = useMemo(() => cards.filter((c) => parseLanded(c) === null), [cards]);
return (
<>
diff --git a/frontend/src/components/dev/LandedCard.tsx b/frontend/src/components/dev/LandedCard.tsx
index 955fe7ae..c4718a74 100644
--- a/frontend/src/components/dev/LandedCard.tsx
+++ b/frontend/src/components/dev/LandedCard.tsx
@@ -1,5 +1,5 @@
import React from 'react';
-import { AlertTriangle, Check, ChevronRight, FileText, FlaskConical, GitMerge, Minus, ShieldCheck, X } from 'lucide-react';
+import { AlertTriangle, Check, ChevronRight, FileText, FlaskConical, GitCommitHorizontal, GitMerge, Minus, ShieldCheck, X } from 'lucide-react';
import { Sticker } from '../Sticker';
import type { LandedCard as Landed, LandedListProps, ReviewCard } from '../../dev/types';
import { byDay, clock, openFindings, riskReasons, showVerified } from '../../dev/logic';
@@ -10,7 +10,7 @@ const isTest = (path: string) => /(^|\/)(tests?|__tests__|e2e)\/|\.(test|spec)\.
const TESTS_ICON = { passed: Check, failed: X, none: Minus, unknown: Minus } as const;
const TESTS_TONE = { passed: 'text-ok', failed: 'text-bad', none: 'text-zinc-400', unknown: 'text-zinc-400' } as const;
-/** One merge in plain words (design §4). */
+/** One merge in plain words (design §4). A commit pushed without a PR (`pr: null`) is the same card, named by its commit. */
export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpenReview?: (pr: number) => void }> = ({ card, reviews = [], onOpenReview }) => {
const verified = showVerified(card, reviews);
const writer = personText(card.written_by);
@@ -20,16 +20,21 @@ export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpen
const del = files.reduce((n, f) => n + f.del, 0);
const openFollowUps = card.follow_ups;
// S1: a finding still open in this PR's review is something to do, even when CI and follow-ups are clear.
- const findingsOpen = openFindings(reviews.find((r) => r.pr === card.pr));
+ const pr = card.pr;
+ const findingsOpen = pr === null ? 0 : openFindings(reviews.find((r) => r.pr === pr));
const nothingToDo = openFollowUps.length === 0 && card.tests.state === 'passed' && findingsOpen === 0;
const TestsIcon = TESTS_ICON[card.tests.state];
const testsText =
card.tests.summary ?? (card.tests.state === 'passed' ? 'CI green' : card.tests.state === 'failed' ? 'CI failed' : card.tests.state === 'none' ? 'No CI checks' : 'CI not known');
const diff = card.links.commit ?? (card.links.pr ? `${card.links.pr}/files` : null);
- const headingId = `landed-${card.id || card.pr}-h`;
+ const headingId = `landed-${card.id || pr || card.sha}-h`;
+ const MergeIcon = pr === null ? GitCommitHorizontal : GitMerge;
+ // Where the card came from: "PR #n", or "Commit abc1234" for a direct commit.
+ const source = pr !== null ? { text: `PR #${pr}`, href: card.links.pr } : { text: `Commit ${card.sha}`, href: card.links.commit };
+ const github = card.links.pr ?? (pr === null ? card.links.commit : null);
return (
- <article data-dev-card="landed" data-pr={card.pr} data-verified={verified || undefined} aria-labelledby={headingId} className="kw-card relative min-w-0 p-4">
+ <article data-dev-card="landed" data-pr={pr ?? undefined} data-commit={pr === null ? card.sha : undefined} data-verified={verified || undefined} aria-labelledby={headingId} className="kw-card relative min-w-0 p-4">
<div className="flex flex-wrap items-center gap-1.5">
{card.area && <span className="kw-chip">{card.area}</span>}
{card.risk && <RiskChip level={card.risk.level} />}
@@ -45,9 +50,10 @@ export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpen
{card.headline}
</h3>
<div className="mt-1 flex flex-wrap items-center gap-x-1 gap-y-0.5 text-meta text-zinc-400">
- <GitMerge size={13} className="shrink-0 text-ok" aria-hidden="true" />
+ <MergeIcon size={13} className="shrink-0 text-ok" aria-hidden="true" />
<span>
- Merged{merged ? ` ${merged}` : ''}
+ {pr === null ? 'Committed' : 'Merged'}
+ {merged ? ` ${merged}` : ''}
{card.merged_by && (
<>
{' '}by <span className="font-medium text-zinc-100">{card.merged_by}</span>
@@ -63,12 +69,12 @@ export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpen
</>
)}
<span aria-hidden="true">·</span>
- {card.links.pr ? (
- <a href={card.links.pr} target="_blank" rel="noreferrer noopener" className="kw-focus rounded text-sky-300 hover:text-sky-200">
- PR #{card.pr}
+ {source.href ? (
+ <a href={source.href} target="_blank" rel="noreferrer noopener" className="kw-focus kw-hit rounded text-sky-300 hover:text-sky-200">
+ {source.text}
</a>
) : (
- <span>PR #{card.pr}</span>
+ <span>{source.text}</span>
)}
</div>
@@ -142,7 +148,7 @@ export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpen
<span className={`inline-flex items-center gap-1 ${TESTS_TONE[card.tests.state]}`}>
<TestsIcon size={13} aria-hidden="true" />
{card.links.ci ? (
- <a href={card.links.ci} target="_blank" rel="noreferrer noopener" className="kw-focus rounded hover:underline">
+ <a href={card.links.ci} target="_blank" rel="noreferrer noopener" className="kw-focus kw-hit rounded hover:underline">
{testsText}
</a>
) : (
@@ -157,14 +163,14 @@ export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpen
{findingsOpen} {findingsOpen === 1 ? 'finding' : 'findings'} open
</span>
<span className="text-zinc-400">in the review</span>
- {onOpenReview && (
+ {onOpenReview && pr !== null && (
<>
<span aria-hidden="true" className="text-zinc-400">
·
</span>
<button
type="button"
- onClick={() => onOpenReview(card.pr)}
+ onClick={() => onOpenReview(pr)}
className="kw-focus inline-flex min-h-[44px] items-center rounded text-sky-300 hover:text-sky-200 hover:underline sm:min-h-0"
>
Open review
@@ -174,13 +180,13 @@ export const LandedCard: React.FC<{ card: Landed; reviews?: ReviewCard[]; onOpen
</span>
)}
<span className="flex items-center gap-3 sm:ml-auto">
- {diff && (
- <a href={diff} target="_blank" rel="noreferrer noopener" className="kw-focus inline-flex min-h-[44px] items-center rounded text-sky-300 hover:text-sky-200 sm:min-h-0">
+ {diff && diff !== github && (
+ <a href={diff} target="_blank" rel="noreferrer noopener" className="kw-focus kw-hit inline-flex min-h-[44px] items-center rounded text-sky-300 hover:text-sky-200 sm:min-h-0">
Diff
</a>
)}
- {card.links.pr && (
- <OutLink href={card.links.pr} className="min-h-[44px] sm:min-h-0">
+ {github && (
+ <OutLink href={github} className="min-h-[44px] sm:min-h-0">
Open on GitHub
</OutLink>
)}
@@ -200,7 +206,7 @@ export const LandedList: React.FC<LandedListProps> = ({ cards, reviews, now = Da
<span aria-hidden="true" className="h-px flex-1 bg-hairline" />
</h3>
{day.cards.map((c) => (
- <LandedCard key={c.id || c.pr} card={c} reviews={reviews} onOpenReview={onOpenReview} />
+ <LandedCard key={c.id || c.pr || c.sha} card={c} reviews={reviews} onOpenReview={onOpenReview} />
))}
</section>
))}
diff --git a/frontend/src/dev/fixtures.ts b/frontend/src/dev/fixtures.ts
index 92b26242..d19c8828 100644
--- a/frontend/src/dev/fixtures.ts
+++ b/frontend/src/dev/fixtures.ts
@@ -40,6 +40,17 @@ export const LANDED_289 = row('dvc_289', {
follow_ups: [], verified: true, links: { pr: gh(289), commit: null, ci: null }, cut: null,
});
+/** B1: a commit pushed to the branch without a PR (poller.rs `pr: null`). The server's `verified: true` here is
+ * deliberately wrong: with no PR review the card must never get the sticker. */
+export const LANDED_DIRECT = row('dvc_c0ffee1', {
+ kind: 'landed', pr: null, sha: 'c0ffee1', merged_at: '2026-11-04T19:02:00Z', merged_by: null, written_by: { kind: 'person', name: 'Oleks' },
+ area: 'Docs', headline: 'Fix typo in README',
+ for_you: 'The install line in the README now names the right command. Nothing in the app changes.',
+ under_hood: { summary: 'One word fixed in the README.', files: [{ path: 'README.md', add: 1, del: 1 }] },
+ risk: { level: 'low', reasons: ['+1 −1 in 1 file'] }, tests: { state: 'passed', summary: '1 check passed' }, reviewed_by: null,
+ follow_ups: [], verified: true, links: { pr: null, commit: 'https://github.com/alexsergivan/kwant/commit/c0ffee1', ci: 'https://github.com/alexsergivan/kwant/actions/runs/1' }, cut: null,
+});
+
export const LANDED_290 = row('dvc_290', v290.landed);
export const LANDED_301 = row('dvc_301', v301.landed);
export const LANDED_303 = row('dvc_303', v303.landed);
diff --git a/frontend/src/dev/logic.ts b/frontend/src/dev/logic.ts
index 134ef81f..502d8d02 100644
--- a/frontend/src/dev/logic.ts
+++ b/frontend/src/dev/logic.ts
@@ -102,10 +102,10 @@ export const openFindings = (review: ReviewCard | null | undefined) => (review ?
* - someone reviewed it in kwant, and the reviewer is not the author;
* - no follow-up is open;
* - if the PR's review card is known, it has a reviewer who isn't the author and no open finding.
- * A pending or stale card never gets one.
+ * A pending or stale card, and a direct commit with no PR, never gets one.
*/
export function showVerified(card: LandedCard, reviews: ReviewCard[] = []): boolean {
- if (!card.verified || card.status === 'pending' || card.status === 'stale') return false;
+ if (card.pr === null || !card.verified || card.status === 'pending' || card.status === 'stale') return false;
if (card.tests.state !== 'passed') return false;
if (!card.reviewed_by || sameName(card.reviewed_by, card.written_by?.name)) return false;
if (card.follow_ups.length > 0) return false;
diff --git a/frontend/src/dev/types.ts b/frontend/src/dev/types.ts
index 62417860..c16f6f76 100644
--- a/frontend/src/dev/types.ts
+++ b/frontend/src/dev/types.ts
@@ -39,7 +39,8 @@ interface CardBase {
export interface LandedCard extends CardBase {
kind: 'landed';
- pr: number;
+ /** null for a commit that reached the branch without a PR (a direct push): the card names the commit instead. */
+ pr: number | null;
sha: string;
merged_at: string | null;
merged_by: string | null;
@@ -265,20 +266,22 @@ function links(v: unknown): DevLinks {
export function parseLanded(raw: unknown): LandedCard | null {
if (!isObj(raw) || raw.kind !== 'landed') return null;
+ // A direct commit has no PR (poller.rs builds it with `pr: null`); it still needs its commit to be named.
const pr = num(raw.pr);
- if (pr === null) return null;
+ const sha = (str(raw.sha, 40) ?? '').slice(0, 7);
+ if (pr === null && !/^[0-9a-f]{7}$/i.test(sha)) return null;
const uh = isObj(raw.under_hood) ? raw.under_hood : {};
const tests = isObj(raw.tests) ? raw.tests : {};
return {
...base(raw),
kind: 'landed',
pr,
- sha: (str(raw.sha, 40) ?? '').slice(0, 7),
+ sha,
merged_at: str(raw.merged_at, 64),
merged_by: str(raw.merged_by, 80),
written_by: person(raw.written_by),
area: str(raw.area, 60),
- headline: str(raw.headline, 200) ?? str(raw.title, 200) ?? `PR #${pr}`,
+ headline: str(raw.headline, 200) ?? str(raw.title, 200) ?? (pr !== null ? `PR #${pr}` : `Commit ${sha}`),
for_you: str(raw.for_you, 600),
under_hood: {
summary: str(uh.summary, 600),
@@ -294,7 +297,8 @@ export function parseLanded(raw: unknown): LandedCard | null {
.filter(isObj)
.map((f) => ({ text: str(f.text, 400) ?? '', ref: str(f.ref, 40) }))
.filter((f) => f.text),
- verified: raw.verified === true,
+ // Verified needs a PR review (§3.6 item 14): a direct commit never has one.
+ verified: pr !== null && raw.verified === true,
links: links(raw.links),
cut: str(raw.cut, 120),
meta: str(raw.meta, 80),
diff --git a/frontend/src/styles/modern.css b/frontend/src/styles/modern.css
index 19981b88..de8780dd 100644
--- a/frontend/src/styles/modern.css
+++ b/frontend/src/styles/modern.css
@@ -247,6 +247,7 @@
.kw-btn-primary the accent gradient button (one per view); .kw-btn-ghost a quiet button
.kw-status-dot a 8px dot; .kw-status-ok / -warn / -bad / -idle, .kw-pulse while something is live
.kw-focus the focus ring (2px accent, 2px offset); already on every .kw-card-interactive
+ .kw-hit a 44px tap area on phone for a small inline link, with no visual change
.kw-fade-in enters in 160ms (opacity + 6px slide); .kw-stagger delays children by --i * 40ms
Motion is 120-200ms, transform and opacity only, and off under prefers-reduced-motion.
------------------------------------------------------------------------------------------------ */
@@ -269,6 +270,19 @@
.kw-card-interactive:disabled {
@apply opacity-50 cursor-not-allowed;
}
+ /* .kw-hit: on phone, a small inline link gets a 44px tap area from an invisible ::before; nothing moves. */
+ @media (max-width: 639.98px) {
+ .kw-hit { position: relative; }
+ .kw-hit::before {
+ content: '';
+ position: absolute;
+ left: 50%;
+ top: 50%;
+ width: max(100%, 44px);
+ height: max(100%, 44px);
+ transform: translate(-50%, -50%);
+ }
+ }
.kw-card-interactive,
.kw-focus {
@apply focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-sky-400;
diff --git a/frontend/tests/devCards.test.mjs b/frontend/tests/devCards.test.mjs
index 2a25e967..5d7481c2 100644
--- a/frontend/tests/devCards.test.mjs
+++ b/frontend/tests/devCards.test.mjs
@@ -84,7 +84,8 @@ test('parsers keep the §3.6 nulls and reject other shapes', () => {
assert.equal(r.reviewer, null);
assert.match(r.note, /No reviewer/);
assert.equal(m.parseLanded({ kind: 'review', pr: 1 }), null);
- assert.equal(m.parseLanded({ kind: 'landed' }), null, 'no PR number');
+ assert.equal(m.parseLanded({ kind: 'landed' }), null, 'no PR number and no commit');
+ assert.equal(m.parseLanded({ kind: 'landed', pr: null, sha: 'nope' }), null, 'no PR and no real commit sha');
assert.equal(m.parseReview(null), null);
const odd = m.parseLanded({ ...fx.LANDED_289, links: { pr: 'javascript:alert(1)', commit: 'http://x', ci: null } });
assert.equal(odd.links.pr, null, 'only https links');
@@ -145,6 +146,49 @@ test('the landed card shows the holo sticker only when Verified', () => {
assert.match(no, /#288 N3/);
});
+test('B1: a direct commit (pr null) parses and draws as a normal landed card named by its commit', () => {
+ const c = m.parseLanded(fx.LANDED_DIRECT);
+ assert.ok(c, 'not refused');
+ assert.equal(c.pr, null);
+ assert.equal(c.sha, 'c0ffee1');
+ assert.equal(c.headline, 'Fix typo in README');
+ assert.equal(c.verified, false, 'no PR review, so never verified, whatever the server says');
+ assert.equal(m.showVerified({ ...c, verified: true }), false, 'the sticker rule refuses a pr-less card too');
+ assert.equal(m.parseLanded({ ...fx.LANDED_DIRECT, headline: null }).headline, 'Commit c0ffee1', 'headline falls back to the commit');
+ const out = html(m.LandedCard, { card: c, reviews: [{ ...m.parseReview(fx.REVIEW_289), pr: 0 }], onOpenReview: () => {} });
+ assert.match(out, /data-dev-card="landed"/);
+ assert.match(out, /data-commit="c0ffee1"/);
+ assert.doesNotMatch(out, /data-pr=/);
+ assert.match(out, /<a href="https:\/\/github\.com\/alexsergivan\/kwant\/commit\/c0ffee1"[^>]*>Commit c0ffee1<\/a>/);
+ assert.doesNotMatch(out, /PR #/);
+ assert.match(out, /Committed 19:02/);
+ assert.doesNotMatch(out, />Verified</);
+ assert.doesNotMatch(out, /data-verified/);
+ assert.doesNotMatch(out, /text-warn|kw-chip-warn|amber/, 'no warning tone: like an old merge with no reviewer');
+ assert.match(out, /No bot review/);
+ assert.match(out, /Fix typo in README/);
+ assert.match(out, /What changes for you/);
+ assert.match(out, /Open on GitHub/, 'GitHub link goes to the commit');
+ assert.doesNotMatch(out, />Diff</, 'no second link to the same commit');
+ assert.doesNotMatch(out, /This card couldn/);
+ const list = html(m.LandedList, { cards: [landed(fx.LANDED_DIRECT), landed(fx.LANDED_288)], reviews: [], now: NOW });
+ assert.equal([...list.matchAll(/data-dev-card="landed"/g)].length, 2);
+});
+
+test('N2: the PR chip, the checks line and Diff get the phone tap area (kw-hit); the CSS is phone-only', async () => {
+ const out = html(m.LandedCard, { card: landed(fx.LANDED_288, { links: { ...fx.LANDED_288.links, ci: 'https://github.com/alexsergivan/kwant/actions/runs/2' } }) });
+ assert.match(out, /class="[^"]*kw-hit[^"]*"[^>]*>PR #288</);
+ assert.match(out, /class="[^"]*kw-hit[^"]*"[^>]*>3 checks passed</);
+ assert.match(out, /class="[^"]*kw-hit[^"]*"[^>]*>Diff</);
+ const { readFile } = await import('node:fs/promises');
+ const css = await readFile(new URL('../src/styles/modern.css', import.meta.url), 'utf8');
+ const block = css.slice(css.indexOf('@media (max-width: 639.98px)'), css.indexOf('.kw-card-interactive,'));
+ assert.match(block, /\.kw-hit::before/);
+ assert.match(block, /width: max\(100%, 44px\)/);
+ assert.match(block, /height: max\(100%, 44px\)/);
+ assert.doesNotMatch(css.replace(block, ''), /\.kw-hit(::before)?\s*\{/, 'no kw-hit rule outside the phone query');
+});
+
test('the landed card: plain words, the details fold, a failed card and day separators', () => {
const c = html(m.LandedCard, { card: landed(fx.LANDED_288) });
assert.match(c, /What changes for you/);
diff --git a/frontend/tests/devDeskWire.test.mjs b/frontend/tests/devDeskWire.test.mjs
index 2546ced2..ccea7063 100644
--- a/frontend/tests/devDeskWire.test.mjs
+++ b/frontend/tests/devDeskWire.test.mjs
@@ -39,7 +39,7 @@ const h = React.createElement;
// Demo data only. One open finding on #289's review, so its landed card offers "Open review".
const finding = fx.REVIEW_294.findings[0];
const reviewsRoute = { cards: [fx.REVIEW_290, { ...fx.REVIEW_289, findings: [finding] }, { id: 'dvr_bad', kind: 'review', status: 'ready', title: 'No PR number' }] };
-const landedRoute = { ...fx.LANDED_ROUTE, cards: [...fx.LANDED_ROUTE.cards, { id: 'dvc_bad', kind: 'landed', status: 'ready', headline: 'A card without a PR' }] };
+const landedRoute = { ...fx.LANDED_ROUTE, cards: [...fx.LANDED_ROUTE.cards, fx.LANDED_DIRECT, { id: 'dvc_bad', kind: 'landed', status: 'ready', headline: 'A card without a PR' }] };
let routes = { landed: landedRoute, reviews: reviewsRoute };
g.fetch = g.window.fetch = async (url) => {
const u = String(url);
@@ -85,8 +85,14 @@ test('slot swap: What landed draws Iris’s rollup and landed cards; a card she
assert.ok(host.querySelector('[data-dev-landed-list]'), 'Iris’s LandedList');
assert.equal(host.querySelector('[data-dev-slot]'), null, 'no placeholder cards are left');
assert.match(host.textContent, /changes? landed on main/, 'Iris’s rollup title, with the branch');
- const prs = [...host.querySelectorAll('[data-dev-card="landed"]')].map((c) => Number(c.getAttribute('data-pr')));
+ const prs = [...host.querySelectorAll('[data-dev-card="landed"][data-pr]')].map((c) => Number(c.getAttribute('data-pr')));
assert.deepEqual(prs.sort(), [288, 289, 290, 301, 303]);
+ // B1: a commit pushed without a PR is a normal landed card, not the fallback row
+ const direct = host.querySelector('[data-dev-card="landed"][data-commit="c0ffee1"]');
+ assert.ok(direct, 'the direct commit draws as a landed card');
+ assert.match(direct.textContent, /Fix typo in README/);
+ assert.match(direct.textContent, /Commit c0ffee1/);
+ assert.equal(direct.querySelector('[data-verified]'), null);
const fallback = host.querySelectorAll('[data-dev-card="fallback"]');
assert.equal(fallback.length, 1);
assert.match(fallback[0].textContent, /A card without a PR · This card couldn’t be shown\./);