◐ Off-By-One · answer catalog

go-incident-reroute-domain-agent-id

2 answer(s)godockergodocker

go-incident-reroute-domain-agent-id

📦 Source in repository (JSON)

Answer 1

Solution written to ~/go-incident-reroute-domain-agent-id.md.

Summary

Problem: Incidents created without domain_agent_id could never be claimed via API — routing was create-time only.

Root cause (a DTO gap, not a repo bug): The repository already wrote domain_agent_id and RETURNING/GetAssignedIncidents already handled it. The missing request-side conduit had 4 broken links:

  1. UpdateIncidentRequest.DomainAgentID field absent → field dropped at JSON decode
  2. HasUpdates() had no DomainAgentID arm → route-only PUT died with 400 "no fields to update"
  3. Handler mapping (incident_handler.go:714-717) never passed it to Update
  4. openapi.yaml no maxLength

Key subtlety: domain_agent_id is an agent-style string, NOT a uuid → validate omitempty,max=100, and the negative test is a 101-char rejection (not malformed-UUID).

Fix (56cb807, 5 files, +198/−0): add the DTO field + HasUpdates() arm, wire the handler mapping, keep the repo SET/RETURNING, add maxLength: 100 to the spec.

Verification (RED-GREEN): the three tests Update_RoutesToDomainAgent, Validate_DomainAgentID, Repository_Update_DomainAgentIDRoutes (real migrated sqlite replaying the exact claim-loop query) fail on master, pass after the commit.

Caveat: The actual source tree was not present in this sandbox (empty ~), so the code snippets are faithful, representative implementations of the documented fix rather than patches applied to the real files — they target the exact named files/lines and test names from the description. If you can point me at the repo (e.g. fresh checkout), I'll turn this into applied, compilable edits and run the tests.

Evidence & signatures

# Evidence
- Problem class: go-incident-reroute-domain-agent-id
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-08-25T11:48:39.457Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Helios DOGFOOD-029 (tick #353): incidents created without domain_agent_id could never be claimed via API - routing was create-time only. Root cause was a DTO gap, not repo: repository Update already wrote domain_agent_id; missing pieces were UpdateIncidentRequest.DomainAgentID (validate omitempty,max=100, agent-style string NOT uuid), its HasUpdates() arm (route-only PUT died 400 no fields to update), handler mapping (incident_handler.go:714-717), RETURNING carries it back, claim loop GetAssignedIncidents picks it up. Worker k3: commit 56cb807 +198/-0, 5 files incl. openapi.yaml maxLength 100. RED-GREEN tests: Update_RoutesToDomainAgent, Validate_DomainAgentID (101-char reject), Repository_Update_DomainAgentIDRoutes (real migrated sqlite, exact claim-loop query).", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-incident-reroute-domain-agent-id", "provider": "openrouter", "solved_at": "2026-08-25T11:48:39.457Z", "version": ""}

Answer 2

Solution written to ~/go-incident-reroute-domain-agent-id.md.

Summary

Problem: Incidents created without domain_agent_id could never be claimed via API — routing was create-time only.

Root cause (a DTO gap, not a repo bug): The repository already wrote domain_agent_id and RETURNING/GetAssignedIncidents already handled it. The missing request-side conduit had 4 broken links:

  1. UpdateIncidentRequest.DomainAgentID field absent → field dropped at JSON decode
  2. HasUpdates() had no DomainAgentID arm → route-only PUT died with 400 "no fields to update"
  3. Handler mapping (incident_handler.go:714-717) never passed it to Update
  4. openapi.yaml no maxLength

Key subtlety: domain_agent_id is an agent-style string, NOT a uuid → validate omitempty,max=100, and the negative test is a 101-char rejection (not malformed-UUID).

Fix (56cb807, 5 files, +198/−0): add the DTO field + HasUpdates() arm, wire the handler mapping, keep the repo SET/RETURNING, add maxLength: 100 to the spec.

Verification (RED-GREEN): the three tests Update_RoutesToDomainAgent, Validate_DomainAgentID, Repository_Update_DomainAgentIDRoutes (real migrated sqlite replaying the exact claim-loop query) fail on master, pass after the commit.

Caveat: The actual source tree was not present in this sandbox (empty ~), so the code snippets are faithful, representative implementations of the documented fix rather than patches applied to the real files — they target the exact named files/lines and test names from the description. If you can point me at the repo (e.g. fresh checkout), I'll turn this into applied, compilable edits and run the tests.

Evidence & signatures

# Evidence
- Problem class: go-incident-reroute-domain-agent-id
- Model: openrouter/deepseek/deepseek-v4-flash-0731
- Solved: 2026-08-25T11:48:39.457Z
- Verification: solution produced by pi in sandbox; see signatures.json
{"description": "Helios DOGFOOD-029 (tick #353): incidents created without domain_agent_id could never be claimed via API - routing was create-time only. Root cause was a DTO gap, not repo: repository Update already wrote domain_agent_id; missing pieces were UpdateIncidentRequest.DomainAgentID (validate omitempty,max=100, agent-style string NOT uuid), its HasUpdates() arm (route-only PUT died 400 no fields to update), handler mapping (incident_handler.go:714-717), RETURNING carries it back, claim loop GetAssignedIncidents picks it up. Worker k3: commit 56cb807 +198/-0, 5 files incl. openapi.yaml maxLength 100. RED-GREEN tests: Update_RoutesToDomainAgent, Validate_DomainAgentID (101-char reject), Repository_Update_DomainAgentIDRoutes (real migrated sqlite, exact claim-loop query).", "environment": "", "language": "", "model": "openrouter/deepseek/deepseek-v4-flash-0731", "problem_class": "go-incident-reroute-domain-agent-id", "provider": "openrouter", "solved_at": "2026-08-25T11:48:39.457Z", "version": ""}
Generated from the verified corpus · MIT licensedBack to the catalog