refactor(AP-128): import shared routeContractById in api, upload, content#180
Conversation
Replace three local contractById implementations with the typed export from @agent-paste/contracts so route contract narrowing stays consistent across Workers. Co-authored-by: Isaac Suttell <isaac@isaacsuttell.com>
AP-128 Import shared routeContractById instead of three local copies
Parent: AP-126. Architecture review finding #4. No hot seam — fully parallel-safe; good first/warm-up ticket. OutcomeThe three Workers resolve a Route Contract by id through the single exported Context docs
Problem
Likely files / packages
In scope
Out of scope
Acceptance criteria
Required checks
Security / data / operational invariantsNone — pure internal refactor, no behavior change. Dependencies / blockersNone. Parallel-safe with all other AP-126 slices. |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
agent-paste PR preview is ready. API: https://agent-paste-api-pr-180.isaac-a46.workers.dev |
Adds contracts-package tests for the shared lookup so branch coverage stays above the 80% global threshold after removing local copies. Co-authored-by: Isaac Suttell <isaac@isaacsuttell.com>
|
agent-paste PR preview is ready. API: https://agent-paste-api-pr-180.isaac-a46.workers.dev |
|
agent-paste PR preview resources were cleaned up. The shared Preview GitHub Environment is retained for future preview deploys. |
Summary
Removes three duplicate local
contractByIdhelpers and routes all three Workers through the sharedrouteContractByIdexport from@agent-paste/contracts.Changes
route-contracts.ts): Re-exportsrouteContractByIdascontractById; aliasesRouteContractByIdfor existingContractByIdtype usage.const contractById = routeContractByIdnear module setup (content now gets the sameExtract<>narrowing as api/upload).Unknown route contract: …) for missing ids.Verification
pnpm verifypnpm test:coverageLinear Issue: AP-128