Skip to content

Commit 6e27e53

Browse files
Prototype AuthorCopilot
andcommitted
fix(hub): keep decision evidence private
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent c05119e commit 6e27e53

12 files changed

Lines changed: 23 additions & 48 deletions

File tree

‎hub/docs/decision-model-control-plane.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ Training preparation takes the PostgreSQL learning-operation lock, imports one r
3636

3737
Hub stages export, Build, screenshot, and taskset files in mode-0700 temporary directories, enforces fixed file, byte, prototype, Build, and screenshot bounds, creates a deterministic private taskset archive, and removes staging on success or failure. The worker regenerates every pinned input before transfer, refuses drift, verifies the runtime's stored taskset digest, and uses stable taskset and training idempotency keys.
3838

39-
The repository overview prepares the same inputs without transferring them and returns one deterministic preflight. Its temporary learning export uses preview mode, so reading the overview does not create an export record or consent-withdrawal follow-up. It counts eligible prototypes, Builds, pages, screenshots, questions, tasks, train/development/test assignments, and follows/breaks labels. It reports sorted reason codes and counts for withheld consent, missing or corrupt artifacts, unavailable storage, incomplete screenshot coverage, and incomplete review evidence. It does not return learning text, comment text, screenshot bytes, artifact keys, or cross-repository identifiers.
39+
The repository overview and retryable training preparation use temporary learning exports in preview mode. They do not create export records or consent-withdrawal follow-ups for files that Hub deletes after preparation. The durable training job owns the consent grant and pinned export digest for the runtime copy. Preflight counts eligible prototypes, Builds, pages, screenshots, questions, tasks, train/development/test assignments, and follows/breaks labels. It reports sorted reason codes and counts for withheld consent, missing or corrupt artifacts, unavailable storage, incomplete screenshot coverage, and incomplete review evidence. It does not return learning text, comment text, screenshot bytes, artifact keys, or cross-repository identifiers.
4040

4141
Completed Build evaluations remain owned by `DecisionBuildEvaluation`; Hub does not add a second evaluation store. Its bounded JSON summary keeps learning IDs, exact captured views, probabilities, and explanations generated by Hub from those probabilities. The decision-model overview projects those findings with the Build, candidate, promotion generation, digests, and evaluation timestamp. Learning text remains in the private learning store and is not copied into PostgreSQL.
4242

‎hub/server/domains/decision-model/create-decision-model-store/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,6 @@ export function createDecisionModelStore(database: PrismaClient): DecisionModelS
354354
findings: input.summary.findings.map((finding) => ({
355355
learning: {
356356
id: finding.learning.id,
357-
text: finding.learning.text,
358357
},
359358
route: finding.route,
360359
views: finding.views.map((view) => ({
@@ -363,6 +362,7 @@ export function createDecisionModelStore(database: PrismaClient): DecisionModelS
363362
})),
364363
followsProbability: finding.followsProbability,
365364
breaksProbability: finding.breaksProbability,
365+
explanation: finding.explanation,
366366
})),
367367
}
368368
return saveDecisionBuildEvaluation(database, {

‎hub/server/domains/decision-model/create-hub-decision-taskset-source/index.test.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,9 +427,8 @@ describe("createHubDecisionTasksetSource()", () => {
427427
vi
428428
.mocked(runLearningCommand)
429429
.mock.calls.map(([arguments_]) => arguments_)
430-
.filter(([command]) => command === "export")
431-
.some((arguments_) => arguments_.includes("--preview")),
432-
).toBe(false)
430+
.filter(([command]) => command === "export"),
431+
).toEqual([expect.arrayContaining(["--preview"]), expect.arrayContaining(["--preview"])])
433432
})
434433

435434
it("maps root and template captures to exact routes, viewports, themes, media, and digests", async () => {

‎hub/server/domains/decision-model/create-hub-decision-taskset-source/index.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,6 @@ export function createHubDecisionTasksetSource(options: HubDecisionTasksetSource
601601
tasksetSource.exportTrainingEvidence({
602602
repositoryId,
603603
actorMembershipId,
604-
preview: true,
605604
}),
606605
tasksetSource.readBuildArtifacts(repositoryId),
607606
])
@@ -692,7 +691,7 @@ export function createHubDecisionTasksetSource(options: HubDecisionTasksetSource
692691
}
693692
}
694693
},
695-
async exportTrainingEvidence({ repositoryId, actorMembershipId, preview = false }) {
694+
async exportTrainingEvidence({ repositoryId, actorMembershipId }) {
696695
return withLearningExecutionLock({
697696
databaseUrl: options.databaseUrl,
698697
run: async (signal) => {
@@ -765,7 +764,7 @@ export function createHubDecisionTasksetSource(options: HubDecisionTasksetSource
765764
"training",
766765
"--by",
767766
`human:${actorMembershipId}`,
768-
...(preview ? ["--preview"] : []),
767+
"--preview",
769768
"--out",
770769
exportPath,
771770
...common,

‎hub/server/domains/decision-model/evaluate-build-with-decision-model/index.ts‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,8 @@ export async function evaluateBuildWithDecisionModel(
5151
)
5252
}
5353
const findings = result.evaluations.map((evaluation) => {
54-
const question = prepared.questions[evaluation.learningId]
55-
const text =
56-
question &&
57-
typeof question === "object" &&
58-
"learning_text" in question &&
59-
typeof question.learning_text === "string"
60-
? question.learning_text
61-
: null
6254
return {
63-
learning: { id: evaluation.learningId, text },
55+
learning: { id: evaluation.learningId },
6456
route: prepared.route,
6557
views: prepared.views,
6658
followsProbability: evaluation.followsProbability,

‎hub/server/domains/decision-model/orchestrate-decision-training/index.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,6 @@ describe("decision training orchestration", () => {
955955
{
956956
learning: {
957957
id: "learning-1",
958-
text: "Use the compact navigation on settings pages.",
959958
},
960959
route: "/settings/profile",
961960
views: [

‎hub/server/domains/decision-model/prepare-decision-taskset/index.ts‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,7 @@ export interface DecisionTasksetPreparationSource {
88
repositoryId: string
99
actorMembershipId: string
1010
}): Promise<DecisionTrainingPreflight>
11-
exportTrainingEvidence(input: {
12-
repositoryId: string
13-
actorMembershipId: string
14-
preview?: boolean
15-
}): Promise<{
11+
exportTrainingEvidence(input: { repositoryId: string; actorMembershipId: string }): Promise<{
1612
bytes: Uint8Array
1713
consentGrantId: string | null
1814
digest: string

‎hub/server/domains/decision-model/types.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ export interface PreparedBuildEvaluation {
7070
export interface DecisionBuildEvaluationFinding {
7171
learning: {
7272
id: string
73-
text: string | null
7473
}
7574
route: string
7675
views: {

‎hub/server/repositories/decision-model-configurations/get-decision-model-overview/index.db.test.ts‎

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,9 @@ async function createEvaluation(
7171
summary: {
7272
findings: [
7373
{
74-
learningId: "mem_111111111111111111111111",
75-
views: [
76-
{
77-
route: "/",
78-
viewport: { width: 1440, height: 900 },
79-
theme: "light",
80-
},
81-
],
74+
learning: { id: "mem_111111111111111111111111" },
75+
route: "/",
76+
views: [{ viewport: "desktop", theme: "light" }],
8277
followsProbability: 0.8,
8378
breaksProbability: 0.2,
8479
explanation:

‎hub/server/routes/api/decision-model/create-decision-model-route-dependencies/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const evaluationSummarySchema = z
6161
findings: z.array(
6262
z
6363
.object({
64-
learning: z.object({ id: z.string(), text: z.string().nullable() }).strict(),
64+
learning: z.object({ id: z.string() }).strict(),
6565
route: z.string(),
6666
views: z.array(
6767
z

0 commit comments

Comments
 (0)