Skip to content

feat(hub): show applied learnings on the selected Build - #392

Draft
nshki wants to merge 9 commits into
nshki/feat/hub/evaluation-settingsfrom
nshki/feat/hub/applied-learnings
Draft

nshki wants to merge 9 commits into
nshki/feat/hub/evaluation-settingsfrom
nshki/feat/hub/applied-learnings

Conversation

@nshki

@nshki nshki commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Why

Agents can already report which learnings they applied while building a prototype, but nobody can see those reports. Before Hub can judge whether a learning helped, people need to see what the agent said it used, on the Build it made. This shows those reports on the prototype page.

What changes

When someone opens a Build with ?build=N, Hub looks up usage reports made for that Build's commit. If there are any, More actions offers Applied learnings. The dialog lists each learning with the version the agent received. It links to before and after screenshots when the repository allows screenshots. The dialog says the list is the agent's report and is not verified.

The learning package gains a usage --commit <sha> command that lists those reports. Hub calls it the same way it reads learning history. Hub serves screenshots itself, and only while the screenshot consent they were saved under is still active.

sequenceDiagram
  participant Browser
  participant Hub
  participant Store as Learning store
  Browser->>Hub: Open prototype ?build=N
  Hub->>Store: usage --commit <sha>
  Store-->>Hub: Reports for that commit
  Hub-->>Browser: Applied learnings
  Browser->>Hub: View screenshot
  Hub->>Hub: Check active screenshot consent
  Hub-->>Browser: PNG or 404
Loading

Needs design review

  • Hub matches a report to a Build by the exact commit SHA when the page loads. It doesn't store a Build link.
  • A report without a prototype shows on every prototype in the repository built from that commit.
  • The lookup runs after the prototype page shows, so the list can appear a moment later than the rest of the page.
  • Withdrawing screenshot consent hides screenshots right away, before the deletion job removes them.
  • Applied learnings show only for Builds that have a preview.
  • Anyone who can read the library can see applied learnings, matching learning history.
  • The version an agent received is inferred from content and delivery time, since deliveries don't store a version number.
  • If Hub later deletes learnings, it will need to remove the hosted screenshot and its Hub record too.

Storybook screenshots

No story presentation changes. The dialog already existed in the stories; this connects it to real data.

Hub/Pages/Prototype review › Applied learnings (light, 1280×800)

Applied learnings dialog listing one learning with before and after screenshot links

@nshki
nshki added this pull request to stack #367 November 26, 2026 08:01
@nshki
nshki requested an adaptive review from Copilot November 26, 2026 08:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Unresolved consent and authorization gaps can expose screenshots after consent withdrawal or deletion and reveal learning content that should be withheld.

11 open issues
What changed in this PR

Connects agents’ unverified learning-use reports to Hub’s existing Applied learnings dialog for the selected Build.

Changes:

  • Adds commit-based usage queries to the learning store and CLI.
  • Loads reported learnings, versions, and screenshot links on the prototype page.
  • Adds screenshot endpoints, consent filtering, API contracts, tests, and documentation.
File Description
packages/​learning/​test/​cli.test.mjs Checks usage lookup and deletion behavior.
packages/​learning/​src/​store.mjs Retrieves usage reports for a commit.
packages/​learning/​src/​cli.mjs Adds the usage --commit command.
packages/​learning/​README.md Documents the usage command.
hub/​server/​routes/​index.ts Registers applied-learning and screenshot endpoints.
hub/​server/​routes/​api/​learnings/​types.ts Defines new route dependencies.
hub/​server/​routes/​api/​learnings/​screenshots/​get/​index.ts Serves screenshots after access checks.
hub/​server/​routes/​api/​learnings/​index.test.ts Tests the new endpoints’ success responses.
hub/​server/​routes/​api/​learnings/​create-learnings-route-dependencies/​index.ts Connects usage queries, consent filtering, and storage.
hub/​server/​routes/​api/​learnings/​create-learnings-route-dependencies/​applied-learnings.db.test.ts Tests screenshot reads after consent changes.
hub/​server/​routes/​api/​learnings/​applied/​get/​index.ts Validates and returns applied-learning requests.
hub/​server/​repositories/​agent-screenshots/​find-consented-agent-screenshot/​index.ts Finds screenshots under the configured grant.
hub/​server/​index.ts Supplies artifact storage to learning routes.
hub/​server/​domains/​learning/​types.ts Defines applied-learning records.
hub/​server/​domains/​learning/​get-applied-learnings/​index.ts Maps commit reports to prototype learnings.
hub/​server/​domains/​learning/​get-applied-learnings/​index.test.ts Tests report filtering and screenshot mapping.
hub/​docs/​learning-foundation.md Documents Build matching and screenshot behavior.
hub/​client/​application/​hub/​view-models/​prototype-show-data/​index.ts Builds dialog labels and screenshot links.
hub/​client/​application/​hub/​view-models/​prototype-show-data/​index.test.ts Tests selected-Build dialog data.
hub/​client/​application/​hub/​screens/​prototype-screen/​index.tsx Passes applied learnings into page data.
hub/​client/​application/​hub/​routes/​prototype/​index.tsx Loads applied learnings alongside prototype data.
hub/​client/​application/​hub/​routes/​prototype/​index.test.ts Tests fallback when learnings are unavailable.
hub/​client/​application/​hub/​routes/​fixtures/​preview-handlers/​index.ts Stubs usage requests in preview fixtures.
hub/​client/​application/​hub/​requests/​get-applied-learnings/​index.ts Adds the applied-learnings API request.
hub/​client/​application/​hub/​learnings-contracts/​types.ts Defines client response types.
hub/​client/​application/​hub/​learnings-contracts/​index.ts Validates applied-learning API responses.

Review effort: Max (adaptive)

Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/store.mjs Resolved
Comment thread packages/learning/src/store.mjs Resolved
nshki and others added 4 commits November 26, 2026 00:27
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
@nshki
nshki force-pushed the nshki/feat/hub/applied-learnings branch from 0a8ddda to c29d07d Compare November 26, 2026 08:30
nshki and others added 5 commits November 26, 2026 00:38
… in usage

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 25291e01-0146-42cb-ac6d-f5e1dd5c35f5
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.

2 participants