feat(org): carry task org across the State Store gRPC contract (archie-core-e5fn)

This commit is contained in:
sam committed 2026-09-26 11:43:10 +10:00
1 parent 62e9e9cb28
commit fcc9322237
4 files changed
+24 -5

No files matched your search

+15 -3
View File
@@ -1319,7 +1319,11 @@ type Task struct {
RemediationRounds int32 `protobuf:"varint,33,opt,name=remediation_rounds,json=remediationRounds,proto3" json:"remediation_rounds,omitempty"`
// inputs_json is the JSON object of workflow inputs a binding dispatch
// resolved (task.EncodeInputs); empty for a task no binding started.
InputsJson string `protobuf:"bytes,34,opt,name=inputs_json,json=inputsJson,proto3" json:"inputs_json,omitempty"`
InputsJson string `protobuf:"bytes,34,opt,name=inputs_json,json=inputsJson,proto3" json:"inputs_json,omitempty"`
// org is the org the task belongs to, derived store-side from the task's
// identity when the row is written; a task of a single-operator install
// belongs to the default org (docs/prds/orgs-and-access.md).
Org string `protobuf:"bytes,35,opt,name=org,proto3" json:"org,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -1592,6 +1596,13 @@ func (x *Task) GetInputsJson() string {
return ""
}
func (x *Task) GetOrg() string {
if x != nil {
return x.Org
}
return ""
}
// Event mirrors internal/events.Event. Data is carried as a JSON object
// string (matching the store's own on-disk representation) rather than
// google.protobuf.Struct, to stay a direct mirror of the existing column.
@@ -9651,7 +9662,7 @@ const file_state_v1_state_proto_rawDesc = "" +
"\asubject\x18\x03 \x01(\tR\asubject\x12-\n" +
"\x05audit\x18\x04 \x01(\v2\x17.state.v1.IdentityAuditR\x05audit\"M\n" +
"\x1bBindIdentitySubjectResponse\x12.\n" +
"\bidentity\x18\x01 \x01(\v2\x12.state.v1.IdentityR\bidentity\"\xfa\b\n" +
"\bidentity\x18\x01 \x01(\v2\x12.state.v1.IdentityR\bidentity\"\x8c\t\n" +
"\x04Task\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x14\n" +
"\x05owner\x18\x02 \x01(\tR\x05owner\x12\x12\n" +
@@ -9697,7 +9708,8 @@ const file_state_v1_state_proto_rawDesc = "" +
"park_class\x18 \x01(\tR\tparkClass\x12-\n" +
"\x12remediation_rounds\x18! \x01(\x05R\x11remediationRounds\x12\x1f\n" +
"\vinputs_json\x18\" \x01(\tR\n" +
"inputsJson\"\xf8\x02\n" +
"inputsJson\x12\x10\n" +
"\x03org\x18# \x01(\tR\x03org\"\xf8\x02\n" +
"\x05Event\x12\x0e\n" +
"\x02id\x18\x01 \x01(\x03R\x02id\x12*\n" +
"\x02at\x18\x02 \x01(\v2\x1a.google.protobuf.TimestampR\x02at\x12\x12\n" +
+2 -2
View File
@@ -244,8 +244,8 @@ func TestPublishedEnvelopeCarriesIssueIdentityAndKind(t *testing.T) {
if !slices.Contains(task.Labels, testLabel) || !slices.Contains(task.Labels, "bug") {
t.Errorf("envelope labels = %v, want to contain %q and %q", task.Labels, testLabel, "bug")
}
if task.IdempotencyKey() != "archie:owner/repo/42" {
t.Errorf("idempotency key = %q, want archie:owner/repo/42", task.IdempotencyKey())
if task.IdempotencyKey() != "archie:default//owner/repo/42" {
t.Errorf("idempotency key = %q, want archie:default//owner/repo/42", task.IdempotencyKey())
}
}
@@ -15,6 +15,7 @@ import (
"github.com/samcharles93/archie-core/internal/domain/binding"
"github.com/samcharles93/archie-core/internal/domain/eventtype"
"github.com/samcharles93/archie-core/internal/domain/mapping"
"github.com/samcharles93/archie-core/internal/domain/org"
"github.com/samcharles93/archie-core/internal/domain/source"
"github.com/samcharles93/archie-core/internal/domain/storecontract"
"github.com/samcharles93/archie-core/internal/domain/storepkg"
@@ -78,6 +79,7 @@ func taskProto(t *task.Task) *pb.Task { //nolint:dupl // mirror-image field-by-f
WorkflowDefinitionVersion: t.WorkflowDefinitionVersion,
WorkflowDefinitionDigest: t.WorkflowDefinitionDigest,
WorkflowDefinitionYaml: t.WorkflowDefinitionYAML,
Org: string(t.Org),
}
}
@@ -102,6 +104,7 @@ func taskValue(t *pb.Task) *task.Task { //nolint:dupl // see taskProto above
WorkflowDefinitionVersion: t.WorkflowDefinitionVersion,
WorkflowDefinitionDigest: t.WorkflowDefinitionDigest,
WorkflowDefinitionYAML: t.WorkflowDefinitionYaml,
Org: org.OrgID(t.Org),
}
}
+4
View File
@@ -278,6 +278,10 @@ message Task {
// inputs_json is the JSON object of workflow inputs a binding dispatch
// resolved (task.EncodeInputs); empty for a task no binding started.
string inputs_json = 34;
// org is the org the task belongs to, derived store-side from the task's
// identity when the row is written; a task of a single-operator install
// belongs to the default org (docs/prds/orgs-and-access.md).
string org = 35;
}
// Event mirrors internal/events.Event. Data is carried as a JSON object