<feed xmlns='http://www.w3.org/2005/Atom'>
<title>hutch.git/HutchTests, branch main</title>
<subtitle>ios client for sourcehut. swiftui.
</subtitle>
<id>http://git.krz.sh/krz/hutch.git/atom?h=main</id>
<link rel='self' href='http://git.krz.sh/krz/hutch.git/atom?h=main'/>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/'/>
<updated>2026-08-02T14:28:56+00:00</updated>
<entry>
<title>Update test fixtures to root@krz.sh email</title>
<updated>2026-08-02T14:28:56+00:00</updated>
<author>
<name>Christian Cleberg</name>
<email>hello@cleberg.net</email>
</author>
<published>2026-08-02T14:28:04+00:00</published>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/commit/?id=04fae8d7fb3726b4d1b4c2576ece04766d2afe74'/>
<id>urn:sha1:04fae8d7fb3726b4d1b4c2576ece04766d2afe74</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix: move the S1186 empty-block comments inside the braces</title>
<updated>2026-07-16T16:13:13+00:00</updated>
<author>
<name>Christian Cleberg</name>
<email>hello@cleberg.net</email>
</author>
<published>2026-07-16T16:13:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/commit/?id=d73c6ac381baac0ae8b0d5dfc551165591115905'/>
<id>urn:sha1:d73c6ac381baac0ae8b0d5dfc551165591115905</id>
<content type='text'>
Trailing // comments after {} left the block lexically empty, so
SonarCloud kept flagging stopLoading (and would have re-flagged the two
Cancel buttons). S1186 wants a *nested* comment; use /* ... */ inside.
</content>
</entry>
<entry>
<title>chore: clear the actionable SonarCloud code smells</title>
<updated>2026-07-16T15:18:40+00:00</updated>
<author>
<name>Christian Cleberg</name>
<email>hello@cleberg.net</email>
</author>
<published>2026-07-16T15:18:40+00:00</published>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/commit/?id=e93972f39150e5e590e49aaf46a369c463277c30'/>
<id>urn:sha1:e93972f39150e5e590e49aaf46a369c463277c30</id>
<content type='text'>
- S1871: merge the identical .home / .recentActivity deep-link cases in
  RootView — recent activity is a section of Home, not its own screen.
- S1186: comment the two intentionally-empty Cancel buttons
  (PatchsetDetailView, TicketDetailView) and the empty URLProtocol
  stopLoading override in APICacheTests.
- S108: comment the expected-miss catch block in APICacheTests.
- S1172: rename the unused url parameter in mimeType(for:) to _.
- S4624: extract the nested template literal in the deep-link builders
  (background.js, content.js) to a pathSegment variable.

Left as Won't Fix, with reasons: the 35 hardcoded-URI warnings (a
one-forge client and its literal-URL tests), executeCached's 8 params
(38 call sites, no benefit), the forceRefresh S1172 pair (fixed as a
real bug instead), S1481 on ArtifactsView (false positive — $vm.error
is used), and S7785 (top-level await would break a classic content
script).
</content>
</entry>
<entry>
<title>Merge pull request #5 from zerolabsco/inbox-unread-baseline</title>
<updated>2026-07-16T04:27:03+00:00</updated>
<author>
<name>Christian Cleberg</name>
<email>hello@cleberg.net</email>
</author>
<published>2026-07-16T04:27:03+00:00</published>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/commit/?id=0ad430c79eedac4140680e3aaca238969ac711b1'/>
<id>urn:sha1:0ad430c79eedac4140680e3aaca238969ac711b1</id>
<content type='text'>
Start a new account at zero unread</content>
</entry>
<entry>
<title>fix: derive inbox activity from mail, not thread.updated</title>
<updated>2026-07-16T04:18:20+00:00</updated>
<author>
<name>Christian Cleberg</name>
<email>hello@cleberg.net</email>
</author>
<published>2026-07-16T04:18:20+00:00</published>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/commit/?id=97e8b49fcb56751fa0e80a332484db8252753417'/>
<id>urn:sha1:97e8b49fcb56751fa0e80a332484db8252753417</id>
<content type='text'>
Thread.updated is the root email's insert time. It never advances when a reply
arrives, despite the name and despite the schema describing threads as ordered
"most recently bumped". sr.ht returns updated seven seconds after root.date on
a thread carrying four replies:

    subject: "Re: test post"
    updated: 2026-07-16T03:44:55Z
    replies: 4
    root:    { date: 2026-07-15T22:44:48-05:00 }

The app fed that field into lastActivityAt everywhere, so a reply to an old
thread was invisible: it did not mark the thread unread, did not raise it in the
list, and did not update the timestamp beside it.

This was inert until the unread baseline landed, because an absent view record
returned unread unconditionally and the date was never compared to anything. The
baseline did not break unread; it was the first code to depend on that field
meaning what it says.

Use MailingList.emails instead, which is real reverse-chronological arrival
data, keyed by thread root id. The scan stops once it is older than the cutoff,
so a quiet list costs one page and a busy one costs only what is new. Threads
with nothing in the window keep the root timestamp and stay read, which they
already were. Failure returns empty activity rather than throwing: unread is a
decoration and should not take the thread list down with it.

Uses Email.received rather than Email.date — received is server-side and
non-null, date comes from the sender's header and is neither.
</content>
</entry>
<entry>
<title>fix: start a new account at zero unread</title>
<updated>2026-07-16T03:38:55+00:00</updated>
<author>
<name>Christian Cleberg</name>
<email>hello@cleberg.net</email>
</author>
<published>2026-07-16T03:38:22+00:00</published>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/commit/?id=3611d941247a7163fce9c61d8f75a81ddedd90b7'/>
<id>urn:sha1:3611d941247a7163fce9c61d8f75a81ddedd90b7</id>
<content type='text'>
An absent view record read as unread, so on first sign-in every thread a list
had ever carried was unread. On a busy list that is thousands of threads the
user never intended to read, inflating the Home dashboard, the needs-attention
snapshot, and the widget with a number that means nothing.

Record a baseline when an account is activated: mail that predates it is read,
mail after it is not. activate() is the single funnel for launch validation,
account switching, and adding an account, so one call covers every sign-in path.

Accounts that already carry read state have been in use, so they get a
distantPast baseline and keep every unread thread they had — upgrading must not
silently mark a real backlog as read.

markUnread now records an explicit distantPast marker instead of deleting the
entry. Deleting would drop the thread back to the baseline rule, so marking an
old thread unread would appear to do nothing.
</content>
</entry>
<entry>
<title>feat: review patchsets</title>
<updated>2026-07-16T02:48:58+00:00</updated>
<author>
<name>Christian Cleberg</name>
<email>hello@cleberg.net</email>
</author>
<published>2026-07-16T02:48:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/commit/?id=0eceec357b7ef5251ed0ae9d42b513c17380e0af'/>
<id>urn:sha1:0eceec357b7ef5251ed0ae9d42b513c17380e0af</id>
<content type='text'>
Patchsets are how contributions reach sourcehut, and Hutch had no reference to
them anywhere. This adds review and triage: read a series, see its checks and
version chain, and set its status.

Two schema facts shaped the design.

MailingList exposes no patchsets field, so a list's patchsets cannot be queried
directly. They are reachable only through thread roots, so the existing threads
query now also selects root.patchset — no extra request — and the Patches tab is
derived from that. It appears only on lists that actually carry patches.

Patch carries no diff. index, count, version, prefix, subject, and trailers are
all it has; the diff exists only inside the email body. Patch bodies are split
with the same InboxThreadUtilities.segmentMessageBody the inbox uses and
rendered through the existing DiffView.

