Skip to content

feat(hub): show observed outcomes on a learning - #398

Draft
nshki wants to merge 5 commits into
nshki/feat/hub/score-applied-learningsfrom
nshki/feat/hub/observed-outcomes
Draft

nshki wants to merge 5 commits into
nshki/feat/hub/score-applied-learningsfrom
nshki/feat/hub/observed-outcomes

Conversation

@nshki

@nshki nshki commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Why

Hub now scores whether an applied learning helped, but nobody can see those scores. Repository administrators need to see how later Builds did with a learning's guidance before they can trust it, edit it, or retire it.

What changes

An active learning's detail view gains an "Observed outcomes" section. Each entry reads one score as a result. "Supports the guidance" means the agent followed it and the score was 3 or 4. "Possible concern" means it followed it and scored lower. "Inconclusive" means the agent didn't clearly follow it. Each entry shows the scorer's issue or reasoning, links to the Build it judged, and offers before and after screenshot links when screenshot consent is on. A learning with no scores reads "Not evaluated yet."

The learning package gains an outcomes <memory-id> command that lists a learning's scores with the version each one judged. Hub keeps only scores of the wording agents get now, then links each to a successful Build of its commit on a prototype people can open.

sequenceDiagram
    participant Page as Learning detail
    participant Hub
    participant CLI as replica-learning
    Page->>Hub: open learning
    Hub->>CLI: show --history
    Hub->>CLI: outcomes
    Hub->>Hub: keep current wording's scores
    Hub->>Hub: link each score to a visible Build
    Hub->>Hub: keep screenshots under active consent
    Hub-->>Page: outcomes, newest first
Loading

Needs design review

  • Only scores of the current wording are shown. Retiring and reinstating keep the wording, so their scores stay. An edit starts the list over.
  • Only active learnings show the section. Suggested and rejected learnings have not reached agents in their current form.
  • A score whose commit has no successful Build on a visible prototype is hidden rather than shown without context.
  • A score that names no prototype links to the newest visible successful Build of its commit.
  • Screenshots are links, not inline images, the same as the applied learnings dialog. They follow the shared screenshot-consent rule.
  • Every entry is labeled "Automated assessment". Reviewer-confirmed outcomes come in a later layer.
  • There is no per-prototype visibility filter beyond what Hub already hides, matching how review-comment evidence is shown.
  • The package reads all screenshot rows when listing outcomes, which may be slow for a repository with many screenshots.

Storybook screenshots

All screenshots use the light theme at 1280×800, scrolled to the new section.

Hub/Pages/Learnings: Active Detail and Not Evaluated Yet (new)

Active Detail

Hub/Pages/Learnings Active Detail, light, 1280×800

Not Evaluated Yet

Hub/Pages/Learnings Not Evaluated Yet, light, 1280×800

Hub/Pages/Learnings: stories that share the active fixture

Editing Learning

Hub/Pages/Learnings Editing Learning, light, 1280×800

Member Detail

Hub/Pages/Learnings Member Detail, light, 1280×800

Shared By This Repository

Hub/Pages/Learnings Shared By This Repository, light, 1280×800

Shared From Another Repository

Hub/Pages/Learnings Shared From Another Repository, light, 1280×800

Unavailable Wording

Hub/Pages/Learnings Unavailable Wording, light, 1280×800

nshki and others added 2 commits November 26, 2026 01:14
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 added this pull request to stack #367 November 26, 2026 09:26
@nshki
nshki requested an adaptive review from Copilot November 26, 2026 09:26
nshki and others added 3 commits November 26, 2026 01:31
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/observed-outcomes branch from 4070791 to bd52c03 Compare November 26, 2026 09:31
return [
{
...outcome,
...(withheld ? { reasoning: "", issue: null } : {}),

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

Sorting by per-prototype build numbers can link outcomes to the wrong build, while history fixtures omit required outcomes data and fail route-loader validation.

3 open issues
What changed in this PR

Adds observed outcomes to active learning details, connecting automated scores to the current guidance and visible Builds.

Changes:

  • Adds a learning-package outcomes command and typed store API.
  • Filters scores to current wording, links them to successful Builds, and applies screenshot consent.
  • Displays result labels, assessment summaries, and an empty state, with supporting tests, stories, and documentation.
File Description
packages/​learning/​src/​store.mjs Retrieves scored uses and their delivered versions.
packages/​learning/​src/​cli.mjs Adds the outcomes command.
packages/​learning/​README.md Documents outcome listing.
packages/​learning/​index.d.mts Declares the outcomes API.
packages/​learning/​conformance/​index.mjs Checks returned outcome records.
hub/​server/​routes/​api/​learnings/​types.ts Adds outcomes to route dependencies.
hub/​server/​routes/​api/​learnings/​create-learnings-route-dependencies/​learning-outcomes.db.test.ts Covers Build linking and hidden outcomes.
hub/​server/​routes/​api/​learnings/​create-learnings-route-dependencies/​index.ts Resolves Build links and consented screenshots.
hub/​server/​repositories/​prototypes/​list-successful-commit-builds/​index.ts Queries successful Builds on visible prototypes.
hub/​server/​domains/​learning/​types.ts Defines reported and linked outcomes.
hub/​server/​domains/​learning/​get-learning-history/​index.ts Loads scores and filters by current wording.
hub/​server/​domains/​learning/​get-learning-history/​index.test.ts Covers wording-version filtering.
hub/​docs/​learning-foundation.md Explains observed-outcome behavior.
hub/​client/​pages/​learnings-page/​stories.tsx Adds populated and empty outcome states.
hub/​client/​features/​learnings-library/​types.ts Defines outcome presentation data.
hub/​client/​features/​learnings-library/​styles.css Styles outcome labels and icons.
hub/​client/​features/​learnings-library/​index.tsx Renders assessments and evidence links.
hub/​client/​application/​hub/​view-models/​learnings-library/​index.ts Maps scores to newest-first display results.
hub/​client/​application/​hub/​view-models/​learnings-library/​index.test.ts Covers result mapping and links.
hub/​client/​application/​hub/​learnings-contracts/​types.ts Extends history response types.
hub/​client/​application/​hub/​learnings-contracts/​index.ts Validates outcome responses.

Review effort: Balanced (adaptive)

otherEvidenceCount: count,
contradictions: z.array(learningEvidenceResponseSchema),
otherContradictionsCount: count,
outcomes: z.array(
Comment on lines +20 to +27
orderBy: { number: "desc" },
select: {
commitSha: true,
number: true,
prototype: { select: { id: true, name: true, branchName: true } },
},
})
return builds.flatMap(({ commitSha, number, prototype }) =>
@@ -0,0 +1,39 @@
import type { PrismaClient } from "../../../generated/prisma/client.ts"
import { reviewablePrototypeWhere } from "../../prototype-index/reviewable-prototype-where/index.ts"
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.

3 participants