Repository navigation
Fix: 4 issues (#95, #96, #97, #98) - #133
Merged
victorisiguzoruzoma874 merged 3 commits intoOct 18, 2026
Merged
Conversation
Co-authored-by: Simple Agent <agent@simple.dev>
|
@jasmine874 is attempting to deploy a commit to the work Team on Vercel. A member of the Team first needs to authorize it. |
|
@jasmine874 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
- src/db/schema.ts: merged [markers] — model resolved the conflict markers - src/middleware/dynamicPaywall.ts: merged [markers] — model resolved the conflict markers - src/middleware/uploadGuards.ts: merged [markers] — model resolved the conflict markers Co-authored-by: Simple Agent <agent@simple.dev>
- src/routes/verify.ts: merged [markers] — model resolved the conflict markers Co-authored-by: Simple Agent <agent@simple.dev>
victorisiguzoruzoma874
merged commit Oct 18, 2026
193a586
into
SynapsVault:main
0 of 2 checks passed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes #95
Closes #96
Closes #97
Closes #98
Issues
#95 Error response shapes differ across the paywall, multer, not-found and app errors
#96 Verification prompt includes the listing text with no separation from instructions
#97 Verification output parsing is fragile
#98 /agent/status loads every verification into memory to compute counters
Summary
The unified error shape must preserve the existing
errormessage field for backward compatibility while always addingcodeandrequestId. For #96, the deterministic check should be conservative: suspicious content should force a non-original result or a review flag rather than auto-approving. For #97, use a balanced-brace extractor rather than a greedy regex to find the first JSON object. For #98, use drizzlesqltemplate expressions for aggregates and keep the response shape identical; the test should compare against the old in-memory totals.Changes
sendError(res, error)(orrespondWithError) that serializes any thrown value viaserializeError(error, getRequestId())and writes it withgetStatusCode(error). Also add convenience constructors or ensureAppErrorcovers the codes needed by the paywall (e.g. aSERVICE_UNAVAILABLEfor chain_unavailable andCONFLICTfor price_mismatch). KeepserializeErroras the single source of truth so every body haserror,codeandrequestId. (src/lib/errors.ts)res.status(...).json({...})calls indynamicPaywallwithAppErrorthrows (orsendError): 404NOT_FOUNDfor missing/unlisted resources, 503SERVICE_UNAVAILABLEfor chain lookup failure (preserve the human message and resourceId indetails), and 409CONFLICTfor price mismatch (same). This makes every paywall error body includeerror,codeandrequestId. (src/middleware/dynamicPaywall.ts)AppError: mapLIMIT_FILE_SIZEtoPAYLOAD_TOO_LARGE(413), otherMulterErrors toVALIDATION_ERROR(400), andvalidateUploadfailures toAppErrorwith the mapped status (415 →VALIDATION_ERRORor a dedicated code) instead of writing{ error }directly. Usenext(new AppError(...))so the global handler emitserror,codeandrequestId. (src/middleware/uploadGuards.ts)notFoundHandlerdelegate to the shared serializer (e.g.res.status(404).json(serializeError(new AppError("NOT_FOUND",Route ${req.method} ${req.path} not found), getRequestId()))) so the not-found body has the same shape as every other error. Keep the existingerrorHandlerbehaviour. (src/middleware/errorHandler.ts)error,code,requestId) for the 404, 503 and 409 paths, usingtoMatchSnapshot()or explicit object assertions. MockgetRequestIdto a fixed value so snapshots are stable. (src/middleware/dynamicPaywall.test.ts)error,codeandrequestId(mockgetRequestId). (src/middleware/uploadGuards.test.ts)error,codeandrequestId. (src/middleware/errorHandler.test.ts)Errorschema (and any paywall-specific error responses) so it documentserror,code(enum ofErrorCode), optionaldetailsandrequestId, matching the unified serializer output. Ensure the 402/404/409/413/415/503 responses reference this schema. (src/openapi.ts)checkOriginality: wrap the untrustedcontent.slice(0, 10000)in explicit delimiters (e.g.<untrusted_content>...</untrusted_content>) and add system instructions telling the model to treat everything inside as data and ignore any instructions it contains. Add a deterministic heuristic scan (e.g. regex for 'ignore previous instructions', 'approve this', etc.) that forcesisOriginal: false/ a review flag when suspicious patterns are found, and require a confidence threshold before auto-approving. Also replace the fragile fence regex with a helper that strips any code fence or extracts the first balanced JSON object, and clamp confidence withNumber.isFiniteto [0,1] (rejecting non-finite values). (src/services/verificationService.ts)GET /agent/statusto compute counters with SQL aggregates (COUNT(*),COUNT(*) FILTER (WHERE is_original),SUM(estimated_cost),AVG(confidence)) via drizzlesqlexpressions, and fetch only the 10 most recent rows withORDER BY checked_at DESC LIMIT 10for the activity list. Keep the existing response shape and the batched title lookup for those 10 rows. Also ensure the verification route respects the new review/deterministic check from Verification prompt includes the listing text with no separation from instructions #96 before settinglisted: true. (src/routes/verify.ts)contentdoes not cause the resource to be listed. (src/routes/verify.agent-status.test.ts)/agent/statusand the review/deterministic check before listing, ensuring existing behaviour (ownership, hash match, admin delist) still passes. (src/routes/verify.test.ts)verifications.checked_atforORDER BY checked_at DESC LIMIT 10). (src/db/schema.ts)