[Bug] API Contract vs Implementation Mismatch - Invoice Creation Endpoint #4

Closed
opened 2026-03-10 03:40:45 +00:00 by Mark · 35 comments
Owner

Issue

There's a discrepancy between the API contract documentation and the actual implementation for invoice creation.

Details

API Contract (docs/api_contract.md line 87):

POST /invoices (roles: admin, billing)

Current Implementation (backend/api/v1/endpoints/invoices.py):
Looking at the router, invoices are primarily created via:

POST /invoices/from-ticket/{ticket_id}

Questions

  1. Is POST /invoices meant to be a standalone invoice creation endpoint?
  2. Should the current from-ticket endpoint remain as-is, or be refactored?
  3. What should the request body be for a standalone POST /invoices?

Proposed Resolution

Option A: Implement standalone POST /invoices for manual invoice creation
Option B: Update API contract to reflect current implementation
Option C: Support both methods with clear documentation

Acceptance Criteria

  • Resolve ambiguity in API design
  • Update implementation OR documentation
  • Ensure consistency across all API documentation
  • Update tests if needed

Priority

🟡 MEDIUM

Effort Estimate

Low (1-2 days)

## Issue There's a discrepancy between the API contract documentation and the actual implementation for invoice creation. ## Details **API Contract (`docs/api_contract.md` line 87):** ``` POST /invoices (roles: admin, billing) ``` **Current Implementation (`backend/api/v1/endpoints/invoices.py`):** Looking at the router, invoices are primarily created via: ``` POST /invoices/from-ticket/{ticket_id} ``` ## Questions 1. Is `POST /invoices` meant to be a standalone invoice creation endpoint? 2. Should the current `from-ticket` endpoint remain as-is, or be refactored? 3. What should the request body be for a standalone `POST /invoices`? ## Proposed Resolution Option A: Implement standalone `POST /invoices` for manual invoice creation Option B: Update API contract to reflect current implementation Option C: Support both methods with clear documentation ## Acceptance Criteria - [ ] Resolve ambiguity in API design - [ ] Update implementation OR documentation - [ ] Ensure consistency across all API documentation - [ ] Update tests if needed ## Priority 🟡 MEDIUM ## Effort Estimate Low (1-2 days)
Author
Owner

Needs architectural decision: standalone POST /invoices endpoint vs only from-ticket. The two open questions in the issue need resolution before implementation.

Needs architectural decision: standalone POST /invoices endpoint vs only from-ticket. The two open questions in the issue need resolution before implementation.
Author
Owner

🤖 Claimed by gsd-issue-fixer-msp_c2-4 — starting work

🤖 Claimed by `gsd-issue-fixer-msp_c2-4` — starting work
Author
Owner

🤖 Claimed by gsd-issue-fixer-msp_c2-4 — starting work

🤖 Claimed by `gsd-issue-fixer-msp_c2-4` — starting work
Author
Owner

🤖 Claimed by gsd-issue-fixer-msp_c2-4 — starting work

🤖 Claimed by `gsd-issue-fixer-msp_c2-4` — starting work
Author
Owner

🤖 Claimed by gsd-issue-fixer-msp_c2-4 — starting work

🤖 Claimed by `gsd-issue-fixer-msp_c2-4` — starting work
Author
Owner

🤖 [gsd-issue-fixer-msp_c2-4] still working — claimed — starting pipeline

🤖 [`gsd-issue-fixer-msp_c2-4`] still working — claimed — starting pipeline
Author
Owner

🤖 [gsd-issue-fixer-msp_c2-4] still working — claimed — starting pipeline

🤖 [`gsd-issue-fixer-msp_c2-4`] still working — claimed — starting pipeline
Author
Owner

🤖 [gsd-issue-fixer-msp_c2-4] still working — claimed — starting pipeline

🤖 [`gsd-issue-fixer-msp_c2-4`] still working — claimed — starting pipeline
Author
Owner

🤖 [gsd-issue-fixer-msp_c2-4] still working — claimed — starting pipeline

🤖 [`gsd-issue-fixer-msp_c2-4`] still working — claimed — starting pipeline
Author
Owner

🤖 [gsd-issue-fixer-msp_c2-4] still working — research

🤖 [`gsd-issue-fixer-msp_c2-4`] still working — research
Author
Owner

🤖 [gsd-issue-fixer-msp_c2-4] still working — research

🤖 [`gsd-issue-fixer-msp_c2-4`] still working — research
Author
Owner

GSD pipeline blocked at RESEARCH: prerequisite gate (fetch) not passed.
Pipeline state needs reset. Check if another run is in progress.

GSD pipeline blocked at RESEARCH: prerequisite gate (fetch) not passed. Pipeline state needs reset. Check if another run is in progress.
Author
Owner

GSD pipeline blocked at RESEARCH: prerequisite gate (fetch) not passed.
Pipeline state needs reset. Check if another run is in progress.

GSD pipeline blocked at RESEARCH: prerequisite gate (fetch) not passed. Pipeline state needs reset. Check if another run is in progress.
Author
Owner

🤖 [gsd-issue-fixer-msp_c2-4] still working — plan

🤖 [`gsd-issue-fixer-msp_c2-4`] still working — plan
Author
Owner

🤖 [gsd-issue-fixer-msp_c2-4] still working — plan

🤖 [`gsd-issue-fixer-msp_c2-4`] still working — plan
Author
Owner

🤖 [gsd-issue-fixer-msp_c2-4] still working — implement attempt 1

🤖 [`gsd-issue-fixer-msp_c2-4`] still working — implement attempt 1
Author
Owner

GSD VERIFY phase found no changes after implementation.
Worker output: ]11;?\API call failed after 3 retries: HTTP 404: 404 page not found

GSD VERIFY phase found no changes after implementation. Worker output: ]11;?\API call failed after 3 retries: HTTP 404: 404 page not found
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Auto-triage: needs decompose

Marked triage-approved + needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.

## Auto-triage: needs decompose Marked `triage-approved` + `needs-decompose`. decompose-executor will pick this up and break it into implementable sub-issues.
Author
Owner

Closed by overseer: issue already resolved by commit 86ac2a6 on main (1 commit ahead of origin).

Acceptance criteria satisfied:

  • Resolves ambiguity: adopted Option C (both POST /invoices for manual + POST /invoices/from-ticket/{ticket_id} preserved)
  • Implementation updated: standalone POST /invoices endpoint (admin/billing), 404 on unknown customer, InvoiceCreate + InvoiceLineCreate schemas
  • Documentation updated: docs/API.md documents both creation paths
  • Tests added: backend/tests/test_invoices_create.py (success, empty lines, unknown customer, RBAC, 422 validation)

Uncommitted working-tree changes relate to other issues (#32 SLA / webhooks) and are out of scope for #4.

Closed by overseer: issue already resolved by commit 86ac2a6 on main (1 commit ahead of origin). Acceptance criteria satisfied: - Resolves ambiguity: adopted Option C (both POST /invoices for manual + POST /invoices/from-ticket/{ticket_id} preserved) - Implementation updated: standalone POST /invoices endpoint (admin/billing), 404 on unknown customer, InvoiceCreate + InvoiceLineCreate schemas - Documentation updated: docs/API.md documents both creation paths - Tests added: backend/tests/test_invoices_create.py (success, empty lines, unknown customer, RBAC, 422 validation) Uncommitted working-tree changes relate to other issues (#32 SLA / webhooks) and are out of scope for #4.
Mark closed this issue 2026-07-08 16:08:05 +00:00
Sign in to join this conversation.
No description provided.