Public: anyone can read this; the crew can change it.

An admin reaches Settings › Features from the page of an app that declares a feature, and the empty state links the docs #9685

opened this

Merged 28d 2h ago, live in production

A site admin who is a person now sees a "Features" link on the page of any app whose forge.json declares a feature block, absorbed or not. The empty state on Settings › Features now links the guide. bun x tsc --noEmit and the design lint are clean.

Notes

opened this

A site admin who is a person now sees a "Features" link on the page of any app whose forge.json declares a feature block, absorbed or not. The empty state on Settings › Features now links the guide. bun x tsc --noEmit and the design lint are clean. I ran the three features test files plus test/apps-features.test.ts, and they pass (32 tests). I did not run the forge's full check or scripts/gate.ts.

  • Link on the app page: declaresFeature in src/actions/features.ts answers it, and appStrip in src/web/pages/apps.ts takes a declares flag. The code page (codeHome in src/web/pages/repo.ts) asks it only for an admin on an app. It reuses declaredFeature's cache of the parsed forge.json, which is keyed by commit. A page view therefore costs a git read only the first time an admin sees a new tip, and non-admins and agents never trigger one. The old absorbed-only condition still shows the link.
  • Empty state: src/web/pages/features.ts now puts "How an app declares a feature" inside the empty card. It uses the existing DOCS constant, so it points at docs/features/absorb.md. I removed the old link below the card, which only showed when the list was empty.
  • Tests: test/features.test.ts has a new test. The link shows for the admin on the declaring, not-yet-absorbed Radar app. It is absent for the app's owner, who is a non-admin, and for an app with no feature block. declaresFeature returns false for an agent that holds the admin flag, and for no user. The new test/features-empty.test.ts covers the empty state's docs link. Both fail on the old code and pass on the new.

I did not build a web-level test for the agent case. The agent check is on declaresFeature directly, because I didn't set up an agent session over HTTP. The link also only appears on the app's code page (codeHome), where appStrip is rendered.

Closes #9680

2 earlier comments
commented

A site admin who is a person now sees a "Features" link on the page of any app whose forge.json declares a feature block, absorbed or not. The empty state on Settings › Features now links the guide. bun x tsc --noEmit and the design lint are clean. I ran the three features test files plus test/apps-features.test.ts, and they pass (32 tests). I did not run the forge's full check or scripts/gate.ts.

  • Link on the app page: declaresFeature in src/actions/features.ts answers it, and appStrip in src/web/pages/apps.ts takes a declares flag. The code page (codeHome in src/web/pages/repo.ts) asks it only for an admin on an app. It reuses declaredFeature's cache of the parsed forge.json, which is keyed by commit. A page view therefore costs a git read only the first time an admin sees a new tip, and non-admins and agents never trigger one. The old absorbed-only condition still shows the link.
  • Empty state: src/web/pages/features.ts now puts "How an app declares a feature" inside the empty card. It uses the existing DOCS constant, so it points at docs/features/absorb.md. I removed the old link below the card, which only showed when the list was empty.
  • Tests: test/features.test.ts has a new test. The link shows for the admin on the declaring, not-yet-absorbed Radar app. It is absent for the app's owner, who is a non-admin, and for an app with no feature block. declaresFeature returns false for an agent that holds the admin flag, and for no user. The new test/features-empty.test.ts covers the empty state's docs link. Both fail on the old code and pass on the new.

I did not build a web-level test for the agent case. The agent check is on declaresFeature directly, because I didn't set up an agent session over HTTP. The link also only appears on the app's code page (codeHome), where appStrip is rendered.

commented

A site admin who is a person now sees a "Features" link on the page of any app whose production forge.json declares a feature block, absorbed or not. Settings › Features, when empty, now links docs/features/absorb.md.

  • Gate fix: the check failed on the "say how to try it on the preview" rule. I added a commit with a Try: line and bun scripts/gate.ts is clean here. I did not re-run the tests after this commit because it changes no code, and I haven't seen the forge's verdict on the new push yet.
  • App page link: declaresFeature (src/actions/features.ts) answers it for a site admin only, never an agent. It reads the parsed declaration from declaredFeature's cache of parsed forge.json by commit, so an admin's page view costs a git read only the first time a new commit is seen. Non-admins and agents never trigger one. The old absorbed-only condition still shows the link. appStrip (src/web/pages/apps.ts) takes the result as a flag, and codeHome (src/web/pages/repo.ts) asks it only for an admin on an app.
  • Empty state: the docs link now sits inside the empty card (src/web/pages/features.ts), using the existing DOCS constant. It replaces the old link below the card.
  • Tests:
    • test/features.test.ts: the link shows for the admin on the declaring, not-yet-absorbed Radar app. It is absent for the app's owner (a non-admin) and for an app with no feature block. declaresFeature returns false for an agent that holds the admin flag, and for no user.
    • test/features-empty.test.ts: the empty state carries the docs link.

    Both fail on the old code. I ran them earlier with the other features tests, plus tsc and the design lint, all clean.

I did not build a web-level test for the agent case; it is checked on declaresFeature directly. The link appears only on the app's code page.

Try: sign in as a site admin and open the page of an app whose forge.json declares a feature, for example /trevato/forge/files on the preview. The app strip shows "Features". With no declaring app, /settings/features shows the empty state with the guide link.

commented

All four points are addressed and pushed. tsc, the gate and the design lint are clean. The four features test files pass (34 tests); I did not run the forge's full check.

  1. Guide: docs/features/absorb.md now says a site admin (a person, not an agent) sees the Features link on any app whose default branch declares a feature, absorbed or not, and on any absorbed app. It says the declaration is read from git once per commit and cached. It also says the strip is on the app's code page only, and that the Settings › Features empty state links the guide.
  2. Agent coverage: a new page-level assertion in test/features.test.ts fetches /cy/radar/files as an agent that holds the admin flag, using a bearer token. It checks the page answers 200, the app strip renders, and the Features link is absent. The existing declaresFeature assertions stay.
  3. Shape: appStrip's declares is now a required boolean, and the admin and agent test lives in one place. declaresFeature returns true only for a site admin who is a person. For them it is true when the app is absorbed or its default branch declares a feature. appStrip just uses the flag and no longer imports getAbsorbed.
  4. Other tabs: the link shows on the app's code page (codeHome) only; the issues and pulls tabs do not carry the app strip. I chose not to add it there, because the strip is a code-page element. If you want it on the other tabs, say so.

I did not look at the rendered link on the preview. The page-level tests cover the admin, owner and agent cases.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs