-
Notifications
You must be signed in to change notification settings - Fork 1
review eval: nine family-tripwire cases and the synthetic-saturation calibration finding #273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
6f40679
[jwies/review-fable-swap] review eval: mint three model-discriminatio…
jwbron c5d1ba8
[jwies/review-fable-swap] review eval: harden the three discriminatio…
jwbron 4488a79
[jwies/review-fable-swap] review eval: mint three more discrimination…
jwbron 91bffda
[review-eval/fable-case-calibration] review eval: sync discrimination…
jwbron c962c92
[jwies/review-fable-swap] review eval: mint a 29-file scale-hypothesi…
jwbron 0920d1a
[review-eval/fable-case-calibration] review eval: sync calibration ou…
jwbron a598292
[review-eval/fable-case-calibration] review eval: sync scale-case out…
jwbron c94c720
[review-eval/fable-case-calibration] review eval: add the changeset f…
jwbron 85469db
[review-eval/fable-case-calibration] review eval: address stack revie…
jwbron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "review": patch | ||
| --- | ||
|
|
||
| Eval-only: grow the corpus by seven live cases (nine across the stack, counting the two minted in the preceding corpus PR) across seven previously uncovered defect families (removed-behavior, cross-file chain, mechanical-churn needle, non-idempotent retry, check-then-act race, boundary double-count, and a 29-file cross-subsystem tree), add a mustNotFlagSpec precision probe to the churn case, and document the calibration finding in the operator guide: all nine stack cases calibrated saturated under the Opus roster across ~56 identical-arm samples, so hand-authored synthetics are family tripwires by construction and recall discrimination must be grown from real material (golden human-comment cases and production incident repros). No change to the shipped review workflow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
...lows/review/eval/corpus/synthetic-mutations/mutation-crossfile-report-redaction/case.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| { | ||
| "id": "mutation-crossfile-report-redaction", | ||
| "tags": [ | ||
| "mutation", | ||
| "cross-file", | ||
| "live" | ||
| ], | ||
| "category": "synthetic-mutation", | ||
| "description": "Model-capability discrimination case (cross-file inference-chain family), minted 2026-07-20 and hardened same day after v1 calibrated saturated (4/4 under the Opus roster; policy.ts stated the redaction rule outright). Seeing the defect now requires composing the files without any stated rule: share.ts sends the built rows to a partner webhook (an external destination), and the unchanged format-report.ts documents that the unset-redact default includes raw userId and email columns and 'is only safe for reports that stay inside the org'. The new buildPartnerReport calls formatReport(relevant) with no options, so partners receive raw identifiers and emails. The test asserts feature filtering only and passes either way. No single file looks wrong in isolation. Calibrated saturated under the Opus roster twice (runs 29763213774 v1 4/4, 29764855482 v2-hardened 4/4): the cross-file trace composes three small files reliably. Kept as the cross-file family's regression tripwire, not a discriminator; samples also post a companion missing-redaction-test finding (reviewer-side dedup gap), deliberately not annotated; postedCommentCount is deliberately unset because that companion makes the live posted count vary (0-3 observed), while mustCatch and the verdict still gate.", | ||
| "changedFiles": [ | ||
| { | ||
| "path": "src/reports/partner-report.ts", | ||
| "status": "added" | ||
| }, | ||
| { | ||
| "path": "src/reports/share.ts", | ||
| "status": "added" | ||
| }, | ||
| { | ||
| "path": "src/reports/partner-report.test.ts", | ||
| "status": "added" | ||
| } | ||
| ], | ||
| "dimensions": { | ||
| "correctness": "assessed", | ||
| "skillSeverity": "assessed", | ||
| "patternTriage": "assessed" | ||
| }, | ||
| "findings": [ | ||
| { | ||
| "source": "correctness", | ||
| "finding": { | ||
| "schema_version": 2, | ||
| "id": "partner-report-unredacted", | ||
| "lens": "correctness", | ||
| "anchor": { | ||
| "type": "line", | ||
| "path": "src/reports/partner-report.ts", | ||
| "line": 11, | ||
| "side": "RIGHT" | ||
| }, | ||
| "severity": "blocking", | ||
| "confidence": 0.8, | ||
| "evidence_trace": [ | ||
| "src/reports/share.ts POSTs the built rows to a partner webhook, an external destination", | ||
| "src/reports/format-report.ts documents that the unset-redact default includes raw userId and email columns and is only safe for reports that stay inside the org", | ||
| "src/reports/partner-report.ts:11 calls formatReport(relevant) with no options" | ||
| ], | ||
| "failure_scenario": "The weekly partner job builds rows with buildPartnerReport and posts them via shareWithPartner; because formatReport is called without redact: true, every row carries the raw userId and email of the users who used the partner's features, sending PII to a third party even though the formatter documents the unredacted default as only safe inside the org.", | ||
| "producing_hunt": "correctness:cross-file-trace", | ||
| "model_authored_prose": "buildPartnerReport calls formatReport(relevant) without options, and the formatter's documented default includes raw userId and email columns and is described as only safe for reports that stay inside the org. These rows go to a partner webhook (share.ts). Pass {redact: true} here." | ||
| } | ||
| } | ||
| ], | ||
| "validation": [ | ||
| { | ||
| "id": "partner-report-unredacted", | ||
| "verification": "confirmed" | ||
| } | ||
| ], | ||
| "policyConflicts": [], | ||
| "expected": { | ||
| "verdict": "REQUEST_CHANGES", | ||
| "mustCatch": [ | ||
| "partner-report-unredacted" | ||
| ] | ||
| }, | ||
| "diff": "diff --git a/src/reports/partner-report.test.ts b/src/reports/partner-report.test.ts\nnew file mode 100644\nindex 0000000..8a8b80b\n--- /dev/null\n+++ b/src/reports/partner-report.test.ts\n@@ -0,0 +1,25 @@\n+import {buildPartnerReport} from \"./partner-report\";\n+import type {UsageEvent} from \"./format-report\";\n+\n+const event = (feature: string): UsageEvent => ({\n+ userId: \"u1\",\n+ email: \"u1@example.com\",\n+ feature,\n+ at: 1,\n+});\n+\n+describe(\"buildPartnerReport\", () => {\n+ it(\"keeps only the partner's own features\", () => {\n+ const rows = buildPartnerReport(\n+ [event(\"search\"), event(\"editor\"), event(\"search\")],\n+ [\"search\"],\n+ );\n+ expect(rows).toHaveLength(2);\n+ expect(rows.every((row) => row[\"feature\"] === \"search\")).toBe(true);\n+ });\n+\n+ it(\"returns no rows when nothing matches\", () => {\n+ const rows = buildPartnerReport([event(\"editor\")], [\"search\"]);\n+ expect(rows).toHaveLength(0);\n+ });\n+});\ndiff --git a/src/reports/partner-report.ts b/src/reports/partner-report.ts\nnew file mode 100644\nindex 0000000..693484f\n--- /dev/null\n+++ b/src/reports/partner-report.ts\n@@ -0,0 +1,12 @@\n+import {formatReport, type ReportRow, type UsageEvent} from \"./format-report\";\n+\n+/** Weekly usage summary a partner integration receives for its own features. */\n+export const buildPartnerReport = (\n+ events: UsageEvent[],\n+ partnerFeatures: string[],\n+): ReportRow[] => {\n+ const relevant = events.filter((event) =>\n+ partnerFeatures.includes(event.feature),\n+ );\n+ return formatReport(relevant);\n+};\ndiff --git a/src/reports/share.ts b/src/reports/share.ts\nnew file mode 100644\nindex 0000000..fc73ae0\n--- /dev/null\n+++ b/src/reports/share.ts\n@@ -0,0 +1,24 @@\n+import type {ReportRow} from \"./format-report\";\n+import {PARTNER_WEBHOOK_TIMEOUT_MS} from \"./policy\";\n+\n+/** POSTs a built report to the partner's registered webhook. */\n+export const shareWithPartner = async (\n+ webhookUrl: string,\n+ rows: ReportRow[],\n+): Promise<void> => {\n+ const controller = new AbortController();\n+ const timer = setTimeout(\n+ () => controller.abort(),\n+ PARTNER_WEBHOOK_TIMEOUT_MS,\n+ );\n+ try {\n+ await fetch(webhookUrl, {\n+ method: \"POST\",\n+ headers: {\"content-type\": \"application/json\"},\n+ body: JSON.stringify({rows}),\n+ signal: controller.signal,\n+ });\n+ } finally {\n+ clearTimeout(timer);\n+ }\n+};\n", | ||
| "live": { | ||
| "prContext": { | ||
| "title": "reports: send partners a weekly usage summary for their features", | ||
| "description": "Adds a weekly partner usage report and a webhook sender. The report reuses the shared formatter; rows are scoped to the partner's own features. Covered by filtering tests.", | ||
| "author": "dev-reports", | ||
| "baseBranch": "main" | ||
| }, | ||
| "tree": "tree", | ||
| "mustCatchSpecs": [ | ||
| { | ||
| "key": "partner-report-unredacted", | ||
| "path": "src/reports/partner-report.ts", | ||
| "lineStart": 4, | ||
| "lineEnd": 12, | ||
| "mechanism": [ | ||
| "redact", | ||
| "email|PII|personal(ly identifiable)? (data|information)|raw (user ?id|identifier)", | ||
| "(leave|leaves|leaving|outside|beyond|across|crosses).{0,50}(org|boundary)|third.part|(partner|webhook|external).{0,80}(email|raw|unredacted|identifier|PII)" | ||
| ], | ||
| "altLocations": [ | ||
| { | ||
| "path": "src/reports/share.ts" | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| } | ||
| } |
39 changes: 39 additions & 0 deletions
39
...synthetic-mutations/mutation-crossfile-report-redaction/tree/src/reports/format-report.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| export type UsageEvent = { | ||
| userId: string; | ||
| email: string; | ||
| feature: string; | ||
| at: number; | ||
| }; | ||
|
|
||
| export type FormatOptions = { | ||
| /** | ||
| * When true, user identifiers are replaced with opaque hashes and the | ||
| * email column is omitted. When false or unset the rows carry the raw | ||
| * userId and email columns; that default exists for the internal | ||
| * dashboards and is only safe for reports that stay inside the org. | ||
| */ | ||
| redact?: boolean; | ||
| }; | ||
|
|
||
| export type ReportRow = Record<string, string | number>; | ||
|
|
||
| const hash = (value: string): string => | ||
| `h${Array.from(value).reduce( | ||
| (acc, char) => (acc * 31 + char.charCodeAt(0)) % 1_000_000_007, | ||
| 7, | ||
| )}`; | ||
|
|
||
| export const formatReport = ( | ||
| events: UsageEvent[], | ||
| options: FormatOptions = {}, | ||
| ): ReportRow[] => | ||
| events.map((event) => | ||
| options.redact | ||
| ? {user: hash(event.userId), feature: event.feature, at: event.at} | ||
| : { | ||
| user: event.userId, | ||
| email: event.email, | ||
| feature: event.feature, | ||
| at: event.at, | ||
| }, | ||
| ); |
25 changes: 25 additions & 0 deletions
25
...tic-mutations/mutation-crossfile-report-redaction/tree/src/reports/partner-report.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import {buildPartnerReport} from "./partner-report"; | ||
| import type {UsageEvent} from "./format-report"; | ||
|
|
||
| const event = (feature: string): UsageEvent => ({ | ||
| userId: "u1", | ||
| email: "u1@example.com", | ||
| feature, | ||
| at: 1, | ||
| }); | ||
|
|
||
| describe("buildPartnerReport", () => { | ||
| it("keeps only the partner's own features", () => { | ||
| const rows = buildPartnerReport( | ||
| [event("search"), event("editor"), event("search")], | ||
| ["search"], | ||
| ); | ||
| expect(rows).toHaveLength(2); | ||
| expect(rows.every((row) => row["feature"] === "search")).toBe(true); | ||
| }); | ||
|
|
||
| it("returns no rows when nothing matches", () => { | ||
| const rows = buildPartnerReport([event("editor")], ["search"]); | ||
| expect(rows).toHaveLength(0); | ||
| }); | ||
| }); |
12 changes: 12 additions & 0 deletions
12
...ynthetic-mutations/mutation-crossfile-report-redaction/tree/src/reports/partner-report.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| import {formatReport, type ReportRow, type UsageEvent} from "./format-report"; | ||
|
|
||
| /** Weekly usage summary a partner integration receives for its own features. */ | ||
| export const buildPartnerReport = ( | ||
| events: UsageEvent[], | ||
| partnerFeatures: string[], | ||
| ): ReportRow[] => { | ||
| const relevant = events.filter((event) => | ||
| partnerFeatures.includes(event.feature), | ||
| ); | ||
| return formatReport(relevant); | ||
| }; |
2 changes: 2 additions & 0 deletions
2
...corpus/synthetic-mutations/mutation-crossfile-report-redaction/tree/src/reports/policy.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| /** Shared constants for outbound report delivery. */ | ||
| export const PARTNER_WEBHOOK_TIMEOUT_MS = 5_000; |
24 changes: 24 additions & 0 deletions
24
.../corpus/synthetic-mutations/mutation-crossfile-report-redaction/tree/src/reports/share.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import type {ReportRow} from "./format-report"; | ||
| import {PARTNER_WEBHOOK_TIMEOUT_MS} from "./policy"; | ||
|
|
||
| /** POSTs a built report to the partner's registered webhook. */ | ||
| export const shareWithPartner = async ( | ||
| webhookUrl: string, | ||
| rows: ReportRow[], | ||
| ): Promise<void> => { | ||
| const controller = new AbortController(); | ||
| const timer = setTimeout( | ||
| () => controller.abort(), | ||
| PARTNER_WEBHOOK_TIMEOUT_MS, | ||
| ); | ||
| try { | ||
| await fetch(webhookUrl, { | ||
| method: "POST", | ||
| headers: {"content-type": "application/json"}, | ||
| body: JSON.stringify({rows}), | ||
| signal: controller.signal, | ||
| }); | ||
| } finally { | ||
| clearTimeout(timer); | ||
| } | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.