Skip to content

fix(worker): label the current /health surface and /api/signups intake as The Website Appraisal, not the retired Agent Desk - #164

Merged
nish3451 merged 10 commits into
mainfrom
fix/worker-surface-truth-lane1
Aug 12, 2026
Merged

fix(worker): label the current /health surface and /api/signups intake as The Website Appraisal, not the retired Agent Desk#164
nish3451 merged 10 commits into
mainfrom
fix/worker-surface-truth-lane1

Conversation

@nish3451

@nish3451 nish3451 commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

What

Self-directed cycle item (tier-1/2 public-promise gap): the worker's machine-readable public truth surfaces still named the retired Agent Desk as the current product, and the /health verdict measured the retired product's machinery.

  1. GET /health (unauthenticated, served on tinystudio.io) returned "surface": "agent-desk" — the demoted, retired surface — while every owned public surface says the current offer is The Website Appraisal.
  2. /api/signups — used only by the current appraisal intake on / and /audit — persisted every lead with source: "agent-self-serve", the retired surface's name, contaminating the D1 lead labels.
  3. /health ok verdict gated on the retired Agent Desk's runtime dependencies — the AI binding and the agent_runs / agent_usage_limits tables — none of which the current Website Appraisal uses. The appraisal's only backend dependency is the D1 email_signups table behind /api/signups, so /health could report ok:false (503) while the current product was healthy, or ok:true while the signup intake was broken.

Fix

  • src/worker.js: new APPRAISAL_SURFACE = "website-appraisal" constant used for the /health surface label and the /api/signups source label. The legacy /api/agent-audit path keeps its own agent-self-serve labels (it IS the retired surface).
  • src/worker.js: /health readiness verdict now keys off db + signupsTable (the current intake path). The retired AI binding and legacy tables stay reported as informational checks — never as the current product's readiness.
  • scripts/test-agent-worker.mjs: four deterministic tests — /health names the current offer (not agent-desk), the verdict stays green with the current intake present and all retired machinery absent, the current intake signup carries website-appraisal (never agent-self-serve), and the legacy agent-audit path keeps agent-self-serve.
  • scripts/check-site.mjs: static source guards pin the truthful health verdict shape so the legacy machinery cannot silently gate /health again.

Non-duplication

Checked all 57 open PRs: none touch healthResponse, signupResponse, the agent-self-serve label, or the /health verdict logic. Existing #116 (monthly cap) and #161 (rate-limit test branches) are adjacent but disjoint.

Verification

  • npm run check green (TinyStudio.io checks passed)
  • npm test: 58/58 worker tests, 16/16 contract, 8/8 product-contract, 6/6 headings, 7/7 sitemap
  • npm run check:render-blocking: all six pages PASS
  • npm run deploy:dry-run: green
  • git diff --check clean

