<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: JASHANPREET KAUR</title>
    <description>The latest articles on DEV Community by JASHANPREET KAUR (@jashanpreet_kaur_917e774f).</description>
    <link>https://dev.to/jashanpreet_kaur_917e774f</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4147825%2Fcaad94be-a772-409f-ad22-bafc06c88378.png</url>
      <title>DEV Community: JASHANPREET KAUR</title>
      <link>https://dev.to/jashanpreet_kaur_917e774f</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jashanpreet_kaur_917e774f"/>
    <language>en</language>
    <item>
      <title>Bug Graveyard: where fixed bugs are buried, and regressions rise as zombies</title>
      <dc:creator>JASHANPREET KAUR</dc:creator>
      <pubDate>Tue, 29 Sep 2026 09:06:15 +0000</pubDate>
      <link>https://dev.to/jashanpreet_kaur_917e774f/bug-graveyard-where-fixed-bugs-are-buried-and-regressions-rise-as-zombies-5hcf</link>
      <guid>https://dev.to/jashanpreet_kaur_917e774f/bug-graveyard-where-fixed-bugs-are-buried-and-regressions-rise-as-zombies-5hcf</guid>
      <description>&lt;p&gt;&lt;em&gt;This is a submission for the &lt;a href="https://dev.to/challenges/sanity-2026-09-16"&gt;Sanity Challenge, Path Two: Vibe-Code Something Strange&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;🪦 TL;DR for judges&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Write-up (quality and honesty):&lt;/strong&gt; My Build Process has the prompts that worked, the one that didn't, every place it got stuck, and what's &lt;em&gt;not&lt;/em&gt; live. The full Claude Code session is embedded below.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Working app:&lt;/strong&gt; the &lt;a href="https://bug-graveyard.vercel.app" rel="noopener noreferrer"&gt;live site&lt;/a&gt; needs no login. Open a zombie's past lives, check Most Haunted, and &lt;a href="https://bug-graveyard.vercel.app/report" rel="noopener noreferrer"&gt;report a dead bug yourself&lt;/a&gt;: an AI coroner drafts its epitaph within seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Schema:&lt;/strong&gt; a zombie is a whole new &lt;code&gt;bug&lt;/code&gt; that points to its previous life, "disturbed" graves are worked out in GROQ, and AI suggestions and public reports sit in separate fields until a person approves them. See Sanity Project Details.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Creativity:&lt;/strong&gt; regressions rise from their graves as zombies, and an AI coroner writes the epitaphs (but never gets the last word).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Beyond the Studio (bonus):&lt;/strong&gt; custom Studio actions, a live Tombstone view and sidebar · the Morgue, an App SDK app · two Sanity Functions (a daily gravedigger and the coroner) · an Agent Action (Prompt) · a Workflows experiment on a branch (not live).&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;  &lt;iframe src="https://www.youtube.com/embed/Tdj_If8i3Ls" width="710" height="399"&gt;
  &lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A 90-second tour: the site, the Studio's lifecycle actions and Tombstone view, the AI coroner and the Morgue. The Studio scenes use temporary test bugs, deleted afterwards.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What I Built
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Bug Graveyard&lt;/strong&gt; is a memorial site for the bugs we fixed.&lt;/p&gt;

&lt;p&gt;Every fixed bug gets a tombstone with its dates, cause of death and an epitaph. Most of them stay dead. But some come back (a regression), and when they do, they &lt;strong&gt;rise from their grave as a zombie&lt;/strong&gt;, linked to the life they had before. The old grave is left disturbed and empty.&lt;/p&gt;

