Skip to content

feat: accept erobot's desk events on the gateway's ingest route - #97

Merged
feruzm merged 2 commits into
mainfrom
feature/curation-ingest-via-gateway
Sep 6, 2026
Merged

feat: accept erobot's desk events on the gateway's ingest route#97
feruzm merged 2 commits into
mainfrom
feature/curation-ingest-via-gateway

Conversation

@feruzm

@feruzm feruzm commented Sep 5, 2026

Copy link
Copy Markdown
Member

erobot posted its observations (post cards, trail votes, curator votes, flags) to the desk backend directly with a shared token. It now uses the same write pipeline as every other desk client.

  • POST /private-api/curation-desk/ingest with the @ecency signed code in the body. The gateway validates and strips the code and forwards the envelope under the validated username to curation/desk/ingest; the backend decides whether that account may ingest.
  • The envelope is checked for the shape the backend accepts before the authenticated round trip: version 1, one of the four event types, an id within the backend's column, an optional string ts and an object payload. The sender's retry counter stays behind.
  • Parity catalog lists the route with the other desk writes.

Test plan: dotnet test (475 passing): the route joins the whitelist and identity checks every desk write has, the envelope is forwarded as an object without attempts or code, and twelve malformed envelopes plus the id length bound are refused with the same messages the backend would use.

Summary by CodeRabbit

  • New Features
    • Added a signed endpoint for ingesting approved curation event envelopes.
    • Supports multiple event types with validation for version, event type, identifier, timestamp, and payload.
    • Enforces a maximum event identifier length and forwards only validated event data.
  • Bug Fixes
    • Rejects malformed or unsupported event envelopes with appropriate validation errors.

erobot posted its observations to the desk backend directly, with a shared
token on a private link. It now uses the same write pipeline as every other
desk client: POST /private-api/curation-desk/ingest with the @ecency signed
code in the body, which the gateway validates and strips before forwarding
the envelope under the validated username to curation/desk/ingest. The
envelope is checked for the shape the backend accepts (version 1, one of
the four event types, an id within the backend's column, an object
payload); the sender's retry counter stays behind.
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Route erobot desk events through the signed gateway ingest

✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Adds a signed gateway ingest route for erobot curation desk events.
• Validates envelopes and strips credentials and retry metadata before proxying.
• Covers identity, forwarding, validation, length bounds, and parity catalog inclusion.
Diagram

sequenceDiagram
    actor E as erobot
    participant R as Ingest Route
    participant A as Signed Auth
    participant V as Envelope Builder
    participant B as Desk Backend
    E->>R: POST signed envelope
    R->>A: Validate code
    A-->>R: Valid username
    R->>V: Validate and whitelist
    alt Invalid envelope
        V-->>R: Validation error
        R-->>E: 400 response
    else Valid envelope
        V-->>R: Sanitized payload
        R->>B: POST ingest
        B-->>R: Desk response
        R-->>E: Proxied response
    end
Loading
High-Level Assessment

The current approach is preferable because it reuses the established signed desk-write pipeline, identity handling, field whitelisting, and backend authorization boundary. A dedicated shared-token path was considered but would preserve duplicate authentication infrastructure and bypass protections consistently applied to other desk clients.

Files changed (4) +97 / -2

Enhancement (2) +44 / -0
PrivateApi.CurationDesk.csAdd authenticated curation desk ingest handling +43/-0

Add authenticated curation desk ingest handling

• Routes ingest requests through the existing signed desk-write handler and forwards them to 'curation/desk/ingest'. Defines allowed event types and fields, validates version 1 envelopes, enforces the backend identifier limit, and excludes sender-only metadata.

dotnet/EcencyApi/Handlers/PrivateApi.CurationDesk.cs

Routes.csRegister the private curation desk ingest endpoint +1/-0

Register the private curation desk ingest endpoint

• Maps 'POST /private-api/curation-desk/ingest' to the new curation desk ingest handler.

dotnet/EcencyApi/Handlers/Routes.cs

Tests (2) +53 / -2
CurationDeskPayloadTests.csTest ingest sanitization and envelope validation +52/-1

Test ingest sanitization and envelope validation

• Adds ingest to shared desk-write identity checks and verifies forwarding preserves the nested payload while removing 'attempts' and 'code'. Covers invalid versions, types, identifiers, timestamps, payload shapes, and the 200-character identifier boundary.

dotnet/EcencyApi.Tests/CurationDeskPayloadTests.cs

driver.pyInclude ingest in curation desk parity cases +1/-1

Include ingest in curation desk parity cases

• Adds the ingest endpoint to the parity route catalog so minimum-body, populated-body, and invalid-code behavior are exercised consistently with other desk writes.

dotnet/parity/driver.py

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Sep 5, 2026

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Ingest skips handler test matrix ✓ Resolved 🐞 Bug ⚙ Maintainability
Description
The new ingest handler was not added to SignedWrites(), so tests claiming to cover every signed
write do not exercise its authentication, internal token, upstream routing, identity forwarding, or
no-store behavior. This leaves route-level regressions undetected despite payload construction
having separate unit coverage.
Code

