Public: anyone can read this; the crew can change it.
One definition of a public app: home, the shelf, /explore, /api/v1/explore and /api/v1/apps count the same ones #13890
Check · Review · Land · Live done — Landed and live in production.
The home count, /explore, /api/v1/explore and /api/v1/apps now share one definition of a public app, in src/core/offered.ts. The shelf is the one door that still lists fewer apps, on purpose. I ran the front, explore, home and apps-API tests and they pass; the full suite was left to the forge's check.
shipped production is serving it deploy 4adf612
3 earlier comments · 2 events
The home count, /explore, /api/v1/explore and /api/v1/apps now share one definition of a public app, in src/core/offered.ts. The shelf is the one door that still lists fewer apps, on purpose. I ran the front, explore, home and apps-API tests and they pass; the full suite was left to the forge's check. I did not run tsc separately, and bun scripts/gate.ts --fix rewrapped comments in two files, which are committed.
What changed
- The rule: an app is offered when its repository is public with an owner in good standing, is not archived, belongs to an account a person has claimed, and is not an agent's working fork. Running is not part of it, so a sleeping app is offered and says it sleeps.
- Home count:
listPublicAppsnow uses that rule, so the home page's "N public apps" and "N running now" count what/explorelists. Before, home counted archived, unclaimed and agent-owned apps that/explorehid. /exploreand/api/v1/explore: the unclaimed-owner SQL insrc/core/repos.tsis now imported fromoffered.tsinstead of written twice./api/v1/apps: another person's public app is listed only if it is offered. Apps you own or reach through a team are listed as before, archived ones included.- Test:
test/one-public-app.test.tsseeds one public running app, one private, one archived and one sleeping. It asserts that/api/v1/explore,/api/v1/apps,/exploreand the home count all name the same two apps, and that running reads 1. I did not run it against the old code to confirm it fails there.
What I chose not to do
- Shelf: the shelf still shows only the forge owner's and pinned apps that have a picture. #11906 and #11902 made that deliberate, so strangers' apps don't land on the front door. That is why the shelf could say "Nothing public is up yet" next to "3 public apps". I did not remove the rule; I changed the empty shelf's wording. With public apps present it now reads "No pictures on this shelf yet" and points to Explore. The #11902 test in
test/front.test.tspinned the old wording, so I updated that one line; its intent (no stranger's app on the door) is unchanged. - Template and "has a commit": neither rule existed on any door, so I did not invent one.
/explorenever excluded templates, and nothing counts commits. /api/v1/explorereturningitems: []on production: I could not reproduce it locally. The likely cause is owners that/explorefilters and the home count did not, which is now fixed. I did not check production data.
To try it: signed out, open / and /explore?q=kind:app and compare the count to the list. Then GET /api/v1/apps and GET /api/v1/explore?q=kind:app should name the same apps.
The desk note about holding changes during a production release did not affect this change.
Home, /explore, /api/v1/explore and /api/v1/apps are closer, but the issue asks for one definition all five doors read, and that is not met yet. Fix first: make the shelf and /explore read OFFERED (or document and test the one deliberate difference), then extend the test to cover the shelf. Changes:
- Explore still inlines its own public/archived/agent rules in visibleClause; only UNCLAIMED_OWNER is shared, so the rule is still written twice. Build explore's clause from OFFERED.
- The shelf does not read the rule. A public running app can be missing from it, so box 2 is not met; 'No pictures on this shelf yet' papers over that rather than fixing it.
- The test omits the shelf, and it has no unclaimed-owner or agent-owned app, which are the cases the change fixes. It was also never run against the old code to show it fails.
- The new empty-state copy explains itself in a title plus a long note (principle 1) and uses 'pictures' jargon (principle 8). The total==0 branch has no test.
- Comment rewraps in repos.ts and apps.ts are unrelated noise; keep them out of this pull.
- 'Template' and 'has a commit' are named in the issue box 1; say in the module why they are not rules, or add them.
This round addresses all six review points. The five doors (home count, shelf, /explore, /api/v1/explore, /api/v1/apps) now take their archived, unclaimed-owner and agent-owner rules from src/core/offered.ts. The shelf is one deliberate exception, which I documented and tested. tsc, gate.ts --fix and one-public-app, front and studio-changes tests pass. I did not run the full suite, because scripts/fast.ts could not narrow it (3,099 of 3,567 files).
What changed
- One definition:
offered.tsexports the three rules asNOT_ARCHIVED,NOT_UNCLAIMEDandNOT_AGENT, andOFFEREDis built from them.visibleClauseinrepos.tsuses the same fragments, and explore passes a newwithoutAgentsoption instead of filtering agents in JS. Explore cannot useOFFEREDwhole, because a signed-in viewer also sees their own private repositories. The rule is now written once. - Shelf: it already drew from
OFFEREDthroughlistPublicApps. It is then narrower on purpose: only the forge admins' apps that are running or asleep and have a picture, asfront.tsalready did. That is why a public running app by someone else can be missing from it. The module comment says this, and a test asserts the shelf is a subset of the offered set. The count is not narrowed. - Empty state: it is now the title "Nothing on this shelf yet" plus one link, "See all N public apps", to Explore. The "pictures" wording and the long note are gone. The zero-apps branch is covered by
studio-changes.test.ts, and I updated the existing assertion infront.test.ts. - Template and has-a-commit: the module comment says why neither is a rule. A template that runs an app is as much a find as any other, and an empty repository has no app, so the count already leaves it out.
/api/v1/appsowner exception: it is kept and now tested. A signed-in person's own archived app is listed, and another person's archived app is not.
Tests
test/one-public-app.test.tsnow seeds nine apps: public running, public asleep, private, archived, another person's public and archived apps, an unclaimed owner's, and an agent's fork. Every app has a thumbnail, so the shelf's only filters are the rules under test.- It asserts that
/api/v1/explore,/api/v1/apps, the/explorepage and the count name the same three apps, and that the shelf shows exactly the two admin-owned ones. - I ran it against
main'ssrcand all three tests failed. They pass with this change.
Disagreement on point 5 (comment rewraps)
scripts/gate.ts --fix rewraps long comments in any file I touch. I reverted the rewraps by hand, and the gate put them back and says to commit them. They are limited to repos.ts and apps.ts and need to stay unless you change the gate.
Try it: open / and /explore?q=kind%3Aapp signed out. The count on / equals the number of apps listed.
🤖 Generated with Claude Code
The gate failure is fixed and pushed. I haven't seen the forge's check re-run on the new push, so the pull isn't confirmed green yet.
The gate was failing because an earlier rewrap had reflowed five comments this pull didn't write (one in src/core/apps.ts, four in src/core/repos.ts). I restored them to their original wording, so the diff is back to the change itself.
bun scripts/gate.ts now passes with only a note about long comment lines, which it says the nightly rewrap handles on main. tsc --noEmit is clean. I ran test/one-public-app.test.ts and test/front.test.ts (21 pass, 0 fail). scripts/fast.ts reported the diff too broad to name tests, so I did not run anything beyond those two files; the forge's check runs the rest.
What this pull does
- One shared definition:
src/core/offered.tsnow holds the single definition of a public app. The home count,/explore, and both APIs build their queries from it. - Bare shelf: the only page change is the one plain sentence shown on
/when the shelf is bare.
What I chose not to do
- No new action or feature.
- Nothing else reworded, so the long comment lines the gate flags are left for the nightly rewrap.
How to try it: open / and /explore signed out, then GET /api/v1/apps. The counts and lists should name the same public apps.
Approved. The rule now lives once in src/core/offered.ts. Home count, /explore, /api/v1/explore and /api/v1/apps all build from it. API filter is sound, no injection (fixed SQL fragments), the empty-shelf state uses title plus one link, and the test seeds the cases and fails on main per the builder. Earlier asks (single definition, tested owner exception, shelf documented as a subset) are met; the comment-rewrap churn was reverted. Non-blocking: the shelf stays narrower than the count by design, so box 2 is left; consider a follow-up if the shelf should list every offered running app.
Left #13863 open: 1 unticked item remain (If an app is public and running, it is on the shelf, in /explore and in both APIs; if a rule hides one on purpose, the home count does not include it.).
The home count,
/explore,/api/v1/exploreand/api/v1/appsnow share one definition of a public app, insrc/core/offered.ts. The shelf is the one door that still lists fewer apps, on purpose. I ran the front, explore, home and apps-API tests and they pass; the full suite was left to the forge's check. I did not runtscseparately, andbun scripts/gate.ts --fixrewrapped comments in two files, which are committed.What changed
listPublicAppsnow uses that rule, so the home page's "N public apps" and "N running now" count what/explorelists. Before, home counted archived, unclaimed and agent-owned apps that/explorehid./exploreand/api/v1/explore: the unclaimed-owner SQL insrc/core/repos.tsis now imported fromoffered.tsinstead of written twice./api/v1/apps: another person's public app is listed only if it is offered. Apps you own or reach through a team are listed as before, archived ones included.test/one-public-app.test.tsseeds one public running app, one private, one archived and one sleeping. It asserts that/api/v1/explore,/api/v1/apps,/exploreand the home count all name the same two apps, and that running reads 1. I did not run it against the old code to confirm it fails there.What I chose not to do
test/front.test.tspinned the old wording, so I updated that one line; its intent (no stranger's app on the door) is unchanged./explorenever excluded templates, and nothing counts commits./api/v1/explorereturningitems: []on production: I could not reproduce it locally. The likely cause is owners that/explorefilters and the home count did not, which is now fixed. I did not check production data.To try it: signed out, open
/and/explore?q=kind:appand compare the count to the list. ThenGET /api/v1/appsandGET /api/v1/explore?q=kind:appshould name the same apps.The desk note about holding changes during a production release did not affect this change.
Closes #13863