fix(contracts): TOMs are available once the released TOM is listed
ci / shared (pull_request) Successful in 12s
ci / test (pull_request) Successful in 7m24s
ci / image (pull_request) Skipped

The contracts overview reported the TOMs as "pending" unconditionally,
from before the TOM was released, so the portal showed "Wird
bereitgestellt" above the released TOM 1.0.0 on stage. The status is
now "available" when a TOM document is listed for the tenant (i.e.
released and CONTRACT_DOCUMENTS on), and stays "pending" otherwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sharang ParnerkarandClaude Opus 5.5 committed 2026-11-16 22:38:10 +01:00
1 parent 8d7bfac810
commit 2921fa0663
2 files changed
+14 -1

No files matched your search

+6 -1
View File
@@ -23,6 +23,7 @@ import (
type contractsView struct {
Trial json.RawMessage `json:"trial"`
AVV contractStatus `json:"avv"`
TOMs contractStatus `json:"toms"`
Documents []contractDocument `json:"documents"`
}
@@ -122,7 +123,7 @@ func TestContractCatalogueNamesKnownProductsAndServices(t *testing.T) {
func TestContractDocuments_gateOff(t *testing.T) {
f := newContractFixture(t, false)
v, raw := f.contracts(t)
if !strings.Contains(raw, `"documents":[]`) || len(v.Documents) != 0 || v.AVV.Status != "not_concluded" {
if !strings.Contains(raw, `"documents":[]`) || len(v.Documents) != 0 || v.AVV.Status != "not_concluded" || v.TOMs.Status != "pending" {
t.Fatalf("gate off: %s", raw)
}
if code, _, _ := f.contractPDF(t, "lb-plattform.pdf"); code != 404 {
@@ -144,6 +145,10 @@ func TestContractDocuments_leistungsbeschreibungen(t *testing.T) {
if got := docIDs(v.Documents); got != "agb,tom,lb-plattform,lb-pruefwerk,lb-firmwerk" {
t.Fatalf("documents: %s", got)
}
// With the TOM listed, the TOMs are available rather than pending.
if v.TOMs.Status != "available" {
t.Errorf("toms status %q", v.TOMs.Status)
}
pw := v.Documents[3]
if pw.Kind != "lb" || pw.Version != "1.0.3" || pw.Date != "09.11.2026" || pw.Product != "pruefwerk" || pw.TenantSpecific ||
pw.SHA256 != contractdocs.Default().Get("lb-pruefwerk").SHA256 || pw.Title != "Leistungsbeschreibung Prüfwerk" {
+8
View File
@@ -27,6 +27,7 @@ import (
"time"
"unicode"
"git.breakpilot.com/platform/tenant-registry/internal/legal/contractdocs"
"git.breakpilot.com/platform/tenant-registry/internal/legal/trialterms"
bpmail "git.breakpilot.com/platform/tenant-registry/internal/mail"
"git.breakpilot.com/platform/tenant-registry/internal/store"
@@ -675,6 +676,13 @@ func (s *Server) listTenantContracts(w http.ResponseWriter, r *http.Request) {
writeError(w, http.StatusInternalServerError, "internal", err.Error())
return
}
// The TOMs are "pending" until a released TOM is listed for this tenant
// (released 16.11.2026; listed only while CONTRACT_DOCUMENTS is on).
for _, d := range resp.Documents {
if d.Kind == contractdocs.KindTOM {
resp.TOMs = contractStatus{"available"}
}
}
writeJSON(w, http.StatusOK, resp)
}