Patches are ordered by their [PATCH n/m] index rather than receipt order, since
mail arrives out of sequence. Patches with no index are kept at the end rather
than dropped, because a one-off patch has no prefix.

updatePatchset is nullable, so a null response is treated as a declined change
and the local status is left alone rather than advanced optimistically. UNKNOWN
and SUPERSEDED are not offered: the first is a sentinel, the second is set by
the server when a newer version lands.

Patch submission stays out of scope. It is a git send-email flow, not a GraphQL
mutation.
</content>
</entry>
<entry>
<title>refactor: share the email body diff splitter</title>
<updated>2026-07-16T02:42:38+00:00</updated>
<author>
<name>Christian Cleberg</name>
<email>hello@cleberg.net</email>
</author>
<published>2026-07-16T02:42:38+00:00</published>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/commit/?id=ccec322f8eac4d14638f5abdae7dae7abc95eb7e'/>
<id>urn:sha1:ccec322f8eac4d14638f5abdae7dae7abc95eb7e</id>
<content type='text'>
segmentMessageBody and its helpers were private to ThreadViewModel, reachable
from tests only through a segmentMessageBodyForTesting shim. Patchset review
needs the same splitting, because sr.ht's Patch type carries no diff — the diff
only exists inside the email body — so this has to be shared rather than
duplicated.

Moved to InboxThreadUtilities. The shim is gone; the existing test calls the
real function directly now.