dotnet/EcencyApi/Handlers/PrivateApi.CurationDesk.cs[R442-443]

+    public static Task CurationDeskIngest(HttpContext ctx) =>
+        ServeDeskWrite(ctx, CurationDeskWrites.Ingest);
Evidence
SignedWrites() enumerates every existing signed desk handler but ends with recommendation-dismiss
and omits ingest. Multiple tests derive their coverage exclusively from this fixture, including
internal-token and identity forwarding checks, invalid-code rejection, client-address isolation, and
no-store behavior.

dotnet/EcencyApi.Tests/CurationDeskTestSupport.cs[247-259]
dotnet/EcencyApi.Tests/CurationDeskAuthTests.cs[20-48]
dotnet/EcencyApi.Tests/CurationDeskAuthTests.cs[77-121]
dotnet/EcencyApi.Tests/CurationDeskAuthTests.cs[211-224]
dotnet/EcencyApi.Tests/CurationDeskAuthTests.cs[288-299]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new curation desk ingest handler is absent from the shared `SignedWrites()` fixture, so the handler-level security and forwarding tests do not cover it.
## Issue Context
Add an ingest entry with a valid signed envelope to `SignedWrites()`. This should make the existing parameterized tests verify the desk token, authentication failures, validated identity, upstream forwarding, client-address policy, fail-closed behavior, and cache policy for the new route.
## Fix Focus Areas
- dotnet/EcencyApi.Tests/CurationDeskTestSupport.cs[247-259]
- dotnet/EcencyApi/Handlers/PrivateApi.CurationDesk.cs[442-443]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can show, collapse, or hide each part of a finding: code, evidence, and all

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread dotnet/EcencyApi/Handlers/PrivateApi.CurationDesk.cs
The matrix covers the token, the 503 before validation, the identity
forwarding, the routing and the no-store answer of every signed write; the
new handler was missing from it.
@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 54 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: f0d2fb05-ad65-4625-90a8-c6bfdfe6aa16

📥 Commits

Reviewing files that changed from the base of the PR and between 61147b0 and 481ef2d.

📒 Files selected for processing (1)
  • dotnet/EcencyApi.Tests/CurationDeskTestSupport.cs

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 07e8758d-b712-4a2a-b7a0-b37d2ac6dd1b

📥 Commits

Reviewing files that changed from the base of the PR and between c226cd6 and 61147b0.

📒 Files selected for processing (4)
  • dotnet/EcencyApi.Tests/CurationDeskPayloadTests.cs
  • dotnet/EcencyApi/Handlers/PrivateApi.CurationDesk.cs
  • dotnet/EcencyApi/Handlers/Routes.cs
  • dotnet/parity/driver.py

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The PR adds a signed Curation Desk ingest endpoint. It validates event envelopes, forwards approved fields through the signed-write pipeline, registers parity cases, and adds tests for forwarding, rejection, and event ID limits.

Changes

Curation Desk ingest

Layer / File(s) Summary
Ingest contract and validation
dotnet/EcencyApi/Handlers/PrivateApi.CurationDesk.cs
Defines supported event types, the 200-character ID limit, forwarded envelope fields, and validation errors for invalid ingest envelopes.
Signed route wiring
dotnet/EcencyApi/Handlers/PrivateApi.CurationDesk.cs, dotnet/EcencyApi/Handlers/Routes.cs
Adds CurationDeskIngest and maps POST /private-api/curation-desk/ingest to the signed-write pipeline.
Ingest coverage and parity
dotnet/EcencyApi.Tests/CurationDeskPayloadTests.cs, dotnet/parity/driver.py
Tests identity forwarding, field filtering, backend-compatible rejection, and ID limits. Adds ingest cases to the parity catalog.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 61147

This adds the signed Curation Desk ingest endpoint while validating accepted event envelopes and forwarding only approved fields. No concrete current-head merge-blocking risk remains.

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Routes
  participant CurationDeskIngest
  participant SignedWritePipeline
  participant Backend
  Client->>Routes: POST /private-api/curation-desk/ingest
  Routes->>CurationDeskIngest: Invoke handler
  CurationDeskIngest->>SignedWritePipeline: Validate and submit envelope
  SignedWritePipeline->>Backend: Forward v, type, id, ts, and payload
  Backend-->>SignedWritePipeline: Accept or reject event
Loading

Poem

A rabbit checks each event in line
The fields stay neat, the rules align
IDs may stretch, but not too far
Signed routes guide them like a star
Tests hop through each case with care

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding the gateway ingest route for erobot desk events.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/curation-ingest-via-gateway

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@feruzm feruzm left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed at 481ef2d, including the follow-up that adds ingest to the shared signed-write handler matrix. The route authenticates through the existing HiveSigner path, forwards only v/type/id/ts/payload under the validated username, drops code and attempts, enforces the backend event/type/id shape, and targets the esync /curation/desk/ingest route correctly. Local verification passed all 475 .NET tests and diff checks; GitHub test is green. No blocking findings in the current diff.

@feruzm
feruzm merged commit 0348aee into main Sep 6, 2026
4 checks passed
@feruzm
feruzm deleted the feature/curation-ingest-via-gateway branch September 6, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant