[upstream-queue] feat: shared foundation — generation API client + types (PR-1/8) - #4
[upstream-queue] feat: shared foundation — generation API client + types (PR-1/8)#4damienriehl wants to merge 1 commit into
Conversation
- Add lib/api/generation.ts with typed API client for POST /projects/{id}/llm/generate-suggestions
- Export GeneratedSuggestion, GenerateSuggestionsRequest/Response, SuggestionType, Provenance, ValidationError, DuplicateCandidate types
- Conditional X-BYO-API-Key header when byoKey is provided
- Replace test stubs with 4 passing tests verifying request shape and header logic
af63b6e to
764244c
Compare
/ce:review — CLEAN (kieran-typescript pass)No BLOCKER/HIGH/MEDIUM findings. Auth traced end-to-end: Applied (LOW #1, Documented follow-up (LOW #2, not a gate): Backend contract note: field-level fidelity vs |
- resumeSession no longer stores the raw session id as the beacon token; session summaries carry no server-issued token, so it is cleared (#1) - PropertyDetailPanel accept path now has a provenance-argument test (#2) - updatePropertyInTurtle carries undescribed predicate-objects through a form save, so the PROV-O stamp survives the first edit; the block parser is hoisted from turtleClassUpdater into turtleUtils (#3) - persistGeneratedEntity gates the prov: prefix declaration with isProvPrefixBoundToProvO so accepted entities stop re-declaring it (#4)
…43) * chore(parity): ledger feat/pr-party -> dev and carry 17 paths (U4) Adds docs/audits/2026-09-05-pr-party-dev-parity-ledger.md giving every one of the 191 name-status rows and 15 removed exports between feat/pr-party and dev a single disposition (17 carry, 154 dev supersedes, 20 drop). Carries the 17 rows the ledger marks carry: the accepted-suggestion provenance bridge and PROV-O emission in the Turtle snippet generator, the missing-issuer logout guard, the server-issued beacon token, the public issuer in next.config, and the frozen-line regression tests for each, adapted only where dev's APIs changed. Findings F1 (auth-disabled capability routing) and F2 (provider build args in the Dockerfile) stay dev supersedes pending review. * fix(review): apply U4 review findings #1-#4 - resumeSession no longer stores the raw session id as the beacon token; session summaries carry no server-issued token, so it is cleared (#1) - PropertyDetailPanel accept path now has a provenance-argument test (#2) - updatePropertyInTurtle carries undescribed predicate-objects through a form save, so the PROV-O stamp survives the first edit; the block parser is hoisted from turtleClassUpdater into turtleUtils (#3) - persistGeneratedEntity gates the prov: prefix declaration with isProvPrefixBoundToProvO so accepted entities stop re-declaring it (#4)
PR-1 of 8 — LLM node-expansion drain "shared foundation"
Queue policy (TODAY-2026-07-07): staged INSIDE the alea fork, base `dev`, UNMERGED (`dev`/`main` stay pure upstream mirrors). Retarget to CatholicOS decided post-today. Tracked in `docs/UPSTREAM-TRACKING.md` (A2.2).
What this is
The inert shared foundation the later slices build on: the typed LLM generation API client + its TypeScript types. Single clean commit cherry-picked from the `llm-helper` lineage (`a90ec39`) onto fresh `origin/dev`.
Pure additions (199 insertions, 0 deletions). No UI, no backend dependency — nothing imports `generation.ts` yet, so it is behaviorally inert until PR-3/PR-5/PR-6 wire it up. This is why "deploy+verify on FOLIO DEV" is satisfied by the clean production build rather than a live redeploy (an inert types file exercises no runtime surface; a web rebuild is also gated on the L4.4 OIDC/disk chain).
Auth handling (reviewed)
`generateSuggestions` takes a required `token` and sends `Authorization: Bearer ${token}`, with a conditional `X-BYO-API-Key` only when a BYO key is supplied — the correct pattern (contrast: web#3 fixed a MEDIUM where the ported graph client dropped this header).
Scope decision — `suggestions.ts` type slice DEFERRED to PR-6
The roadmap tags type-only additions to `lib/api/suggestions.ts` as PR-1, but they live in a single atomic phase-16 commit (`1e17916`) that interleaves the 7 review interfaces WITH 3 implemented method bodies (`getSessionDetail`, `postShardReviews`, `createCleanPR`) + a 229-line test exercising them. Carving out only the types = a slice traceable to no upstream commit (exactly the messy slice to avoid). `1e17916` belongs to PR-6, and cherry-picks cleanly onto a foundation that already has `generation.ts`. Keeping PR-1 = the single inert `a90ec39`.
Verification (all green)
Depends on nothing. PR-0 (entity-graph, web#3) and this can land independently. Merge order: 0 → 1 → 2 → 3 → 4 → 5 → 6 → (7).