Also adds the Patchset model layer that the coming views build on.
</content>
</entry>
<entry>
<title>Phase 1: close the write gaps (#3)</title>
<updated>2026-07-16T02:33:59+00:00</updated>
<author>
<name>Christian Cleberg</name>
<email>hello@cleberg.net</email>
</author>
<published>2026-07-16T02:33:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/commit/?id=b9ec80716ea015de5b6b31395fdc5ff03191398c'/>
<id>urn:sha1:b9ec80716ea015de5b6b31395fdc5ff03191398c</id>
<content type='text'>
* refactor: collapse duplicated request paths in SRHTClient

Five request paths each repeated the token guard, header setup, status-code
handling, and a ~35-line #if DEBUG logging block. The file carried that block
five times over.

Extract makeAuthorizedRequest, send, and encodedGraphQLBody, and route execute,
executeAndCache, executeMultipartFiles, and performGraphQLRequest through them.
executeMultipart is now the single-file case of executeMultipartFiles, which it
already was byte for byte. 938 lines to 612, with one copy of the logging block.

fetchText keeps its own guard: it is a GET to an allowlisted URL and must not
run GraphQL error checks over what is usually a plain-text build log.

One behavior change falls out. executeAndCache wrote the raw response to the
cache before decoding, so a 200 carrying GraphQL errors was cached and then
thrown. Routing it through performGraphQLRequest surfaces those errors first,
so error payloads are no longer cached.

* feat: edit and delete tickets

updateTicket and deleteTicket both existed in todo.sr.ht's API but were never
called, so a ticket could be filed and its status changed but its subject and
body were frozen from the moment it was created, and it could never be removed.

Edit opens a sheet seeded with the current subject and body. The input carries
only fields that actually changed, so an edit cannot clobber a field the user
did not touch, and Save stays disabled until something differs.

Clearing the body sends an explicit null via updateValue rather than a nil
subscript assignment, which would drop the key and silently leave the old body
in place — the same trap fixed for repository descriptions in 7ffef07.

Delete is destructive and irreversible, so it sits behind a confirmation
dialog naming the ticket and pops the detail view on success.

* feat: subscribe to and unsubscribe from tickets

ticketSubscribe and ticketUnsubscribe existed in the API but were never called,
so email notifications for a ticket could only be managed on the web.

Ticket.subscription is null when the user is not subscribed, so the detail
query now reads it and the menu reflects real server state rather than
guessing. The toggle updates optimistically and reverts on failure, so the
control never claims a subscription that did not take.

Decoded into the private payload rather than TicketDetail, which is Codable and
cached — adding a field there would have changed the cached shape and touched
every optimistic-update construction site.

* feat: subscribe to and unsubscribe from trackers

trackerSubscribe and trackerUnsubscribe existed in the API but were never
called. Tracker.subscription is null when not subscribed, so the state can be
read rather than guessed.

The read is a separate uncached query. The tickets query it sits beside is
paginated and cached, and a per-user subscription has no business riding along
in page payloads or being served stale from disk.

Unsubscribe passes tickets: false, so leaving a tracker does not silently drop
subscriptions to individual tickets the user opted into.

* feat: unsubscribe from mailing lists

mailingListUnsubscribe existed in the API but was never called, so the list of
subscriptions was readable and nothing more.

Scoped to unsubscribe. MailingList has no subscription field, unlike Ticket and
Tracker, so per-list state is only knowable from the subscriptions query — which
is exactly what builds this view. Subscribing would need a list the user is by
definition not subscribed to, and sr.ht exposes no discovery API to find one
(see SCOPE.md on hub.sr.ht), so there is nowhere honest to put that action yet.

The row is removed optimistically and restored if the mutation fails. The
confirmation says plainly that Hutch cannot resubscribe, since it cannot.

* feat: manage todo and lists email preferences

updatePreferences existed on both services but was never called, so these were
web-only settings.

The two services expose preferences/updatePreferences under identical names but
with different fields — notifySelf on todo, copySelf on lists — and there is no
shared preferences service, so both are read and written side by side. They load
concurrently and one service being unreachable does not hide the other's toggle.

These are server-side and apply beyond Hutch, unlike the @AppStorage toggles
above them in Settings, so the footer says so and each toggle reverts if its
mutation fails.

* refactor: drop the memory-only cache path

Two executeCached overloads existed with different return types and semantics:
one doing stale-while-revalidate against the persistent cache with TTLs, the
other only consulting the in-memory responseCache. The second was an easy thing
to reach for by mistake, since the compiler picked it purely on argument labels.

It turned out to be dead. All 38 call sites already used the TTL-aware
overload, and the memory-only one was the sole caller of executeAndCache, so
both are removed. Its doc comment promised refresh "via the onRefresh callback",
which the signature has not had for some time.

SRHTClient is now 569 lines, down from 938 before this branch.

responseCache stays as the in-memory layer behind cachedPayload and the three
view models that read it directly.

* chore: bump to 3.6.0 and record Phase 1

MARKETING_VERSION 3.5.0 -&gt; 3.6.0, build 87 -&gt; 88.

* fix: decode preferences responses on the main actor

The module sets SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor, so the response
types are implicitly main-actor isolated and their Decodable conformances are
too. Decoding straight from an `async let` used those conformances from a
nonisolated context, which warns today and is an error in the Swift 6 language
mode.

Move each fetch into its own method and `async let` over those instead, so
decoding stays on the main actor. This is what HomeViewModel.loadDashboard
already does, and the concurrency is unaffected — the network work still
overlaps, since execute suspends and frees the actor.</content>
</entry>
<entry>
<title>test: match cached incident fixture to its RSS source</title>
<updated>2026-07-16T00:28:21+00:00</updated>
<author>
<name>Christian Cleberg</name>
<email>hello@cleberg.net</email>
</author>
<published>2026-07-16T00:28:21+00:00</published>
<link rel='alternate' type='text/html' href='http://git.krz.sh/krz/hutch.git/commit/?id=07b269c82f4d45af44ab7097e4a7cd5953c2af94'/>
<id>urn:sha1:07b269c82f4d45af44ab7097e4a7cd5953c2af94</id>
<content type='text'>
The expected incident declared url: nil while the cachedIncidentRSS it stands
in for carries &lt;link&gt;https://status.sr.ht/issues/1/&lt;/link&gt;, so the fixture
contradicted its own input. The repository parses and persists the link
correctly.
</content>
</entry>
</feed>