&lt;p&gt;A few of the residents:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The 0.1 + 0.2 invoice&lt;/strong&gt;: &lt;em&gt;"Owed ₹0.30000000000000004. Paid in full."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Timezone bug in scheduler (Zombie #2)&lt;/strong&gt;: &lt;em&gt;"Every time zone. Every time."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt; HEAD in production&lt;/strong&gt;: &lt;em&gt;"Both versions were right. Neither survived."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The graves are classic bugs that every developer has met at some point: off-by-one errors, &lt;code&gt;0.1 + 0.2&lt;/code&gt;, the div that won't centre. They aren't a record of my own personal disasters, and their dates are made up but realistic.&lt;/p&gt;

&lt;p&gt;The idea is one joke taken literally: a regression is a bug that came back from the dead, so here it comes back as a zombie. Most of the work went into modelling that lifecycle properly in Sanity, not just drawing tombstones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;🪦 &lt;strong&gt;Live site:&lt;/strong&gt; &lt;a href="https://bug-graveyard.vercel.app" rel="noopener noreferrer"&gt;https://bug-graveyard.vercel.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8iz0ydqt14q8fr7s6xpp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8iz0ydqt14q8fr7s6xpp.png" alt="The Bug Graveyard homepage: language and cause-of-death filters above rows of tombstones under a full moon, including two glowing green zombie stones and one knocked-over, empty grave" width="800" height="722"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The graveyard shows three kinds of stone:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Resting:&lt;/strong&gt; fixed, and it stayed fixed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Disturbed:&lt;/strong&gt; knocked over, with a crossed-out R.I.P. and an empty hole. The bug rose again.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zombie:&lt;/strong&gt; cracked, glowing green, "Risen" and "still walking".&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can filter the graves by language or cause of death. Click any stone to open its grave page: a death certificate (cause of death, severity, hours to kill, killed by) and its &lt;strong&gt;past lives&lt;/strong&gt;. The timezone bug is on its third life, and each life starts on a real daylight-saving switch (30 March 2025, 26 October 2025 and 29 March 2026), because of course it does.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmncqldcxhhr28clflopi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmncqldcxhhr28clflopi.png" alt="The grave page of " width="800" height="746"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;Most Haunted&lt;/strong&gt; leaderboard ranks the deadliest bugs (by the hours it took to kill them), the languages with the most zombies, the most common causes of death and the most resurrected chain.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1jixf5wy7l3mn762askj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1jixf5wy7l3mn762askj.png" alt="The Most Haunted leaderboard: the most resurrected chain, the deadliest bugs, the most haunted languages and the most common causes of death" width="800" height="942"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Try it: report a dead bug
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://bug-graveyard.vercel.app/report" rel="noopener noreferrer"&gt;report page&lt;/a&gt; lets anyone add a bug. It becomes a suspected-dead bug, the coroner drafts its epitaph within seconds, and it waits under "Awaiting the coroner's approval" until I accept it in the Studio. Only then does it join the graveyard.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyhdc1f59grsli0aj3ffg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyhdc1f59grsli0aj3ffg.png" alt="The " width="800" height="556"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The report page with a test report (deleted afterwards).&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Every report costs an AI credit, so the form is guarded like any public form that costs money:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a honeypot field that bots fill in and people never see;&lt;/li&gt;
&lt;li&gt;3 reports per visitor and 25 in total a day, counted in private documents (a dot in the ID keeps them out of the public API), with the visitor's IP stored only as a keyed hash;&lt;/li&gt;
&lt;li&gt;length limits, no links, and a profanity filter on both the reports and the AI's drafts before they're shown.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The daily cap keeps a month at 25 × 31 = 775 credits at most (plus a rare retry), under the 1,000 free AI credits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Inside the Studio
&lt;/h3&gt;

&lt;p&gt;This is where most of the Sanity work lives.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. A bug's life, as custom document actions.&lt;/strong&gt; A bug moves through &lt;code&gt;💀 suspected dead → 🩹 fix merged → 🪦 buried&lt;/code&gt;. Three custom document actions drive it, and they sit right after Publish in the document's "…" menu:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;🩹 Mark fix merged&lt;/strong&gt; sets the status and stamps today's date (in UTC) as the fix date.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🪦 Declare buried&lt;/strong&gt; stays disabled until the fix has held for &lt;strong&gt;7 days&lt;/strong&gt;. Until then its label is a countdown like &lt;em&gt;"Can bury in 4 days"&lt;/em&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;🧟 Report resurrection&lt;/strong&gt; asks &lt;em&gt;"Are you sure? This bug will rise from its grave."&lt;/em&gt;, then creates a new, already published zombie linked to the old grave, and opens it so you can write its epitaph.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqvsanuexadi3s9ubqrn4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fqvsanuexadi3s9ubqrn4.png" alt="The Studio's " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A (temporary) bug whose fix merged 3 days ago: it can't be buried yet, but it can still come back.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. A live Tombstone view.&lt;/strong&gt; Every bug opens with two tabs, "Editor" and "🪦 Tombstone". The Tombstone tab renders the &lt;em&gt;same&lt;/em&gt; React component the website uses. In split pane the stone updates on every keystroke, with an epitaph counter (140 characters max).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9vgy1gl4l6727fjk0dsu.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9vgy1gl4l6727fjk0dsu.gif" alt="Sanity Studio in split pane: typing a new epitaph in the form updates the tombstone on the right, and switching the status to Zombie makes the stone crack and glow green" width="719" height="488"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The Studio in split pane: the form on the left, the live 🪦 Tombstone view on the right. (This is a throwaway test bug, deleted afterwards.)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. A graveyard sidebar:&lt;/strong&gt; 🪦 All graves, 🗳️ Public reports, 🧟 Zombies, 💀 Suspected dead, 🩹 Fix merged and ⚰️ Buried, then Languages and Causes of death.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;

&lt;p&gt;💻 &lt;strong&gt;Repository:&lt;/strong&gt; &lt;a href="https://github.com/jashanpreet-k/bug-graveyard" rel="noopener noreferrer"&gt;https://github.com/jashanpreet-k/bug-graveyard&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Where to look:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;sanity/actions/lifecycle.tsx&lt;/code&gt;: the three document actions&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sanity/schemaTypes/bug.ts&lt;/code&gt;: the bug schema&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sanity/lib/queries.ts&lt;/code&gt;: every GROQ query, typed with Sanity TypeGen&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;sanity/components/TombstoneView.tsx&lt;/code&gt; and &lt;code&gt;components/Tombstone.tsx&lt;/code&gt;: the Studio view and the stone it shares with the site&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;apps/morgue/&lt;/code&gt;: the Morgue, an App SDK app (see below)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;functions/&lt;/code&gt; and &lt;code&gt;sanity.blueprint.ts&lt;/code&gt;: the gravedigger and coroner Sanity Functions (see below)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;app/(site)/report/&lt;/code&gt;: the public report page and its server action (all the checks above)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;NOTES.md&lt;/code&gt;: the phase-by-phase build log this post is based on&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  My Build Process
&lt;/h2&gt;

&lt;p&gt;I built Bug Graveyard with &lt;strong&gt;Claude Code&lt;/strong&gt; (in VS Code), one phase at a time: setup, schema, homepage, grave page, first deploy, lifecycle actions, the Studio view, the leaderboard and importer, content, and a polish pass. For each phase I wrote the brief, tested the result in the browser, and decided what to keep or change. Claude Code wrote most of the code, ran the builds, tests and deploys, and added an entry to a build log (&lt;code&gt;NOTES.md&lt;/code&gt;) at the end of every phase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Stack:&lt;/strong&gt; Next.js 16 (App Router, TypeScript, Tailwind CSS v4), Sanity Studio v5 embedded at &lt;code&gt;/studio&lt;/code&gt;, &lt;code&gt;next-sanity&lt;/code&gt;, deployed on Vercel.&lt;/p&gt;

&lt;h3&gt;
  
  
  The prompts that worked
&lt;/h3&gt;

&lt;p&gt;Short phase briefs with explicit rules and a test step. Here's part of the Phase 5 brief, for the lifecycle actions:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;2. "🪦 Declare buried": enabled only when status = fix-merged AND at least 7 days have passed since fixMergedAt. When disabled, the label/title says how many days are left (e.g. "Can bury in 4 days"). Sets status = buried and buriedAt = today, then publishes.&lt;/p&gt;

&lt;p&gt;Rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use dates in UTC like the rest of the app.&lt;/li&gt;
&lt;li&gt;Handle drafts correctly (act on the published doc, don't leave stray drafts).&lt;/li&gt;
&lt;li&gt;Make the 7-day rule a single constant so I can mention it in the write-up.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Test it end to end with temporary test bugs (delete them after) …&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Claude Code tested that phase against a production build, with headless Chrome clicking the real Studio buttons: 34 checks across five temporary bugs, which were all deleted afterwards. It also went beyond the brief in a couple of places, and I kept those changes. My brief said each action should "then publish". Instead, the actions write straight to the published document in one change guarded by its revision, and they're disabled while the bug has unpublished edits, because that draft would later overwrite the new status. And "Mark fix merged" also works on a zombie, so a zombie can start a lifecycle of its own.&lt;/p&gt;

&lt;h3&gt;
  
  
  The one that didn't
&lt;/h3&gt;

&lt;p&gt;Before the polish pass, I asked Claude Code to look through the other projects on my Mac for bugs I'd really fixed, so that a few graves could be real. It found no bug-fix commits to use. So I dropped that and kept the classic bugs.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where it got stuck, and how we course-corrected
&lt;/h3&gt;

&lt;p&gt;Most of these only showed up in a production build or on the live site, not in &lt;code&gt;npm run dev&lt;/code&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Publishing didn't reach the site.&lt;/strong&gt; In a production build, publishing from the Studio didn't update the site, and an open tab stayed one change behind. There were two causes. The Studio route had no &lt;code&gt;&amp;lt;SanityLive /&amp;gt;&lt;/code&gt; to clear the cache, and in production next-sanity revalidates with the &lt;code&gt;'max'&lt;/code&gt; cache profile, which serves the stale page one more time. The fix: &lt;code&gt;&amp;lt;SanityLive /&amp;gt;&lt;/code&gt; in the Studio layout too, plus a custom action that calls &lt;code&gt;updateTag&lt;/code&gt;, which expires the cache immediately. &lt;code&gt;npm run dev&lt;/code&gt; hid both problems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The first Vercel deploy failed&lt;/strong&gt; with &lt;code&gt;No Output Directory named "dist" found&lt;/code&gt;. The Vercel project had been created with the "Other" framework preset. A &lt;code&gt;vercel.json&lt;/code&gt; that sets &lt;code&gt;"framework": "nextjs"&lt;/code&gt; fixed it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scripts silently skipped drafts.&lt;/strong&gt; With this API version, a query that doesn't name a perspective gets &lt;code&gt;published&lt;/code&gt;, so a cleanup script would never have found &lt;code&gt;drafts.*&lt;/code&gt; documents. Scripts that need drafts now ask for &lt;code&gt;raw&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Report resurrection" flickered disabled.&lt;/strong&gt; Its "has this grave already risen?" check restarted every time the document changed, and it blocked the button while it ran. Now the button is only disabled once a zombie is known to exist, and it checks again when you confirm.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The site's CSS leaked into the Studio.&lt;/strong&gt; The root 404 page imported the site's global CSS, and a root not-found page's styles load on every route, so Tailwind ended up inside &lt;code&gt;/studio&lt;/code&gt;. A scoped CSS module fixed it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The build prerendered deleted bugs.&lt;/strong&gt; &lt;code&gt;generateStaticParams&lt;/code&gt; read the slug list from Next's local fetch cache, which still held old test bugs. It now fetches the slugs with &lt;code&gt;cache: 'no-store'&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two traps we avoided on purpose:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The timezone bug could have had a timezone bug.&lt;/strong&gt; Sanity &lt;code&gt;date&lt;/code&gt; fields are plain strings like &lt;code&gt;"2026-03-29"&lt;/code&gt;, with no timezone. Formatting them in the visitor's timezone would make every bug die a day early for anyone west of Greenwich, including on the timezone bug's own tombstone. So every date is formatted in UTC.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A dot in a document ID makes it private.&lt;/strong&gt; Sanity treats a dotted ID as a private path (that's how &lt;code&gt;drafts.&lt;/code&gt; works), so a public dataset won't serve &lt;code&gt;language.typescript&lt;/code&gt; without a token. The seed used dashed IDs like &lt;code&gt;language-typescript&lt;/code&gt; from the start. A quick test while writing this post confirmed it: a published document with a dotted ID didn't appear in a public query.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Reaching past the Studio: Workflows
&lt;/h3&gt;

&lt;p&gt;I also asked Claude Code to find out, in a 3-hour time box, whether Sanity Workflows could run this lifecycle. It can model it. On a separate branch (&lt;a href="https://github.com/jashanpreet-k/bug-graveyard/tree/explore/workflows" rel="noopener noreferrer"&gt;&lt;code&gt;explore/workflows&lt;/code&gt;&lt;/a&gt;), the lifecycle is two workflow definitions (one for a bug and one for a zombie), and "Declare buried" is gated by a GROQ requirement instead of a timer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dateTime($now) &amp;gt;= dateTime($fields.fixMergedAt) + 604800 // 7 days, in seconds
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;code&gt;npx sanity-workflows deploy --check&lt;/code&gt; passes for both definitions, and 4 tests pass against the real engine running in memory with a controlled clock. Burial is refused until exactly 7 days have passed.&lt;/p&gt;

&lt;p&gt;I didn't merge it. Workflows is in early access (0.35), its Studio plugin needs Studio 6 while this project runs Studio 5, and effects need a runtime I'd have to run myself. A proper integration also means deciding whether the workflow or the bug's own &lt;code&gt;status&lt;/code&gt; field is the source of truth, which Claude Code estimated at 1.5 to 2 days. The live site still runs on the document actions.&lt;/p&gt;
&lt;h3&gt;
  
  
  Reaching past the Studio: the App SDK
&lt;/h3&gt;

&lt;p&gt;After publishing this post, I had Claude Code build &lt;strong&gt;the Morgue&lt;/strong&gt;: a small App SDK app that runs in the Sanity Dashboard. It shows every bug that isn't resting yet in four live columns: suspected dead, walking, waiting and ready to bury. Each card has the same three lifecycle actions as the Studio, with the same rules, because both import the same &lt;code&gt;sanity/lib/lifecycle.ts&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwbmfmypgfq66oh93rf23.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwbmfmypgfq66oh93rf23.gif" alt="The Morgue in the Sanity Dashboard: clicking " width="720" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The Morgue running locally in the Sanity Dashboard, with temporary test bugs that were deleted afterwards. No refresh anywhere: the cards move as the documents change.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Everything is live.&lt;/strong&gt; Each column is a &lt;code&gt;useDocuments&lt;/code&gt; list with a GROQ filter, and each card reads its fields with &lt;code&gt;useDocumentProjection&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The buttons are the Studio's actions, rebuilt with the App SDK.&lt;/strong&gt; They use &lt;code&gt;useApplyDocumentActions&lt;/code&gt; with &lt;code&gt;editDocument&lt;/code&gt; and &lt;code&gt;createDocument&lt;/code&gt; on &lt;code&gt;liveEdit&lt;/code&gt; handles, which write straight to the published bug like the Studio's actions do. They also wait while a bug has unpublished Studio changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tested in the real Dashboard:&lt;/strong&gt; 18 checks on temporary test bugs, all deleted afterwards.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One surprise:&lt;/strong&gt; the Sanity CLI looks for a Studio config in every parent folder before it looks for an app config. Inside this repo, whose root holds the embedded Studio's config, &lt;code&gt;sanity build&lt;/code&gt; built the site's Studio instead. The app's npm scripts now run the CLI from a mirror folder outside the repo.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The code is in &lt;a href="https://github.com/jashanpreet-k/bug-graveyard/tree/main/apps/morgue" rel="noopener noreferrer"&gt;&lt;code&gt;apps/morgue&lt;/code&gt;&lt;/a&gt;. It's deployed to my organization's Sanity Dashboard, which only members of the organization can open, so for judges the GIF and the code are what's visible.&lt;/p&gt;
&lt;h3&gt;
  
  
  Reaching past the Studio: Functions &amp;amp; the AI Coroner
&lt;/h3&gt;

&lt;p&gt;Next came two &lt;a href="https://www.sanity.io/docs/functions" rel="noopener noreferrer"&gt;Sanity Functions&lt;/a&gt;, deployed with a Blueprint:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The gravedigger&lt;/strong&gt; is a scheduled function that runs every day at 00:15 UTC. It buries every bug whose fix has held for 7 days, using the same rules file as the Studio's "Declare buried" and the Morgue, and it skips bugs with unpublished Studio changes. (Once a day is also the most often a scheduled function can run on the Free plan.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The coroner&lt;/strong&gt; is a document function. When a bug is published as suspected dead with no epitaph, it asks an Agent Action (Prompt) for a short epitaph in the style of the existing graves, plus a cause of death chosen from the real ones. It writes that only into separate &lt;code&gt;coroner…&lt;/code&gt; fields, marked "awaiting approval".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A person decides.&lt;/strong&gt; A new &lt;strong&gt;✅ Accept coroner's report&lt;/strong&gt; document action shows the suggestion and copies it into the real fields only when you click Accept. The AI never touches the real epitaph and never publishes anything on its own.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy50knj6xboz7a0i6b1r7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy50knj6xboz7a0i6b1r7.png" alt="The Studio's " width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A coroner's report waiting for approval. The bugs in the list are temporary test bugs that were deleted afterwards.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The coroner also drafts the epitaphs of bugs reported on the site. Its prompt treats the reporter's words only as a description of the bug, never as instructions, and nothing it writes is shown publicly without the profanity check.&lt;/p&gt;

&lt;p&gt;Both functions were tested with Sanity's local runner against the real dataset first: 23 checks on temporary bugs, including a forced gravedigger run. Then the deployed coroner filed its first report in the cloud about 4.5 seconds after a test bug was published.&lt;/p&gt;
&lt;h2&gt;
  
  
  Sanity Project Details
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Project ID:&lt;/strong&gt; &lt;code&gt;rzjmw6lg&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dataset:&lt;/strong&gt; &lt;code&gt;production&lt;/code&gt; (public). Try it: &lt;a href="https://rzjmw6lg.api.sanity.io/v2026-09-28/data/query/production?query=*%5B_type%20%3D%3D%20%22bug%22%5D%20%7C%20order%28bornAt%20asc%29%20%7Bname%2C%20status%2C%20epitaph%7D" rel="noopener noreferrer"&gt;every bug, as JSON&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There are three document types: &lt;code&gt;bug&lt;/code&gt;, &lt;code&gt;language&lt;/code&gt; and &lt;code&gt;causeOfDeath&lt;/code&gt;. Here's how everything reaches them:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff30drdar1casdqjilsch.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff30drdar1casdqjilsch.png" alt="Architecture: Sanity Studio with custom actions, the Content Lake, two Sanity Functions (the gravedigger, and the coroner with Agent Actions), the Morgue App SDK app, and the Next.js site with the Live Content API, a signed webhook and the report form, plus the Workflows experiment on a branch" width="800" height="550"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  The schema: zombies are documents, not checkboxes
&lt;/h3&gt;

&lt;p&gt;The central decision: &lt;strong&gt;a zombie is a whole new &lt;code&gt;bug&lt;/code&gt; document that points to its previous life.&lt;/strong&gt; It isn't a status flag on the old one.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// sanity/schemaTypes/bug.ts (simplified)&lt;/span&gt;
&lt;span class="nf"&gt;defineField&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;status&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="na"&gt;list&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;suspected-dead&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fix-merged&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;buried&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;zombie&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]},&lt;/span&gt;
&lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="nf"&gt;defineField&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;previousLife&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;reference&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;to&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt;&lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bug&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;}],&lt;/span&gt;
  &lt;span class="na"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;zombie&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="nf"&gt;defineField&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;timesResurrected&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;number&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;readOnly&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;}),&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Why:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Every death keeps its own history.&lt;/strong&gt; A zombie gets fixed and buried again, so it needs its own dates and its own epitaph.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zombies of zombies work for free.&lt;/strong&gt; A chain is just references pointing backwards.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Disturbed" isn't stored anywhere.&lt;/strong&gt; GROQ works it out by asking whether any bug points at this one:
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;*[_type == "bug"]{
  ...,
  "disturbed": count(*[_type == "bug" &amp;amp;&amp;amp; previousLife._ref == ^._id]) &amp;gt; 0
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Languages and causes of death are references&lt;/strong&gt;, so filters and the leaderboard count them reliably. The whole leaderboard is &lt;strong&gt;one GROQ query&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The fix date, the burial date and the resurrection counter are read-only in the Studio.&lt;/strong&gt; There, only the lifecycle actions set them, so they record what actually happened rather than what someone typed. (&lt;code&gt;readOnly&lt;/code&gt; only applies to the Studio: the importer script sets historical dates from a file.)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  How document actions work
&lt;/h3&gt;

&lt;p&gt;Every button at the bottom of a Sanity document (Publish, Delete…) is a &lt;em&gt;document action&lt;/em&gt;, and you can add your own. An action is a small React component: Sanity passes it the document's current state and it returns a button (label, disabled, tooltip, onHandle, optional confirm dialog). You register actions in &lt;code&gt;sanity.config.ts&lt;/code&gt;. Because an action is a component, it re-renders whenever the document changes, which is how "Can bury in 4 days" stays up to date without any extra code. Actions run in the browser as the signed-in editor, with their permissions, so there's no API token in the code.&lt;/p&gt;
&lt;h3&gt;
  
  
  Live everywhere
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;sanityFetch&lt;/code&gt; plus &lt;code&gt;&amp;lt;SanityLive /&amp;gt;&lt;/code&gt; push Studio edits to open tabs in about 3 seconds. A signed Sanity &lt;strong&gt;webhook&lt;/strong&gt; refreshes the cached site when nobody has it open (about 6 seconds).&lt;/p&gt;
&lt;h2&gt;
  
  
  Agent Session
&lt;/h2&gt;

&lt;p&gt;This is the Claude Code session behind this build, with secrets redacted. The embed shows the Phase 5 slice, where the lifecycle document actions were built and tested. The &lt;a href="https://dev.to/agent_sessions/building-bug-graveyard-nextjs-sanity-with-claude-code-5ivb1b"&gt;full session&lt;/a&gt; has every phase.&lt;/p&gt;


&lt;div class="ltag-agent-session"&gt;
  &lt;div class="agent-session-header"&gt;
    
    &lt;span class="agent-session-tool-icon-badge" title="Claude Code"&gt;
&lt;/span&gt;
    &lt;span class="agent-session-title"&gt;Building Bug Graveyard (Next.js + Sanity) with Claude Code&lt;/span&gt;
      &lt;span class="agent-session-model-badge"&gt;claude-opus-5-5&lt;/span&gt;
  &lt;/div&gt;

  &lt;div class="agent-session-scroll"&gt;

      &lt;div class="agent-session-message agent-session-user"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-user"&gt;
          You
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div&gt;
                  &lt;div class="agent-session-text agent-session-text-collapse"&gt;
                    &lt;p&gt;Phase 5: add custom Sanity document actions that model a bug's lifecycle, and fill in the&lt;br&gt;
read-only fields (fixMergedAt, buriedAt, timesResurrected) that nothing sets yet.&lt;/p&gt;

&lt;p&gt;Actions on the bug type (register them in sanity.config.ts via document.actions, keep the&lt;br&gt;
default Publish/Delete etc.):&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;"🩹 Mark fix merged": enabled only when status = suspected-dead.
Sets status = fix-merged and fixMergedAt = today, then publishes.&lt;/li&gt;
&lt;li&gt;"🪦 Declare buried": enabled only when status = fix-merged AND at least 7 days have passed
since fixMergedAt. When disabled, the label/title says how many days are left
(e.g. "Can bury in 4 days"). Sets status = buried and buriedAt = today, then publishes.&lt;/li&gt;
&lt;li&gt;"🧟 Report resurrection": enabled when status = fix-merged or buried. Creates a NEW bug
document: status = zombie, previousLife = this bug, timesResurrected = old + 1,
name = "&amp;lt;original name&amp;gt; (Zombie #n)", same language/cause, a new unique slug, bornAt = today.
Then open the new zombie in the Studio so I can write its epitaph.
Show a confirm dialog first: "Are you sure? This bug will rise from its grave."&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rules:&lt;br&gt;
- Use dates in UTC like the rest of the app.&lt;br&gt;
- Handle drafts correctly (act on the published doc, don't leave stray drafts).&lt;br&gt;
- A zombie can later go through the same lifecycle (fix merged → buried → resurrect again),&lt;br&gt;
  so zombies of zombies work.&lt;br&gt;
- Make the 7-day rule a single constant so I can mention it in the write-up.&lt;/p&gt;

&lt;p&gt;Test it end to end with temporary test bugs (delete them after), confirm the homepage and&lt;br&gt;
grave pages update live, then run build/lint/type-check, add the Phase 5 entry to NOTES.md,&lt;br&gt;
commit and deploy. Also explain in plain words how document actions work in Sanity, for my&lt;br&gt;
write-up.&lt;/p&gt;

                  &lt;/div&gt;
                  Show more
                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;Phase 5 is Studio code, so I'll start with the document action API in the installed Sanity 5.31: the props an action receives, what it can return (label, disabled, title, confirm dialog), and how to register actions and open another document.&lt;/p&gt;

                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;f=$(grep -l "interface DocumentActionProps" node_modules/sanity/lib/*.d.ts no...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ f=$(grep -l "interface DocumentActionProps" node_modules/sanity/lib/*.d.ts node_modules/sanity/lib/_chunks-dts/*.d.ts 2&amp;gt;/dev/null | head -1); echo "defs in: $f"; for n in "interface DocumentActionProps" "interface DocumentActionDescription" "interface DocumentActionConfirmDialogProps" "interface DocumentActionDialogDialogProps" "type DocumentActionDialogProps" "interface DocumentActionComponent" "type DocumentActionsResolver" "interface DocumentActionsContext"; do echo "=================== $n"; awk -v pat="$n" 'index($0, pat) {p=1} p {print; if (/^}/ || (/;$/ &amp;amp;&amp;amp; pat ~ /^type/)) {exit}}' "$f" | grep -v "^\s*\*\|/\*\*" | head -30; done&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;defs in: node_modules/sanity/lib/_chunks-dts/ActiveWorkspaceMatcherContext.d.ts
=================== interface DocumentActionProps
interface DocumentActionProps extends EditStateFor {
  revision?: string;
  onComplete: () =&amp;gt; void;
  initialValueResolved: boolean;
}
=================== interface DocumentActionDescription
interface DocumentActionDescription extends GroupableActionDescription&amp;lt;DocumentActionGroup&amp;gt; {
  dialog?: DocumentActionDialogProps | false | null;
}
=================== interface DocumentActionConfirmDialogProps
interface DocumentActionConfirmDialogProps {
  type: 'confirm';
  tone?: ButtonTone;
  message: ReactNode;
  onConfirm: () =&amp;gt; void;
  onCancel: () =&amp;gt; void;
  cancelButtonIcon?: ComponentType | ReactNode;
  cancelButtonText?: string;
  confirmButtonIcon?: ComponentType | ReactNode;
  confirmButtonText?: string;
}
=================== interface DocumentActionDialogDialogProps
=================== type DocumentActionDialogProps
type DocumentActionDialogProps = DocumentActionConfirmDialogProps | DocumentActionPopoverDialogProps | DocumentActionModalDialogProps | DocumentActionCustomDialogComponentProps;
=================== interface DocumentActionComponent
interface DocumentActionComponent extends ActionComponent&amp;lt;DocumentActionProps, DocumentActionDescription&amp;gt; {
  action?: keyof DocumentActionKeys;
  displayName?: string;
}
=================== type DocumentActionsResolver
type DocumentActionsResolver = ComposableOption&amp;lt;DocumentActionComponent[], DocumentActionsContext&amp;gt;;
=================== interface DocumentActionsContext
interface DocumentActionsContext extends ConfigContext$1 {
  documentId?: string;
  schemaType: string;
  releaseId: string | undefined;
  versionType: DocumentActionsVersionType;
}&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;f=node_modules/sanity/lib/_chunks-dts/ActiveWorkspaceMatcherContext.d.ts; for...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ f=node_modules/sanity/lib/_chunks-dts/ActiveWorkspaceMatcherContext.d.ts; for n in "interface EditStateFor" "interface GroupableActionDescription" "interface DocumentActionModalDialogProps" "type DocumentActionsVersionType" "interface ActionComponent&amp;lt;"; do echo "=================== $n"; awk -v pat="$n" 'index($0, pat) {p=1} p {print; if (/^}/ || (/;$/ &amp;amp;&amp;amp; pat ~ /^type/)) {exit}}' "$f" | grep -v "^\s*\*\|/\*\*\|^\s*\*/" | head -26; done; echo "=== exports of interest"; for n in useClient useDocumentStore useDocumentOperation useCurrentUser getPublishedId getDraftId isDraftId useToast; do printf "%-22s %s\n" $n "$(grep -c "\b$n\b" node_modules/sanity/lib/index.d.ts)"; done; grep -o "navigateIntent[^;]*;" node_modules/sanity/lib/_chunks-dts/*.d.ts node_modules/sanity/lib/router.d.ts 2&amp;gt;/dev/null | head -2&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;=================== interface EditStateFor
interface EditStateFor {
  id: string;
  type: string;
  transactionSyncLock: TransactionSyncLockState | null;
  draft: SanityDocument | null;
  published: SanityDocument | null;
  version: SanityDocument | null;
  liveEdit: boolean;
  liveEditSchemaType: boolean;
  ready: boolean;
  release: string | undefined;
}
=================== interface GroupableActionDescription
interface GroupableActionDescription&amp;lt;GroupType = unknown&amp;gt; extends BaseActionDescription {
  group?: GroupType[];
}
=================== interface DocumentActionModalDialogProps
interface DocumentActionModalDialogProps {
  type?: 'dialog';
  content: ReactNode;
  footer?: DialogProps['footer'];
  header?: ReactNode;
  onClose: () =&amp;gt; void;
  showCloseButton?: boolean;
  width?: 'small' | 'medium' | 'large' | 'full';
}
=================== type DocumentActionsVersionType
type DocumentActionsVersionType = 'published' | 'draft' | 'revision' | 'version' | 'scheduled-draft';
=================== interface ActionComponent&amp;lt;
interface ActionComponent&amp;lt;ActionProps, ActionDescription&amp;gt; {
  (props: ActionProps): ActionDescription | null;
}
=== exports of interest
useClient              2
useDocumentStore       2
useDocumentOperation   2
useCurrentUser         2
getPublishedId         2
getDraftId             2
isDraftId              2
useToast               0
node_modules/sanity/lib/_chunks-dts/types3.d.ts:navigateIntent: (intentName: string, params?: IntentParameters, options?: NavigateBaseOptions) =&amp;gt; void;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;f=node_modules/sanity/lib/_chunks-dts/ActiveWorkspaceMatcherContext.d.ts; awk...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ f=node_modules/sanity/lib/_chunks-dts/ActiveWorkspaceMatcherContext.d.ts; awk 'index($0, "interface BaseActionDescription") {p=1} p {print; if (/^}/) exit}' $(grep -l "interface BaseActionDescription" node_modules/sanity/lib/_chunks-dts/*.d.ts | head -1) | grep -v "^\s*\*\|/\*\*\|^\s*\*/"; echo "=== listenQuery"; grep -h -o "listenQuery: ([^;]*;" node_modules/sanity/lib/_chunks-dts/*.d.ts | head -2; grep -h -B2 -A8 "interface ListenQueryOptions" node_modules/sanity/lib/_chunks-dts/*.d.ts | grep -v "^\s*\*\|/\*\*\|^\s*\*/" | head -14&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;interface BaseActionDescription {
  disabled?: boolean;
  icon?: ReactNode | ComponentType;
  label: string;
  onHandle?: () =&amp;gt; void;
  title?: ReactNode;
  tone?: ButtonTone;
  shortcut?: string | null;
  dialog?: unknown;
}
=== listenQuery
interface ListenQueryOptions {
  tag?: string;
  apiVersion?: string;
  perspective?: ClientPerspective;
  throttleTime?: number;
  transitions?: ('update' | 'appear' | 'disappear')[];
}
declare function listenQuery(client: SanityClient, query: string | {&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;grep -h -A6 "declare function listenQuery" node_modules/sanity/lib/_chunks-dt...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ grep -h -A6 "declare function listenQuery" node_modules/sanity/lib/_chunks-dts/*.d.ts | head -10; grep -c "listenQuery" node_modules/sanity/lib/index.d.ts; grep -oE "[A-Za-z_$0-9]+ as listenQuery\b" node_modules/sanity/lib/index.d.ts | head -2; grep -h -B3 -A12 "interface DocumentStore {" node_modules/sanity/lib/_chunks-dts/*.d.ts | grep -iE "listenQuery|interface DocumentStore" | head&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;declare function listenQuery(client: SanityClient, query: string | {
  fetch: string;
  listen: string;
}, params?: ListenQueryParams, options?: ListenQueryOptions): Observable&amp;lt;any&amp;gt;;
/**
 * @hidden
 * @beta */
2
ugrep: error: error at position 21
(?m)[A-Za-z_/bin/zsh-9]+ as listenQuery\b
                     \___invalid character class range


interface DocumentStore {
  listenQuery: (query: string | {&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;grep -rhoE "__studio_auth_token[^\"'\`]{0,40}" node_modules/sanity/lib/ 2&amp;gt;/de...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ grep -rhoE "__studio_auth_token[^\"'\`]{0,40}" node_modules/sanity/lib/ 2&amp;gt;/dev/null | sort -u | head -5; f=$(grep -rl "__studio_auth_token" node_modules/sanity/lib/_chunks-es/*.js 2&amp;gt;/dev/null | head -1); echo "file: $f"; grep -oE ".{200}__studio_auth_token.{300}" "$f" | head -2&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;__studio_auth_token_
file: 
ugrep: warning: : No such file or directory&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;f=$(grep -rl "__studio_auth_token_" node_modules/sanity/lib/ 2&amp;gt;/dev/null | he...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ f=$(grep -rl "__studio_auth_token_" node_modules/sanity/lib/ 2&amp;gt;/dev/null | head -3); echo "$f"; for x in $f; do grep -oE ".{0,250}__studio_auth_token_.{0,250}" "$x" | head -3; done | cut -c1-600&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;node_modules/sanity/lib/index.js
node_modules/sanity/lib/index.js.map
ugrep: warning: node_modules/sanity/lib/index.js
node_modules/sanity/lib/index.js.map: No such file or directory&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;Still in Phase 5 prep. I've mapped the document action API and am checking how to sign in a headless Studio for tests. Next I'll write the lifecycle actions.&lt;/p&gt;

                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;grep -oE ".{0,200}__studio_auth_token_.{0,300}" node_modules/sanity/lib/index...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ grep -oE ".{0,200}__studio_auth_token_.{0,300}" node_modules/sanity/lib/index.js | head -3 | cut -c1-520&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;ugrep: error: error at position 98
_(?:[^\n\x80-\xbf][\x80-\xbf]*){0,300}
         exceeds complexity limits___/&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;node -e '
const s = require("fs").readFileSync("node_modules/sanity/lib/index...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ node -e '
const s = require("fs").readFileSync("node_modules/sanity/lib/index.js", "utf8")
let i = -1, n = 0
while ((i = s.indexOf("__studio_auth_token_", i + 1)) !== -1 &amp;amp;&amp;amp; n++ &amp;lt; 3) console.log("---\n" + s.slice(Math.max(0, i - 260), i + 320))
'&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight diff"&gt;&lt;code&gt;&lt;span class="p"&gt;---
025-02-19"
&lt;/span&gt;}, DEFAULT_STUDIO_CLIENT_HEADERS = {
  "x-sanity-app": `studio@${SANITY_VERSION}`
}, versionedClient = (client, apiVersion) =&amp;gt; apiVersion ? client.withConfig({
  apiVersion
}) : client, AUTH_API_VERSION = "v2026-05-04", AUTH_TOKEN_STORAGE_PREFIX = "__studio_auth_token_", COOKIE_AUTH_STATE_PREFIX = "__studio_auth_cookie_state_", UNAUTHENTICATED = {
  authenticated: !1
}, AUTHENTICATED = {
  authenticated: !0
}, AUTH_CLIENT_OPTIONS = {
  apiVersion: AUTH_API_VERSION,
  useCdn: !1,
  perspective: "raw",
  requestTagPrefix: "sanity.studio",
  allowReconfigure: !1,&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;node -e '
const s = require("fs").readFileSync("node_modules/sanity/lib/index...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ node -e '
const s = require("fs").readFileSync("node_modules/sanity/lib/index.js", "utf8")
for (const needle of ["AUTH_TOKEN_STORAGE_PREFIX}", "AUTH_TOKEN_STORAGE_PREFIX +", "getToken(projectId", "function getStorageKey", "localStorage.getItem("]) {
  let i = -1, n = 0
  while ((i = s.indexOf(needle, i + 1)) !== -1 &amp;amp;&amp;amp; n++ &amp;lt; 2) console.log("--- [" + needle + "]\n" + s.slice(Math.max(0, i - 200), i + 260))
}
' | head -60&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;--- [AUTH_TOKEN_STORAGE_PREFIX}]
&lt;/span&gt;,
  useCdn: !1,
  perspective: "raw",
  requestTagPrefix: "sanity.studio",
  allowReconfigure: !1,
  headers: DEFAULT_STUDIO_CLIENT_HEADERS
};
&lt;span class="p"&gt;function getAuthTokenStorageKey(projectId) {
&lt;/span&gt;  return `${AUTH_TOKEN_STORAGE_PREFIX}${projectId}`;
}
&lt;span class="p"&gt;function getCookieAuthStateKey(projectId) {
&lt;/span&gt;  return `${COOKIE_AUTH_STATE_PREFIX}${projectId}`;
}
&lt;span class="p"&gt;function createLocalStorageStorage(key) {
&lt;/span&gt;  function load() {
    try {
      const value = localStorage.getItem(key);
&lt;span class="err"&gt;
&lt;/span&gt;&lt;span class="gd"&gt;--- [localStorage.getItem(]
-"), localStorage.removeItem(key), !0);
&lt;/span&gt;  } catch {
    return !1;
  }
})(), LOCAL_STORAGE_PREFIX = "sanity-locale";
&lt;span class="p"&gt;function getPreferredLocale(projectId, sourceId) {
&lt;/span&gt;  return supportsLocalStorage ? localStorage.getItem(getItemKey$1(projectId, sourceId)) ?? void 0 : void 0;
}
&lt;span class="p"&gt;function storePreferredLocale(projectId, sourceId, locale) {
&lt;/span&gt;  supportsLocalStorage &amp;amp;&amp;amp; localStorage.setItem(getItemKey$1(projectId, sourceId), locale);
}
&lt;span class="p"&gt;function getItemKey$1(projec
&lt;/span&gt;&lt;span class="gd"&gt;--- [localStorage.getItem(]
&lt;/span&gt;&lt;span class="p"&gt;ctId}`;
&lt;/span&gt;}
&lt;span class="p"&gt;function getCookieAuthStateKey(projectId) {
&lt;/span&gt;  return `${COOKIE_AUTH_STATE_PREFIX}${projectId}`;
}
&lt;span class="p"&gt;function createLocalStorageStorage(key) {
&lt;/span&gt;  function load() {
    try {
      const value = localStorage.getItem(key);
      return value === null ? void 0 : JSON.parse(value);
    } catch (err) {
      console.error(`Failed to parse localstorage value: ${err.message}`);
      return;
    }
  }
  function store(value) {
    try {
      value === void&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;node -e '
const s = require("fs").readFileSync("node_modules/sanity/lib/index...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ node -e '
const s = require("fs").readFileSync("node_modules/sanity/lib/index.js", "utf8")
for (const needle of ["getAuthTokenStorageKey(", "loginMethod"]) {
  let i = s.indexOf("function getAuthTokenStorageKey") + 50, n = 0
  i = -1
  while ((i = s.indexOf(needle, i + 1)) !== -1 &amp;amp;&amp;amp; n++ &amp;lt; 4) console.log("--- [" + needle + "]\n" + s.slice(Math.max(0, i - 150), i + 250).replace(/\n\s+/g, " "))
}
' | head -40&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;--- [getAuthTokenStorageKey(]
&lt;/span&gt;  useCdn: !1, perspective: "raw", requestTagPrefix: "sanity.studio", allowReconfigure: !1, headers: DEFAULT_STUDIO_CLIENT_HEADERS
};
&lt;span class="p"&gt;function getAuthTokenStorageKey(projectId) { return `${AUTH_TOKEN_STORAGE_PREFIX}${projectId}`;
&lt;/span&gt;}
&lt;span class="p"&gt;function getCookieAuthStateKey(projectId) { return `${COOKIE_AUTH_STATE_PREFIX}${projectId}`;
&lt;/span&gt;}
&lt;span class="p"&gt;function createLocalStorageStorage(key) { function load() {
&lt;/span&gt;&lt;span class="gd"&gt;--- [getAuthTokenStorageKey(]
&lt;/span&gt;", getSessionId: getSessionId2, consumeHashToken: consumeHashToken2, ...providerOptions
}) { const tokenStorage = createBroadcastStorage( getAuthTokenStorageKey(projectId), // sets the initial value (currentTokenValue) =&amp;gt; { const hashToken = consumeHashToken2(); return hashToken ? { token: hashToken, authenticated: !0 } : currentTokenValue; 
&lt;span class="gd"&gt;--- [getAuthTokenStorageKey(]
&lt;/span&gt;: "\u2022" }) ] }, link.title);
}
&lt;span class="p"&gt;function getStoredToken(projectId) { if (supportsLocalStorage) try { const raw = localStorage.getItem(getAuthTokenStorageKey(projectId)); return raw ? JSON.parse(raw)?.token : void 0; } catch { return; }
&lt;/span&gt;}
&lt;span class="p"&gt;function resolveApiHost(apiHost) { if (apiHost) return apiHost; if (isStaging) return "https://api.sanity.work";
&lt;/span&gt;}
&lt;span class="p"&gt;async f
&lt;/span&gt;&lt;span class="gd"&gt;--- [getAuthTokenStorageKey(]
&lt;/span&gt;.token ? { token, ignoreBrowserTokenWarning: !0 } : { withCredentials: !0 } }, client = factory(clientConfig), tokenKey = getAuthTokenStorageKey(input.projectId), cookieKey = getCookieAuthStateKey(input.projectId), observable$ = using(() =&amp;gt; { const cookieState = token ? null : createBroadcastState(cookieKey); return { cookieState, unsubscribe: () =&amp;gt; 
&lt;span class="gd"&gt;--- [loginMethod]
&lt;/span&gt;&lt;span class="p"&gt;filter((official) =&amp;gt; customProviders.some((provider) =&amp;gt; provider.url !== official.url)).concat(customProviders);
&lt;/span&gt;}
&lt;span class="p"&gt;function createHrefForProvider({ loginMethod = "dual", projectId, url, redirectPath
&lt;/span&gt;}) { const params = new URLSearchParams(); return params.set("origin", `${window.location.origin}${redirectPath}`), params.set("projectId", projectId), loginMethod === "token" ? params.set(
&lt;span class="gd"&gt;--- [loginMethod]
&lt;/span&gt; const params = new URLSearchParams(); return params.set("origin", `${window.location.origin}${redirectPath}`), params.set("projectId", projectId), loginMethod === "token" ? params.set("withSid", "true") : params.set("type", loginMethod), `${url}?${params}`;
}
&lt;span class="p"&gt;function createLoginComponent({ client$, loginMethod, redirectOnSingle, wasLogout, isHandlingCallback, ...providerOptions
&lt;/span&gt;}) 
&lt;span class="gd"&gt;--- [loginMethod]
&lt;/span&gt;&lt;span class="p"&gt;w.location.origin}${redirectPath}`), params.set("projectId", projectId), loginMethod === "token" ? params.set("withSid", "true") : params.set("type", loginMethod), `${url}?${params}`;
&lt;/span&gt;}
&lt;span class="p"&gt;function createLoginComponent({ client$, loginMethod, redirectOnSingle, wasLogout, isHandlingCallback, ...providerOptions
&lt;/span&gt;}) { function LoginComponent(t0) { const $ = c(28), { projectId, 
&lt;span class="gd"&gt;--- [loginMethod]
&lt;/span&gt;&lt;span class="p"&gt;hod === "token" ? params.set("withSid", "true") : params.set("type", loginMethod), `${url}?${params}`;
&lt;/span&gt;}
&lt;span class="p"&gt;function createLoginComponent({ client$, loginMethod, redirectOnSingle, wasLogout, isHandlingCallback, ...providerOptions&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-write"&gt;Write&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;/Users/jashanpreetkaur/Desktop/bug-graveyard/sanity/lib/lifecycle.ts&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight typescript"&gt;&lt;code&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Users&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;jashanpreetkaur&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Desktop&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;bug&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;graveyard&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;sanity&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;lifecycle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ts&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;File&lt;/span&gt; &lt;span class="nx"&gt;created&lt;/span&gt; &lt;span class="nx"&gt;successfully&lt;/span&gt; &lt;span class="nx"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Users&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;jashanpreetkaur&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Desktop&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;bug&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;graveyard&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;sanity&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;lib&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;lifecycle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ts &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt; &lt;span class="err"&gt;—&lt;/span&gt; &lt;span class="nx"&gt;no&lt;/span&gt; &lt;span class="nx"&gt;need&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;Read&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt; &lt;span class="nx"&gt;back&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;Before building on these helpers I'll check them quickly with Node's built-in TypeScript support, including a late-evening IST time that is still the previous day in UTC.&lt;/p&gt;

                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;node --input-type=module -e '
import {BURIAL_WAIT_DAYS, daysUntilBurial, zomb...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ node --input-type=module -e '
import {BURIAL_WAIT_DAYS, daysUntilBurial, zombieName, slugify, todayUTC, daysBetween} from "./sanity/lib/lifecycle.ts"
const eq = (label, got, want) =&amp;gt; console.log(`${JSON.stringify(got) === JSON.stringify(want) ? "ok  " : "FAIL"} ${label}: ${JSON.stringify(got)}`)
eq("BURIAL_WAIT_DAYS", BURIAL_WAIT_DAYS, 7)
eq("fixed today -&amp;gt; 7 days left", daysUntilBurial("2026-09-29", "2026-09-29"), 7)
eq("fixed 3 days ago -&amp;gt; 4 left", daysUntilBurial("2026-09-26", "2026-09-29"), 4)
eq("fixed 7 days ago -&amp;gt; 0 left", daysUntilBurial("2026-09-22", "2026-09-29"), 0)
eq("fixed 30 days ago -&amp;gt; 0 left", daysUntilBurial("2026-08-30", "2026-09-29"), 0)
eq("across a month end", daysBetween("2026-02-27", "2026-03-02"), 3)
eq("01:30 IST on the 29th is still the 28th in UTC", todayUTC(new Date("2026-09-29T01:30:00+05:30")), "2026-09-28")
eq("first zombie", zombieName("Timezone bug in scheduler", 1), "Timezone bug in scheduler (Zombie #1)")
eq("zombie of a zombie keeps the original name", zombieName("Timezone bug in scheduler (Zombie #1)", 2), "Timezone bug in scheduler (Zombie #2)")
eq("slug", slugify("Timezone bug in scheduler (Zombie #2)"), "timezone-bug-in-scheduler-zombie-2")
eq("slug with accents and symbols", slugify("  Crème brûlée: C++ bug!! "), "creme-brulee-c-bug")
' 2&amp;gt;&amp;amp;1 | grep -v ExperimentalWarning&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;(node:24361) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///Users/jashanpreetkaur/Desktop/bug-graveyard/sanity/lib/lifecycle.ts is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /Users/jashanpreetkaur/Desktop/bug-graveyard/package.json.
(Use `node --trace-warnings ...` to show where the warning was created)
ok   BURIAL_WAIT_DAYS: 7
ok   fixed today -&amp;gt; 7 days left: 7
ok   fixed 3 days ago -&amp;gt; 4 left: 4
ok   fixed 7 days ago -&amp;gt; 0 left: 0
ok   fixed 30 days ago -&amp;gt; 0 left: 0
ok   across a month end: 3
ok   01:30 IST on the 29th is still the 28th in UTC: "2026-09-28"
ok   first zombie: "Timezone bug in scheduler (Zombie #1)"
ok   zombie of a zombie keeps the original name: "Timezone bug in scheduler (Zombie #2)"
ok   slug: "timezone-bug-in-scheduler-zombie-2"
ok   slug with accents and symbols: "creme-brulee-c-bug"&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-write"&gt;Write&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;/Users/jashanpreetkaur/Desktop/bug-graveyard/sanity/actions/lifecycle.tsx&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight tsx"&gt;&lt;code&gt;&lt;span class="sr"&gt;/Users/&lt;/span&gt;&lt;span class="nx"&gt;jashanpreetkaur&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Desktop&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;bug&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;graveyard&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;sanity&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;actions&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;lifecycle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tsx&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight tsx"&gt;&lt;code&gt;&lt;span class="nx"&gt;File&lt;/span&gt; &lt;span class="nx"&gt;created&lt;/span&gt; &lt;span class="nx"&gt;successfully&lt;/span&gt; &lt;span class="nx"&gt;at&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Users&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;jashanpreetkaur&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Desktop&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;bug&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;graveyard&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;sanity&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;actions&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;lifecycle&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tsx &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt; &lt;span class="err"&gt;—&lt;/span&gt; &lt;span class="nx"&gt;no&lt;/span&gt; &lt;span class="nx"&gt;need&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;Read&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt; &lt;span class="nx"&gt;back&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-read"&gt;Read&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;/Users/jashanpreetkaur/Desktop/bug-graveyard/sanity.config.ts&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight typescript"&gt;&lt;code&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Users&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;jashanpreetkaur&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Desktop&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;bug&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;graveyard&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;sanity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ts&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight typescript"&gt;&lt;code&gt;&lt;span class="mi"&gt;1&lt;/span&gt;   &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;use client&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="mi"&gt;2&lt;/span&gt;   
&lt;span class="mi"&gt;3&lt;/span&gt;   &lt;span class="cm"&gt;/**
4    * This configuration is used to for the Sanity Studio that’s mounted on the `/app/studio/[[...tool]]/page.tsx` route
5    */&lt;/span&gt;
&lt;span class="mi"&gt;6&lt;/span&gt;   
&lt;span class="mi"&gt;7&lt;/span&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;visionTool&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;@sanity/vision&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="mi"&gt;8&lt;/span&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sanity&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="mi"&gt;9&lt;/span&gt;   &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;structureTool&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sanity/structure&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="mi"&gt;10&lt;/span&gt;  
&lt;span class="mi"&gt;11&lt;/span&gt;  &lt;span class="c1"&gt;// Go to https://www.sanity.io/docs/api-versioning to learn how API versioning works&lt;/span&gt;
&lt;span class="mi"&gt;12&lt;/span&gt;  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./sanity/env&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="mi"&gt;13&lt;/span&gt;  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./sanity/schemaTypes&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="mi"&gt;14&lt;/span&gt;  &lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;structure&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./sanity/structure&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="mi"&gt;15&lt;/span&gt;  
&lt;span class="mi"&gt;16&lt;/span&gt;  &lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
&lt;span class="mi"&gt;17&lt;/span&gt;    &lt;span class="na"&gt;basePath&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/studio&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="mi"&gt;18&lt;/span&gt;    &lt;span class="nx"&gt;projectId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="mi"&gt;19&lt;/span&gt;    &lt;span class="nx"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="mi"&gt;20&lt;/span&gt;    &lt;span class="c1"&gt;// Add and edit the content schema in the './sanity/schemaTypes' folder&lt;/span&gt;
&lt;span class="mi"&gt;21&lt;/span&gt;    &lt;span class="nx"&gt;schema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="mi"&gt;22&lt;/span&gt;    &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
&lt;span class="mi"&gt;23&lt;/span&gt;      &lt;span class="nf"&gt;structureTool&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;structure&lt;/span&gt;&lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="mi"&gt;24&lt;/span&gt;      &lt;span class="c1"&gt;// Vision is for querying with GROQ from inside the Studio&lt;/span&gt;
&lt;span class="mi"&gt;25&lt;/span&gt;      &lt;span class="c1"&gt;// https://www.sanity.io/docs/the-vision-plugin&lt;/span&gt;
&lt;span class="mi"&gt;26&lt;/span&gt;      &lt;span class="nf"&gt;visionTool&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="na"&gt;defaultApiVersion&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;apiVersion&lt;/span&gt;&lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="mi"&gt;27&lt;/span&gt;    &lt;span class="p"&gt;],&lt;/span&gt;
&lt;span class="mi"&gt;28&lt;/span&gt;  &lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="mi"&gt;29&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-edit"&gt;Edit&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;/Users/jashanpreetkaur/Desktop/bug-graveyard/sanity.config.ts&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight typescript"&gt;&lt;code&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Users&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;jashanpreetkaur&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Desktop&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;bug&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;graveyard&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;sanity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ts&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;The&lt;/span&gt; &lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Users&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;jashanpreetkaur&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;Desktop&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;bug&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;graveyard&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nx"&gt;sanity&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;config&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;ts&lt;/span&gt; &lt;span class="nx"&gt;has&lt;/span&gt; &lt;span class="nx"&gt;been&lt;/span&gt; &lt;span class="nx"&gt;updated&lt;/span&gt; &lt;span class="nx"&gt;successfully&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;file&lt;/span&gt; &lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;current&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;your&lt;/span&gt; &lt;span class="nx"&gt;context&lt;/span&gt; &lt;span class="err"&gt;—&lt;/span&gt; &lt;span class="nx"&gt;no&lt;/span&gt; &lt;span class="nx"&gt;need&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;Read&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt; &lt;span class="nx"&gt;back&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;npx tsc --noEmit 2&amp;gt;&amp;amp;1 | head -20 &amp;amp;&amp;amp; echo "tsc exit: ${pipestatus[1]}"; npm ru...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ npx tsc --noEmit 2&amp;gt;&amp;amp;1 | head -20 &amp;amp;&amp;amp; echo "tsc exit: ${pipestatus[1]}"; npm run lint --silent 2&amp;gt;&amp;amp;1 | tail -20; echo "lint exit: ${pipestatus[1]}"&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;tsc exit: 0
lint exit: 0&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;Type-check and lint are clean. Next I'll check Sanity's own schema validation, whether TypeGen still runs now that &lt;code&gt;sanity/&lt;/code&gt; contains Studio-only code, and the production build.&lt;/p&gt;

                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;npx sanity schemas validate 2&amp;gt;&amp;amp;1 | grep -E "Errors|Warnings|✖|rror" | head -5...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ npx sanity schemas validate 2&amp;gt;&amp;amp;1 | grep -E "Errors|Warnings|✖|rror" | head -5; npm run typegen 2&amp;gt;&amp;amp;1 | grep -E "✔ Success|queries and|rror|✖" ; git diff --stat sanity/types.ts sanity/extract.json; npm run build 2&amp;gt;&amp;amp;1 | grep -E "Compiled|TypeScript|rror|/studio"&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;✖ Errors:   0 errors
⚠ Warnings: 0 warnings
✔ Successfully generated types to /Users/jashanpreetkaur/Desktop/bug-graveyard/sanity/types.ts in 382ms
  └─ 4 queries and 17 schema types
✓ Compiled successfully in 944ms
  Running TypeScript ...
  Finished TypeScript in 1112ms ...
└ ○ /studio/[[...tool]]&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad
node --input-type=module -e '
import {writeFileSync} from "node:fs"
const day = (n) =&amp;gt; new Date(Date.now() - n * 864e5).toISOString().slice(0, 10)
const ref = (_ref) =&amp;gt; ({_type: "reference", _ref})
const bug = (key, extra) =&amp;gt; ({
  _id: `test-bug-life-${key}`, _type: "bug", name: `Lifecycle test: ${key}`,
  slug: {_type: "slug", current: `test-bug-life-${key}`},
  language: ref("language-typescript"), causeOfDeath: ref("causeOfDeath-off-by-one"),
  severity: "low", bornAt: day(30), timesResurrected: 0, epitaph: `Temporary: ${key}.`, ...extra,
})
const docs = [
  bug("suspected", {status: "suspected-dead"}),
  bug("waiting", {status: "fix-merged", fixMergedAt: day(3)}),
  bug("ready", {status: "fix-merged", fixMergedAt: day(8)}),
  bug("buried", {status: "buried", fixMergedAt: day(20), buriedAt: day(12)}),
  bug("drafted", {status: "suspected-dead"}),
  {...bug("drafted", {status: "suspected-dead"}), _id: "drafts.test-bug-life-drafted", epitaph: "An unpublished edit."},
]
writeFileSync(process.argv[1], JSON.stringify(docs, null, 2))
' "$SP/life-docs.json"
npx sanity documents create "$SP/life-docs.json" --replace 2&amp;gt;&amp;amp;1 | grep -v "npm warn" | tail -8&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;Upserted:
  - drafts.test-bug-life-drafted
  - test-bug-life-suspected
  - test-bug-life-waiting
  - test-bug-life-ready
  - test-bug-life-buried
  - test-bug-life-drafted&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-write"&gt;Write&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/studio-cdp.mjs&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;File created successfully at: /private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/studio-cdp.mjs (file state is current in your context — no need to Read it back)&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad
cat &amp;gt; "$SP/explore.mjs" &amp;lt;&amp;lt;'EOF'
import {openStudio, wait} from './studio-cdp.mjs'
const [, , port, base, sp] = process.argv
const s = await openStudio(port, base, 'rzjmw6lg')
await s.navigate('/studio/intent/edit/id=test-bug-life-suspected;type=bug')
await s.until('document form', `!!document.querySelector('[data-testid="action-menu-button"]')`, 60000)
await wait(2500)
console.log('url:', await s.url())
console.log('footer buttons:', JSON.stringify(await s.evaluate(`[...document.querySelectorAll('[data-testid="pane-footer"] button, [data-testid^="action-"]')].map(b =&amp;gt; ({testid: b.dataset.testid, text: b.innerText.trim().slice(0,40), disabled: b.disabled || b.getAttribute('aria-disabled') === 'true' || b.hasAttribute('data-disabled')}))`), null, 1))
await s.evaluate(`document.querySelector('[data-testid="action-menu-button"]').click()`)
await wait(800)
console.log('menu items:', JSON.stringify(await s.evaluate(`[...document.querySelectorAll('[role="menuitem"]')].map(b =&amp;gt; ({testid: b.dataset.testid, text: b.innerText.trim().slice(0,50), disabled: b.disabled || b.getAttribute('aria-disabled') === 'true' || b.hasAttribute('data-disabled')}))`), null, 1))
await s.shot(`${sp}/explore-menu.png`)
console.log('errors:', s.logs.slice(0, 5))
s.close()
EOF
npx next start -p 3333 &amp;gt; "$SP/next-3333.log" 2&amp;gt;&amp;amp;1 &amp;amp; SERVER=$!
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --disable-gpu --hide-scrollbars --no-first-run --remote-debugging-port=9341 --user-data-dir="$SP/chrome-p5" about:blank &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp; CHROME=$!
curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://localhost:3333/ &amp;amp;&amp;amp; curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://127.0.0.1:9341/json/version
(cd "$SP" &amp;amp;&amp;amp; node explore.mjs 9341 http://localhost:3333 "$SP")
kill $CHROME $SERVER 2&amp;gt;/dev/null; wait $CHROME $SERVER 2&amp;gt;/dev/null; pkill -f "scratchpad/chrome-p5"&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;Exit code 1
url: /studio/structure/bug;test-bug-life-suspected
footer buttons: [
 {
  "testid": "action-intent-button",
  "text": "",
  "disabled": true
 },
 {
  "text": "",
  "disabled": true
 },
 {
  "text": "",
  "disabled": true
 },
 {
  "testid": "action-publish",
  "text": "Publish",
  "disabled": true
 },
 {
  "testid": "action-menu-button",
  "text": "",
  "disabled": true
 }
]
menu items: [
 {
  "testid": "action-🩹Mark fix merged",
  "text": "🩹 Mark fix merged",
  "disabled": false
 },
 {
  "testid": "action-🪦Declare buried",
  "text": "🪦 Declare buried",
  "disabled": true
 },
 {
  "testid": "action-🧟Report resurrection",
  "text": "🧟 Report resurrection",
  "disabled": true
 },
 {
  "testid": "action-Duplicate",
  "text": "Duplicate",
  "disabled": false
 },
 {
  "testid": "action-Delete",
  "text": "Delete\nCtrl\nOption\nD",
  "disabled": false
 }
]
errors: []&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-read"&gt;Read&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/explore-menu.png&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-write"&gt;Write&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/lifecycle-e2e.mjs&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;File created successfully at: /private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/lifecycle-e2e.mjs (file state is current in your context — no need to Read it back)&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad
npx next start -p 3333 &amp;gt; "$SP/next-3333.log" 2&amp;gt;&amp;amp;1 &amp;amp; SERVER=$!
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --disable-gpu --hide-scrollbars --no-first-run --remote-debugging-port=9342 --user-data-dir="$SP/chrome-p5b" about:blank &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp; CHROME=$!
curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://localhost:3333/ &amp;amp;&amp;amp; curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://127.0.0.1:9342/json/version
(cd "$SP" &amp;amp;&amp;amp; node lifecycle-e2e.mjs 9342 http://localhost:3333) 2&amp;gt;&amp;amp;1 | tee "$SP/e2e.log"
kill $CHROME $SERVER 2&amp;gt;/dev/null; wait $CHROME $SERVER 2&amp;gt;/dev/null; pkill -f "scratchpad/chrome-p5b"; true&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;1) Suspected dead → Mark fix merged
  ok   only "Mark fix merged" is enabled (✓ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✗ 🧟 Report resurrection)
  ok   published: status fix-merged, fixMergedAt today (UTC) (1.4s)
  ok   no draft left behind
  FAIL now waiting 7 days to bury, resurrection allowed (✗ 🩹 Mark fix merged | ✗ 🪦 Can bury in 7 days | ✗ 🧟 Report resurrection)
  ok   grave page shows the fix date (0.7s)
2) Fixed 3 days ago
  ok   "Can bury in 4 days", disabled (✗ 🩹 Mark fix merged | ✗ 🪦 Can bury in 4 days | ✓ 🧟 Report resurrection)
3) Fixed 8 days ago → Declare buried
  ok   "Declare buried" is enabled (✗ 🩹 Mark fix merged | ✓ 🪦 Declare buried | ✓ 🧟 Report resurrection)
  ok   published: status buried, buriedAt today (UTC) (1.3s)
  ok   no draft left behind
  ok   grave page shows the burial date (0.7s)
4) Cancelling a resurrection changes nothing
file:///private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/studio-cdp.mjs:46
    throw new Error(`timed out waiting for: ${label}`)
          ^

Error: timed out waiting for: confirm dialog
    at Object.until (file:///private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/studio-cdp.mjs:46:11)
    at async file:///private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/lifecycle-e2e.mjs:111:1

Node.js v24.14.0&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad
cat &amp;gt; "$SP/debug-risen.mjs" &amp;lt;&amp;lt;'EOF'
import {openStudio, wait} from './studio-cdp.mjs'
const [, , port, base] = process.argv
const s = await openStudio(port, base, 'rzjmw6lg')
async function state(label) {
  await s.evaluate(`document.querySelector('[data-testid="action-menu-button"]').click()`)
  await s.until('menu', `document.querySelectorAll('[role="menuitem"]').length &amp;gt; 0`)
  const rect = await s.evaluate(`(() =&amp;gt; { const b = [...document.querySelectorAll('[role="menuitem"]')].find(b =&amp;gt; b.innerText.includes('resurrection')); const r = b.getBoundingClientRect(); return {x: r.x + r.width / 2, y: r.y + r.height / 2, disabled: b.getAttribute('aria-disabled') ?? String(b.disabled) } })()`)
  await s.send('Input.dispatchMouseEvent', {type: 'mouseMoved', x: rect.x, y: rect.y})
  await wait(900)
  const tip = await s.evaluate(`[...document.querySelectorAll('[data-ui="Popover"], [role="tooltip"], [data-testid*="tooltip"]')].map(e =&amp;gt; e.innerText.trim()).filter(Boolean).join(' || ')`)
  console.log(`${label}: disabled=${rect.disabled} tooltip="${tip}"`)
  await s.evaluate(`document.dispatchEvent(new KeyboardEvent('keydown', {key: 'Escape', bubbles: true}))`)
  await wait(300)
}
// "ready" was buried in place during the last run; open it fresh now
await s.navigate('/studio/intent/edit/id=test-bug-life-ready;type=bug')
await s.until('doc', `location.pathname.endsWith('test-bug-life-ready') &amp;amp;&amp;amp; !!document.querySelector('[data-testid="action-menu-button"]')`, 60000)
await wait(2000)
await state('fresh load of a buried bug')
for (const t of [3, 8]) { await wait(t * 1000); await state(`after ${t}s more`) }
s.close()
EOF
npx next start -p 3333 &amp;gt; "$SP/next-3333.log" 2&amp;gt;&amp;amp;1 &amp;amp; SERVER=$!
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --disable-gpu --hide-scrollbars --no-first-run --remote-debugging-port=9343 --user-data-dir="$SP/chrome-p5c" about:blank &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp; CHROME=$!
curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://localhost:3333/ &amp;amp;&amp;amp; curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://127.0.0.1:9343/json/version
(cd "$SP" &amp;amp;&amp;amp; node debug-risen.mjs 9343 http://localhost:3333)
kill $CHROME $SERVER 2&amp;gt;/dev/null; wait $CHROME $SERVER 2&amp;gt;/dev/null; pkill -f "scratchpad/chrome-p5c"; true&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;fresh load of a buried bug: disabled=false tooltip="What's new
Content Agent is generally available"
after 3s more: disabled=false tooltip="What's new
Content Agent is generally available"
after 8s more: disabled=false tooltip="What's new
Content Agent is generally available"&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;python3 - &amp;lt;&amp;lt;'EOF'
import pathlib
p = pathlib.Path('sanity/actions/lifecycle.t...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ python3 - &amp;lt;&amp;lt;'EOF'
import pathlib
p = pathlib.Path('sanity/actions/lifecycle.tsx')
s = p.read_text()
reps = [
("""  const risen = useRisenZombie(bug?._id)

  function resurrect() {
    setConfirming(false)
    run(async () =&amp;gt; {
      if (!bug) return
      const number""",
"""  const risen = useRisenZombie(bug?._id)

  function resurrect() {
    setConfirming(false)
    run(async () =&amp;gt; {
      if (!bug) return
      // Checked again here: the live check can lag, or a zombie may just have risen elsewhere.
      const already = await client.fetch&amp;lt;string | null&amp;gt;(RISEN_QUERY, {id: bug._id}, {perspective: 'raw'})
      if (already) throw new Error(`It already rose as “${already}”. Report the next resurrection on that grave.`)
      const number"""),
("""    disabled: busy || Boolean(blocked) || !dead || risen !== null,""",
 """    disabled: busy || Boolean(blocked) || !dead || Boolean(risen),"""),
("""        : risen
          ? `It already rose as “${risen}”. Report the next resurrection on that grave.`
          : risen === undefined
            ? 'Checking whether it has already risen…'
            : 'Creates a zombie of this bug and opens it'),""",
 """        : risen
          ? `It already rose as “${risen}”. Report the next resurrection on that grave.`
          : 'Creates a zombie of this bug and opens it'),"""),
("""// The name of the zombie that already rose from this grave: null if none has,
// undefined while still checking. A grave only rises once; its zombie carries on
// the chain, so the next resurrection is reported on the zombie's grave.
function useRisenZombie(publishedId: string | undefined) {
  const documentStore = useDocumentStore()
  const [risen, setRisen] = useState&amp;lt;string | null | undefined&amp;gt;(undefined)

  useEffect(() =&amp;gt; {
    if (!publishedId) return
    const subscription = documentStore
      .listenQuery(
        '*[_type == "bug" &amp;amp;&amp;amp; previousLife._ref == $id][0].name',
        {id: publishedId},
        {perspective: 'published'},
      )""",
"""// A grave only rises once: its zombie carries on the chain, so the next
// resurrection is reported on the zombie's grave.
const RISEN_QUERY = '*[_type == "bug" &amp;amp;&amp;amp; previousLife._ref == $id][0].name'

// The name of the zombie that already rose from this grave, kept up to date;
// null if none has (or while the first check is still running).
function useRisenZombie(publishedId: string | undefined) {
  const documentStore = useDocumentStore()
  const [risen, setRisen] = useState&amp;lt;string | null&amp;gt;(null)

  useEffect(() =&amp;gt; {
    if (!publishedId) return
    const subscription = documentStore
      .listenQuery(RISEN_QUERY, {id: publishedId}, {perspective: 'published'})"""),
]
for a, b in reps:
    assert a in s, a[:80]
    s = s.replace(a, b)
p.write_text(s)
print("patched")
EOF
npx tsc --noEmit &amp;amp;&amp;amp; echo "tsc ok"; npm run lint --silent &amp;amp;&amp;amp; echo "lint ok"&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;patched
tsc ok
lint ok&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad
python3 - "$SP/lifecycle-e2e.mjs" &amp;lt;&amp;lt;'EOF'
import sys, pathlib
p = pathlib.Path(sys.argv[1]); s = p.read_text()
a = """await open('test-bug-life-buried')
items = await menu()
check('the old grave cannot rise twice', items.find((i) =&amp;gt; i.text.includes('resurrection'))?.disabled === true, describe(items))"""
b = """await open('test-bug-life-buried')
await pollUntil('the old grave cannot rise twice', async () =&amp;gt; {
  const items = await menu()
  return items.find((i) =&amp;gt; i.text.includes('resurrection'))?.disabled === true || describe(items)
}, 15000)"""
assert a in s
p.write_text(s.replace(a, b))
EOF
echo "zombies of test bugs before reset: $(npx sanity documents query --api-version 2026-09-28 'count(*[_type == "bug" &amp;amp;&amp;amp; previousLife._ref in ["test-bug-life-suspected","test-bug-life-waiting","test-bug-life-ready","test-bug-life-buried","test-bug-life-drafted"]])' 2&amp;gt;&amp;amp;1 | grep -v 'npm warn' | tail -1)"
npx sanity documents create "$SP/life-docs.json" --replace 2&amp;gt;&amp;amp;1 | grep -v "npm warn" | head -1
npm run build 2&amp;gt;&amp;amp;1 | grep -E "Compiled|rror"
npx next start -p 3333 &amp;gt; "$SP/next-3333.log" 2&amp;gt;&amp;amp;1 &amp;amp; SERVER=$!
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --disable-gpu --hide-scrollbars --no-first-run --remote-debugging-port=9344 --user-data-dir="$SP/chrome-p5d" about:blank &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp; CHROME=$!
curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://localhost:3333/ &amp;amp;&amp;amp; curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://127.0.0.1:9344/json/version
(cd "$SP" &amp;amp;&amp;amp; node lifecycle-e2e.mjs 9344 http://localhost:3333) 2&amp;gt;&amp;amp;1 | tee "$SP/e2e.log"
kill $CHROME $SERVER 2&amp;gt;/dev/null; wait $CHROME $SERVER 2&amp;gt;/dev/null; pkill -f "scratchpad/chrome-p5d"; true&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;zombies of test bugs before reset:  ›   test-bug-life-buried","test-bug-life-drafted"]])
Upserted:
✓ Compiled successfully in 799ms
1) Suspected dead → Mark fix merged
  ok   only "Mark fix merged" is enabled (✓ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✗ 🧟 Report resurrection)
  ok   published: status fix-merged, fixMergedAt today (UTC) (1.3s)
  ok   no draft left behind
  ok   now waiting 7 days to bury, resurrection allowed (✗ 🩹 Mark fix merged | ✗ 🪦 Can bury in 7 days | ✓ 🧟 Report resurrection)
  ok   grave page shows the fix date (0.9s)
2) Fixed 3 days ago
  ok   "Can bury in 4 days", disabled (✗ 🩹 Mark fix merged | ✗ 🪦 Can bury in 4 days | ✓ 🧟 Report resurrection)
3) Fixed 8 days ago → Declare buried
  ok   "Declare buried" is enabled (✗ 🩹 Mark fix merged | ✓ 🪦 Declare buried | ✓ 🧟 Report resurrection)
  ok   published: status buried, buriedAt today (UTC) (1.5s)
  ok   no draft left behind
  ok   grave page shows the burial date (0.7s)
4) Cancelling a resurrection changes nothing
  ok   confirm dialog shows the message
  ok   clicked Cancel
  ok   no zombie was created
5) Unpublished edits block the actions
  ok   all three disabled (✗ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✗ 🧟 Report resurrection)
6) Buried → Report resurrection → Zombie #1
file:///private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/studio-cdp.mjs:46
    throw new Error(`timed out waiting for: ${label}`)
          ^

Error: timed out waiting for: document test-bug-life-buried
    at Object.until (file:///private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/studio-cdp.mjs:46:11)
    at async open (file:///private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/lifecycle-e2e.mjs:53:3)
    at async file:///private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad/lifecycle-e2e.mjs:127:1

Node.js v24.14.0&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad
python3 - "$SP/lifecycle-e2e.mjs" &amp;lt;&amp;lt;'EOF'
import sys, pathlib
p = pathlib.Path(sys.argv[1]); s = p.read_text()
a = "await graveTab.evaluate('window.__noReload = true')\nawait open('test-bug-life-buried')"
b = "await graveTab.evaluate('window.__noReload = true')\nawait studio.send('Page.bringToFront') // background tabs are throttled\nawait open('test-bug-life-buried')"
assert a in s
p.write_text(s.replace(a, b))
EOF
npx sanity documents create "$SP/life-docs.json" --replace 2&amp;gt;&amp;amp;1 | grep -v "npm warn" | head -1
npx next start -p 3333 &amp;gt; "$SP/next-3333.log" 2&amp;gt;&amp;amp;1 &amp;amp; SERVER=$!
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --disable-gpu --hide-scrollbars --no-first-run --remote-debugging-port=9345 --user-data-dir="$SP/chrome-p5e" about:blank &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp; CHROME=$!
curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://localhost:3333/ &amp;amp;&amp;amp; curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://127.0.0.1:9345/json/version
(cd "$SP" &amp;amp;&amp;amp; node lifecycle-e2e.mjs 9345 http://localhost:3333) 2&amp;gt;&amp;amp;1 | tee "$SP/e2e.log"
kill $CHROME $SERVER 2&amp;gt;/dev/null; wait $CHROME $SERVER 2&amp;gt;/dev/null; pkill -f "scratchpad/chrome-p5e"; true&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;Upserted:
1) Suspected dead → Mark fix merged
  ok   only "Mark fix merged" is enabled (✓ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✗ 🧟 Report resurrection)
  ok   published: status fix-merged, fixMergedAt today (UTC) (1.4s)
  ok   no draft left behind
  ok   now waiting 7 days to bury, resurrection allowed (✗ 🩹 Mark fix merged | ✗ 🪦 Can bury in 7 days | ✓ 🧟 Report resurrection)
  ok   grave page shows the fix date (1.2s)
2) Fixed 3 days ago
  ok   "Can bury in 4 days", disabled (✗ 🩹 Mark fix merged | ✗ 🪦 Can bury in 4 days | ✓ 🧟 Report resurrection)
3) Fixed 8 days ago → Declare buried
  ok   "Declare buried" is enabled (✗ 🩹 Mark fix merged | ✓ 🪦 Declare buried | ✓ 🧟 Report resurrection)
  ok   published: status buried, buriedAt today (UTC) (1.5s)
  ok   no draft left behind
  ok   grave page shows the burial date (1.1s)
4) Cancelling a resurrection changes nothing
  ok   confirm dialog shows the message
  ok   clicked Cancel
  ok   no zombie was created
5) Unpublished edits block the actions
  ok   all three disabled (✗ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✗ 🧟 Report resurrection)
6) Buried → Report resurrection → Zombie #1
  ok   clicked "Let it rise"
  ok   Studio opened the new zombie (c3812e41-4f19-495e-8011-60a6158d9802)
  ok   name "(Zombie #1)" (Lifecycle test: buried (Zombie #1))
  ok   status zombie, born today, timesResurrected 1 ({"s":"zombie","b":"2026-09-28","t":1})
  ok   previousLife → the buried bug
  ok   same language and cause, no epitaph yet
  ok   unique slug (lifecycle-test-buried-zombie-1)
  ok   zombie is published, with no draft
  ok   open grave tab shows "Risen from this grave" without reloading (1.4s)
  ok   homepage lists the zombie (0.2s)
  ok   the old grave cannot rise twice (0.3s)
7) Zombie #1 → Mark fix merged → Report resurrection → Zombie #2
  ok   a walking zombie can have its fix merged (✓ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✗ 🧟 Report resurrection)
  ok   zombie #1 is fix-merged today (1.8s)
  ok   name "(Zombie #2)", not "(Zombie #1) (Zombie #2)" (Lifecycle test: buried (Zombie #2))
  ok   timesResurrected 2, previousLife → zombie #1
  ok   zombie #2 page shows both past lives, oldest first (0.5s)
8) No stray drafts anywhere
  ok   only the draft we made on purpose exists (["drafts.test-bug-life-drafted"])
  ok   no errors in the Studio
ZOMBIES=a6b031eb-78c1-4104-a5af-8565629d2597,c3812e41-4f19-495e-8011-60a6158d9802
all checks passed&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;npx sanity documents delete a6b031eb-78c1-4104-a5af-8565629d2597 2&amp;gt;&amp;amp;1 | grep ...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ npx sanity documents delete a6b031eb-78c1-4104-a5af-8565629d2597 2&amp;gt;&amp;amp;1 | grep -v "npm warn" | tail -1; npx sanity documents delete c3812e41-4f19-495e-8011-60a6158d9802 2&amp;gt;&amp;amp;1 | grep -v "npm warn" | tail -1; npx sanity documents delete test-bug-life-suspected test-bug-life-waiting test-bug-life-ready test-bug-life-buried test-bug-life-drafted drafts.test-bug-life-drafted 2&amp;gt;&amp;amp;1 | grep -v "npm warn" | tail -1
echo "left over: $(npx --yes sanity@latest documents query --api-version 2026-09-28 '*[_type == "bug" &amp;amp;&amp;amp; (name match "Lifecycle test*" || string::startsWith(_id, "test-bug-life") || string::startsWith(_id, "drafts.test-bug-life"))]._id' 2&amp;gt;/dev/null | tr -d ' \n')"; echo "bugs now: $(npx --yes sanity@latest documents query --api-version 2026-09-28 '*[_type == "bug" &amp;amp;&amp;amp; !(_id in path("drafts.**"))].name' 2&amp;gt;/dev/null | tr -d '\n' | sed 's/  */ /g')"&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;Deleted 1 document
Deleted 1 document
Deleted 6 documents
left over: []
bugs now: [ "NullPointerException in checkout", "Timezone bug in scheduler", "Timezone bug in scheduler (Zombie #1)"]&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;Everything is cleaned up, and the dataset is back to your 3 bugs. Next: the final build, lint and type-check.&lt;/p&gt;

                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;npx tsc --noEmit &amp;amp;&amp;amp; echo "tsc ok"; npm run lint --silent &amp;amp;&amp;amp; echo "lint ok"; n...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ npx tsc --noEmit &amp;amp;&amp;amp; echo "tsc ok"; npm run lint --silent &amp;amp;&amp;amp; echo "lint ok"; npx sanity schemas validate 2&amp;gt;&amp;amp;1 | grep -E "Errors|Warnings"; npm run build 2&amp;gt;&amp;amp;1 | grep -E "Compiled|TypeScript|rror"; git status --short&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;tsc ok
lint ok
✖ Errors:   0 errors
⚠ Warnings: 0 warnings
✓ Compiled successfully in 698ms
  Running TypeScript ...
  Finished TypeScript in 923ms ...
 M sanity.config.ts
?? sanity/actions/
?? sanity/lib/lifecycle.ts&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;All clean: type-check, lint, 0 schema errors and 0 warnings, and a passing build. I'll commit the code, deploy it to Vercel, and check the live Studio before writing the NOTES entry.&lt;/p&gt;

                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;git add sanity.config.ts sanity/actions sanity/lib/lifecycle.ts &amp;amp;&amp;amp; git commit...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ git add sanity.config.ts sanity/actions sanity/lib/lifecycle.ts &amp;amp;&amp;amp; git commit -q -F - &amp;lt;&amp;lt;'EOF'
Add lifecycle document actions to the Studio

Bugs get three actions after Publish: "Mark fix merged" (from suspected
dead or zombie, sets fixMergedAt), "Declare buried" (once the fix has
held for BURIAL_WAIT_DAYS = 7 days, sets buriedAt; otherwise shows
"Can bury in N days"), and "Report resurrection" (after a confirm
dialog, creates a published zombie with previousLife, timesResurrected
+ 1 and a unique slug, then opens it). Zombies go through the same
cycle, so zombies of zombies work.

The actions patch the published document directly, guarded by its
revision, so they never leave drafts, and they are disabled while
unpublished edits exist. A grave rises only once. Dates are UTC.

Co-Authored-By: Claude Opus 5.5 &amp;lt;noreply@anthropic.com&amp;gt;
EOF
git log --oneline | head -1
npx vercel@60 deploy --prod --yes 2&amp;gt;&amp;amp;1 | grep -E "Production:|Aliased|Error|error|READY|https://bug-graveyard" | grep -v "vercel curl\|vercel inspect" | head -6&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;4352c77 Add lifecycle document actions to the Studio
  Production      https://bug-graveyard-ab38mxs28-jashanpreet-kaur.vercel.app
[2K[1A[2K[G  Production      https://bug-graveyard-ab38mxs28-jashanpreet-kaur.vercel.app
▲ Aliased         https://bug-graveyard.vercel.app
    "url": "https://bug-graveyard-ab38mxs28-jashanpreet-kaur.vercel.app",
    "readyState": "READY",&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div class="agent-session-text"&gt;
                  &lt;p&gt;It's deployed and aliased to &lt;a href="https://bug-graveyard.vercel.app" rel="noopener noreferrer"&gt;https://bug-graveyard.vercel.app&lt;/a&gt;. Next is a &lt;strong&gt;read-only&lt;/strong&gt; check of the live Studio: it opens your three real bugs and reads their action menus without clicking anything.&lt;/p&gt;

                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ SP=/private/tmp/claude-501/-Users-jashanpreetkaur-Desktop-bug-graveyard/0adab70e-beca-4347-ad08-acf0d3b85074/scratchpad
cat &amp;gt; "$SP/live-menus.mjs" &amp;lt;&amp;lt;'EOF'
// Read-only: opens real bugs in the live Studio and reads their lifecycle menus. Clicks nothing.
import {openStudio, wait} from './studio-cdp.mjs'
const [, , port, base] = process.argv
const s = await openStudio(port, base, 'rzjmw6lg')
let failures = 0
async function menu() {
  await s.evaluate(`document.querySelector('[data-testid="action-menu-button"]').click()`)
  await s.until('menu', `document.querySelectorAll('[role="menuitem"]').length &amp;gt; 0`)
  const items = await s.evaluate(`[...document.querySelectorAll('[role="menuitem"]')].filter(b =&amp;gt; /fix merged|bur|resurrection/i.test(b.innerText)).map(b =&amp;gt; (b.getAttribute('aria-disabled') === 'true' || b.disabled || b.hasAttribute('data-disabled') ? '✗ ' : '✓ ') + b.innerText.trim()).join(' | ')`)
  await s.evaluate(`document.dispatchEvent(new KeyboardEvent('keydown', {key: 'Escape', bubbles: true}))`)
  await wait(300)
  return items
}
for (const [id, want] of [
  ['test-bug-timezone-scheduler-zombie-1', '✓ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✗ 🧟 Report resurrection'],
  ['test-bug-timezone-scheduler', '✗ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✗ 🧟 Report resurrection'],
  ['test-bug-nullpointer-checkout', '✗ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✓ 🧟 Report resurrection'],
]) {
  await s.navigate(`/studio/intent/edit/id=${id};type=bug`)
  await s.until(id, `location.pathname.endsWith(${JSON.stringify(id)}) &amp;amp;&amp;amp; !!document.querySelector('[data-testid="action-menu-button"]')`, 60000)
  let got
  for (let i = 0; i &amp;lt; 10 &amp;amp;&amp;amp; got !== want; i++) { await wait(1000); got = await menu() }
  if (got !== want) failures++
  console.log(`  ${got === want ? 'ok  ' : 'FAIL'} ${id}: ${got}`)
}
console.log('  studio errors:', s.logs.length ? s.logs.slice(0, 2) : 'none')
console.log(failures ? `${failures} FAILED` : 'live Studio has the actions')
s.close()
EOF
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" --headless=new --disable-gpu --hide-scrollbars --no-first-run --remote-debugging-port=9346 --user-data-dir="$SP/chrome-live5" about:blank &amp;gt;/dev/null 2&amp;gt;&amp;amp;1 &amp;amp; CHROME=$!
curl -s -o /dev/null --retry 30 --retry-connrefused --retry-delay 1 http://127.0.0.1:9346/json/version
(cd "$SP" &amp;amp;&amp;amp; node live-menus.mjs 9346 https://bug-graveyard.vercel.app)
kill $CHROME 2&amp;gt;/dev/null; wait $CHROME 2&amp;gt;/dev/null; pkill -f "scratchpad/chrome-live5"
for p in / /grave/timezone-bug-in-scheduler; do printf "  live %-34s %s\n" "$p" "$(curl -s -o /dev/null -w '%{http_code}' https://bug-graveyard.vercel.app$p)"; done&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;ok   test-bug-timezone-scheduler-zombie-1: ✓ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✗ 🧟 Report resurrection
  ok   test-bug-timezone-scheduler: ✗ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✗ 🧟 Report resurrection
  ok   test-bug-nullpointer-checkout: ✗ 🩹 Mark fix merged | ✗ 🪦 Declare buried | ✓ 🧟 Report resurrection
  studio errors: none
live Studio has the actions
  live /                                  200
  live /grave/timezone-bug-in-scheduler   200&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
              &lt;div class="agent-session-tool-call"&gt;
                
                  &lt;span class="agent-session-chevron"&gt;▸&lt;/span&gt;
                  &lt;span class="tool-name tool-name-bash"&gt;Bash&lt;/span&gt;
                    &lt;span class="tool-input-preview"&gt;tail -2 NOTES.md &amp;amp;&amp;amp; cat &amp;gt;&amp;gt; NOTES.md &amp;lt;&amp;lt;'EOF'

---

## Phase 5: Lifecycle docum...&lt;/span&gt;
                
                &lt;div class="agent-session-tool-detail"&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Input&lt;/div&gt;
                      &lt;pre class="agent-session-pre agent-session-terminal"&gt;&lt;code&gt;$ tail -2 NOTES.md &amp;amp;&amp;amp; cat &amp;gt;&amp;gt; NOTES.md &amp;lt;&amp;lt;'EOF'

---

## Phase 5: Lifecycle document actions (2026-09-29)

### What I asked for

- Three custom Studio actions on bugs, registered through `document.actions` in
  `sanity.config.ts`, keeping Sanity's own Publish, Delete and so on:
  - **🩹 Mark fix merged**, enabled for suspected-dead bugs: status becomes fix-merged,
    `fixMergedAt` becomes today, and the change is published.
  - **🪦 Declare buried**, enabled once a fix has held for 7 days; otherwise the label
    says how long is left ("Can bury in 4 days"). Status becomes buried, `buriedAt`
    becomes today, and the change is published.
  - **🧟 Report resurrection**, for fix-merged or buried bugs. After a confirm dialog
    ("Are you sure? This bug will rise from its grave.") it creates a new zombie bug:
    `previousLife` points at this bug, `timesResurrected` goes up by one, the name
    becomes "&amp;lt;name&amp;gt; (Zombie #n)", with the same language and cause, a unique slug and
    today as `bornAt`. Then it opens the zombie so I can write its epitaph.
- UTC dates. Drafts handled properly: act on the published document and leave no
  stray drafts. Zombies go through the same lifecycle, so zombies of zombies work. The
  7-day rule in a single constant.
- Test it end to end with temporary bugs, check that the site updates live, run build,
  lint and type-check, add this entry, commit and deploy. Explain document actions for
  the write-up.

### What was built

- `sanity/actions/lifecycle.tsx`: the three actions
- `sanity/lib/lifecycle.ts`: `BURIAL_WAIT_DAYS = 7` and small helpers: `todayUTC`,
  `daysBetween`, `daysUntilBurial`, `zombieName`, `slugify`. It doesn't import
  `sanity`, so the site could use it too.
- `sanity.config.ts`: `document.actions` adds the three actions right after Publish,
  for bugs only

**Decisions that go beyond the brief:**
- **"Mark fix merged" also works on a walking zombie.** Without that, a zombie could
  never start its own lifecycle.
- **The actions write straight to the published document,** in one change guarded by
  its revision (`ifRevisionId`). There is no draft step, so nothing gets left behind.
  They are disabled while the bug has unpublished edits ("Publish or discard your
  changes first"), because that draft would later overwrite the new status.
- **The zombie is created already published,** so it appears on the site straight
  away, then opens in the Studio. Writing its epitaph is then an ordinary edit and
  publish.
- **A grave only rises once.** "Report resurrection" is disabled on a grave a zombie
  already came from ("It already rose as …"), and this is checked again at the moment
  of confirming. The next resurrection belongs on the zombie's own grave, which keeps
  every chain a single line.
- **The zombie copies the language and cause of death, but not the severity.** Its
  slug gets `-2`, `-3` and so on if the name is already taken.

**End-to-end test:** a production build, with headless Chrome clicking the real Studio
buttons. Five temporary bugs covered every situation, and **all 34 checks passed**:
- **Enabled/disabled states** in each status, including "🪦 Can bury in 7 days" right
  after a fix and "Can bury in 4 days" for a fix 3 days old.
- **Mark fix merged and Declare buried** wrote today's UTC date, and no drafts were
  left behind.
- **Cancel in the confirm dialog** created nothing.
- **Unpublished edits** disabled all three actions.
- **Resurrecting a buried bug** created "(Zombie #1)" with the correct fields and a
  unique slug, and opened it in the Studio.
- **A grave tab that was already open** showed "Risen from this grave" 1.4s later,
  without reloading.
- **The old grave could not rise twice.**
- **A zombie of a zombie** was named "(Zombie #2)", not "(Zombie #1) (Zombie #2)", and
  its page lists both past lives, oldest first.

Every temporary document was deleted afterwards. After the deploy, a read-only check of
the live Studio showed the right menu for each of the three real bugs.

### What went wrong and how we fixed it

- **"Report resurrection" stayed disabled right after another action.** My first
  version disabled it while it was still checking whether the grave had already
  risen. Sanity re-creates the action component whenever the document changes, so
  each change restarted that check, and the button was disabled for a second or two.
  The test clicked during that window, and the confirm dialog never opened. Fix: don't
  block while checking. The button is only disabled once a zombie is known to exist,
  and the final check happens when you confirm.
- **Test script problem, not an app bug:** headless Chrome slows down tabs in the
  background, so the Studio stalled after the test opened a second tab.
  `Page.bringToFront` fixed it.
- **Signing the headless Studio in:** the Studio keeps its token in `localStorage`
  under `__studio_auth_token_&amp;lt;projectId&amp;gt;`. The test put my CLI login token there
  before the page loaded, in a throwaway Chrome profile, and never printed it.
- **Still open: backfilling old bugs.** `fixMergedAt`, `buriedAt` and
  `timesResurrected` are read-only in the Studio, and the actions always use today. So
  a bug fixed months ago can't be given its real dates by hand; only a script or the
  API can do that.

### Sanity notes for the write-up

**How document actions work, in plain words:**
- The buttons at the bottom of a document in Sanity Studio (Publish, Duplicate, Delete,
  and so on) are all *document actions*, and you can add your own.
- **An action is a small React component.** Sanity renders it for the open document
  and gives it the document's current state: the published version, any unpublished
  draft, its ID and type. It returns a description of a button: a label, whether it's
  disabled, a tooltip, what happens on click, and optionally a dialog such as a
  confirm box.
- **It updates itself.** Because it's a component, Sanity re-renders it whenever the
  document changes. That's how "Can bury in 4 days" and the enabled/disabled states
  stay correct without any refresh logic.
- **It can use the Studio's hooks:** `useClient` to write data, `useRouter` to open
  another document, and `useDocumentStore().listenQuery` for a live GROQ subscription.
- **It runs as the signed-in person.** The action runs in the browser with that
  person's Sanity permissions, so there's no API token in the code.
- **You register actions in `sanity.config.ts`.** `document.actions` is a function
  that receives Sanity's default list plus some context (which type of document, and
  so on) and returns the list to show. The first one becomes the big button; the rest
  go in the "…" menu. Here the lifecycle actions go right after Publish, and only for
  bugs.

**Other things worth mentioning:**
- **Actions can own read-only fields.** Marking fields `readOnly` stops people editing
  them by hand while code can still set them. That turns the dates and the
  resurrection counter into a record of what actually happened.
- **Drafts are separate documents.** Editing creates a `drafts.&amp;lt;id&amp;gt;` copy, and
  publishing copies it over the real one. These actions skip that step and change the
  published document directly, with `ifRevisionId` (the write fails if someone else
  changed the bug first).
- **The built-in dialogs are declarative:** `dialog: {type: 'confirm', message,
  onConfirm, onCancel}`, and `navigateIntent('edit', {id, type})` opens a document.
- **The whole lifecycle runs on the same live pipeline as the site.** Clicking an
  action updates the homepage and grave pages within about a second, through the
  Studio's `&amp;lt;SanityLive /&amp;gt;` and the webhook.
EOF
git add NOTES.md &amp;amp;&amp;amp; git commit -q -m "Add the Phase 5 notes

Co-Authored-By: Claude Opus 5.5 &amp;lt;noreply@anthropic.com&amp;gt;" &amp;amp;&amp;amp; GIT_TERMINAL_PROMPT=0 git push 2&amp;gt;&amp;amp;1 | tail -1; git log --oneline | head -2; git status --short | wc -l | xargs echo "uncommitted files:"&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                    &lt;div class="tool-section"&gt;
                      &lt;div class="tool-section-label"&gt;Output&lt;/div&gt;
                      &lt;pre class="agent-session-pre"&gt;&lt;code&gt;- **Which Sanity CLI runs matters.** `npx sanity` is the project's CLI (v5), and
  `npx sanity@latest` is the newest (v8), which adds `api`, `organizations` and more.
   afae328..f638d72  main -&amp;gt; main
f638d72 Add the Phase 5 notes
4352c77 Add lifecycle document actions to the Studio
uncommitted files: 0&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;

      &lt;div class="agent-session-message agent-session-assistant"&gt;
        &lt;div class="agent-session-role-badge agent-session-role-assistant"&gt;
          Agent
        &lt;/div&gt;
        &lt;div class="agent-session-content"&gt;
                &lt;div&gt;
                  &lt;div class="agent-session-text agent-session-text-collapse"&gt;
                    &lt;p&gt;The lifecycle actions are live in the Studio at &lt;a href="https://bug-graveyard.vercel.app/studio" rel="noopener noreferrer"&gt;https://bug-graveyard.vercel.app/studio&lt;/a&gt; (open a bug, then the "…" menu next to Publish). They're committed (&lt;code&gt;4352c77&lt;/code&gt;, notes in &lt;code&gt;f638d72&lt;/code&gt;), pushed and deployed. Type-check, lint, schema validation and the build all pass.&lt;/p&gt;



&lt;p&gt;&lt;strong&gt;What's there:&lt;/strong&gt; &lt;a href="sanity/actions/lifecycle.tsx"&gt;sanity/actions/lifecycle.tsx&lt;/a&gt; holds the three actions, and &lt;a href="sanity/lib/lifecycle.ts"&gt;sanity/lib/lifecycle.ts&lt;/a&gt; holds &lt;code&gt;BURIAL_WAIT_DAYS = 7&lt;/code&gt; plus the date helpers. &lt;a href="sanity.config.ts"&gt;sanity.config.ts&lt;/a&gt; adds the actions right after Publish, for bugs only. Dates are UTC, so at 02:00 in India they record the previous day.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Decisions that go beyond your brief:&lt;/strong&gt;&lt;br&gt;
- &lt;strong&gt;"Mark fix merged" also works on a walking zombie.&lt;/strong&gt; Otherwise a zombie could never start its own lifecycle.&lt;br&gt;
- &lt;strong&gt;The actions change the published bug directly,&lt;/strong&gt; in a single change that fails if someone else edited the bug first. No draft is ever created. They're disabled while you have unpublished edits, because your draft would later overwrite the new status.&lt;br&gt;
- &lt;strong&gt;The new zombie is created already published,&lt;/strong&gt; so it shows on the site straight away, then opens for you to write its epitaph.&lt;br&gt;
- &lt;strong&gt;A grave only rises once.&lt;/strong&gt; A second resurrection belongs on the zombie's grave, which keeps each chain a single line.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How I tested it:&lt;/strong&gt; a script clicked the real Studio buttons against a production build, using five temporary bugs, and all 34 checks passed. They cover:&lt;br&gt;
- every enabled/disabled state, including "🪦 Can bury in 4 days";&lt;br&gt;
- today's UTC dates, with no drafts left behind;&lt;br&gt;
- cancelling the confirm dialog;&lt;br&gt;
- being blocked by unpublished edits;&lt;br&gt;
- zombies of zombies (named "(Zombie #2)");&lt;br&gt;
- the site updating within about 1.5 seconds, including an already open grave page.&lt;/p&gt;

&lt;p&gt;The test bugs are deleted. After deploying, a read-only check confirmed the live Studio shows the right menu for your 3 real bugs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A bug the test caught:&lt;/strong&gt; right after one action changed a bug, "Report resurrection" was briefly disabled. My check for "has this grave already risen?" restarted after every change and blocked the button while running. It now only disables once a zombie is known to exist, and checks again when you confirm.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Still open:&lt;/strong&gt; the dates and resurrection count are read-only and the actions always use today. So an old bug can't be given its real historical dates in the Studio; only a script or the API can do that.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Be careful trying it:&lt;/strong&gt; these actions change your real data. "Report resurrection" on "NullPointerException in checkout" will create a real zombie.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For your write-up: how document actions work&lt;/strong&gt;&lt;br&gt;
- Every button at the bottom of a Sanity document (Publish, Duplicate, Delete) is a &lt;em&gt;document action&lt;/em&gt;, and you can add your own.&lt;br&gt;
- An action is a small React component. Sanity gives it the document's current state (the published version and any unpublished draft), and it describes a button: label, disabled or not, tooltip, what happens on click, and optionally a confirm dialog.&lt;br&gt;
- Because it's a component, it updates whenever the document changes. That keeps labels like "Can bury in 4 days" current with no extra code.&lt;br&gt;
- It runs in the browser as the signed-in person, using their permissions, so there's no API token in the code.&lt;br&gt;
- You register actions in &lt;code&gt;sanity.config.ts&lt;/code&gt; with &lt;code&gt;document.actions&lt;/code&gt;. That function receives Sanity's default list and returns the list to show. The first one becomes the big button, and the rest go in the "…" menu.&lt;/p&gt;

&lt;p&gt;There's a longer version of this in the Phase 5 entry of &lt;a href="NOTES.md"&gt;NOTES.md&lt;/a&gt;.&lt;/p&gt;

                  &lt;/div&gt;
                  Show more
                &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;

  &lt;div class="agent-session-footer"&gt;
    &lt;span class="agent-session-meta"&gt;
        41 messages (range 358-398) of 719 total
    &lt;/span&gt;
  &lt;/div&gt;
&lt;/div&gt;



&lt;h2&gt;
  
  
  What I learned
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Document actions go a long way.&lt;/strong&gt; They're just React components that re-render with the document, so a live countdown like "Can bury in 4 days" needs no refresh logic. And they run as the signed-in editor, so there's no token in the code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test against a production build from day one.&lt;/strong&gt; &lt;code&gt;npm run dev&lt;/code&gt; hid both live-update bugs. I'd also connect Vercel to GitHub at the start: I only added the login connection near the end, so most deploys were a manual &lt;code&gt;vercel deploy --prod&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The App SDK reuses the Studio's ideas outside the Studio.&lt;/strong&gt; Handles, projections and document actions, all live, in a plain React app. Sharing one rules file kept the Studio and the Morgue from drifting apart.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workflows can model this lifecycle,&lt;/strong&gt; and the in-memory test engine makes a rule like "7 days" easy to test by moving the clock. But a real integration needs Studio 6 and a runtime, so for now it stays an experiment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Directing an agent works best in small phases,&lt;/strong&gt; each with a clear brief, a test and a build-log entry. That log is also what this post was fact-checked against.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for reading. May your bugs rest in peace. 🪦&lt;/p&gt;

</description>
      <category>devchallenge</category>
      <category>sanitychallenge</category>
      <category>sanity</category>
      <category>nextjs</category>
    </item>
  </channel>
</rss>