Live walk (2026-08-12): all 8 routes 200; desktop 1280 + mobile 390x844 zero overflow, zero console errors (only the known /brief-requested gtag CSP error owned by #136/#52); no broken internal links.

Summary by CodeRabbit

  • New Features
    • Website Appraisal intake now uses a dedicated surface label.
    • Health status reports Website Appraisal readiness and includes signup availability in its database checks.
  • Bug Fixes
    • Preserved legacy Agent Desk status fields and source labels for existing records.
    • Updated readiness reporting to reflect the current signup intake path.
  • Tests
    • Added coverage for intake labeling, health status naming, readiness checks, and legacy record compatibility.

…e as The Website Appraisal, not the retired Agent Desk

The public /health endpoint on tinystudio.io reported surface=agent-desk
and the current appraisal intake persisted every lead with the retired
self-serve source label. Both machine-readable truth surfaces contradicted
the current offer. Rename to website-appraisal; the legacy /api/agent-audit
path keeps its agent-self-serve labels. Add deterministic worker tests:
/health names the current offer, current signups carry the current source,
and the legacy path keeps its own label.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nish3451 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5b3dc807-a674-4d36-a73f-2de15d98e641

📥 Commits

Reviewing files that changed from the base of the PR and between 25b2f90 and 094ceaf.

📒 Files selected for processing (2)
  • scripts/test-agent-worker.mjs
  • src/worker.js
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/worker.js
  • scripts/test-agent-worker.mjs

📝 Walkthrough

Walkthrough

The worker now labels current signup intake as website-appraisal. The /health endpoint reports the Website Appraisal surface and bases readiness on database and email_signups availability. Legacy Agent Desk fields and source labels remain available.

Changes

Website Appraisal health contract

Layer / File(s) Summary
Current and legacy intake source labels
src/worker.js, scripts/test-agent-worker.mjs
Current appraisal submissions use website-appraisal. Legacy Agent Desk submissions retain agent-self-serve.
Health readiness and contract validation
src/worker.js, scripts/test-agent-worker.mjs, scripts/check-site.mjs
/health checks database and email_signups availability, reports the appraisal surface, and retains legacy status fields. Tests and static guards validate these rules.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant HealthClient
  participant WorkerHealth
  participant Database
  HealthClient->>WorkerHealth: Request /health
  WorkerHealth->>Database: Check database and email_signups availability
  Database-->>WorkerHealth: Return availability status
  WorkerHealth-->>HealthClient: Return Website Appraisal surface and readiness
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes to the /health surface and /api/signups intake labels.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/worker-surface-truth-lane1

Comment @coderabbitai help to get the list of available commands.

… the retired Agent Desk machinery

The /health surface is machine-readable public truth. Its ok verdict
previously gated on the retired self-serve Agent Desk's dependencies —
the AI binding and the agent_runs / agent_usage_limits tables — none of
which the current Website Appraisal product uses. The appraisal's only
backend dependency is the D1 email_signups table behind /api/signups,
so /health could report ok:false (503) while the current product was
healthy, or ok:true while the signup intake was broken.

The verdict now keys off db + signupsTable; the AI binding and legacy
tables remain reported as informational legacy checks. Tests and a
deterministic source guard pin the shape so the legacy machinery cannot
silently gate the current product's readiness again.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nish3451 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
scripts/test-agent-worker.mjs (1)

1048-1077: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a negative readiness case for a missing email_signups table.

The current test only verifies the healthy intake case. The source guard accepts expressions such as checks.db && checks.signupsTable || checks.ai, which can return a false healthy result when email_signups is unavailable.

  • scripts/test-agent-worker.mjs#L1048-L1077: Add a case where the database is configured, email_signups is absent, and AI is present. Assert status 503 and body.ok === false.
  • scripts/check-site.mjs#L183-L198: Require the complete readiness declaration const ok = checks.db && checks.signupsTable;, or parse the readiness expression. Do not use a partial substring check.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/test-agent-worker.mjs` around lines 1048 - 1077, Extend the health
tests around the existing worker.fetch health case in
scripts/test-agent-worker.mjs lines 1048-1077 with a configured DB where
email_signups is absent and AI is present, asserting status 503 and body.ok is
false. In scripts/check-site.mjs lines 183-198, validate the complete readiness
declaration “const ok = checks.db && checks.signupsTable;” or parse the
readiness expression rather than relying on a partial substring match.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/test-agent-worker.mjs`:
- Around line 1048-1077: Extend the health tests around the existing
worker.fetch health case in scripts/test-agent-worker.mjs lines 1048-1077 with a
configured DB where email_signups is absent and AI is present, asserting status
503 and body.ok is false. In scripts/check-site.mjs lines 183-198, validate the
complete readiness declaration “const ok = checks.db && checks.signupsTable;” or
parse the readiness expression rather than relying on a partial substring match.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3cfabe5e-2eb1-4c87-af6c-67d5e0db474b

📥 Commits

Reviewing files that changed from the base of the PR and between b42ed76 and 25b2f90.

📒 Files selected for processing (3)
  • scripts/check-site.mjs
  • scripts/test-agent-worker.mjs
  • src/worker.js

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 25b2f905c1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/worker.js
"SELECT name FROM sqlite_master WHERE type = 'table' AND name IN ('email_signups', 'agent_runs', 'agent_usage_limits')"
).all();
const tables = new Set((tableResult.results || []).map((row) => row.name));
checks.signupsTable = tables.has("email_signups");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify the intake schema before returning healthy

When email_signups exists but migration 0004_signup_website.sql has not been applied, this name-only check sets signupsTable to true and /health returns 200, although saveEmailSignup immediately fails because its insert references the missing website column. This recreates the green-health/broken-intake state the change is intended to prevent; validate the required columns or migration version rather than only the table name.

Useful? React with 👍 / 👎.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nish3451 has reached the 50-credit limit for trial accounts. To continue receiving code reviews, upgrade your plan.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@nish3451
nish3451 merged commit aeb34a9 into main Aug 12, 2026
3 checks passed
nish3451 added a commit that referenced this pull request Aug 14, 2026
… as already fixed and live (#205)

PR #164 (aeb34a9, merged 2026-08-13) already labeled the live worker
/health surface and the /api/signups intake as The Website Appraisal
(website-appraisal); the item queued [unreviewed-by-opus] against
already-fixed state. Re-verified on current main (533ee19): worker
tests 76/76 including the two /health surface guards, npm run check
green, and live https://tinystudio.io/health reports
surface:"website-appraisal" with ok:true as probed 2026-08-14.

Co-authored-by: nish3451 <nish3451@users.noreply.github.com>
Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant