Skip to content

Commit 05a2f37

Browse files
agbishopWitness Patrolclaude
authored
feat: parity batch 12 (BigQuery async jobs and load/extract options; Connect attached files and replication; Neptune Gremlin realism; OCI Identity federation and bulk tags; Compute interconnects and catalogue) (#2546)
* feat(gcpbigquery): asynchronous jobs, load options, multi-URI and AVRO extract, CAST FORMAT Jobs inserted through jobs.insert now move PENDING, RUNNING, DONE on a worker, with cancel, jobTimeoutMs and timeoutMs long-polling. Load jobs honour custom quotes, schemaUpdateOptions, hive partitioning and maxBadRecords. Extract shards across several destination URIs and writes AVRO. CAST ... FORMAT covers date and time types. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * feat(connect): attached files in S3, instance replication, contact transfer, evaluation scoring Attached files upload and download through pre-signed S3 URLs when S3 is wired. ReplicateInstance and cross-region routing are routed and persisted. TransferContact creates a linked TRANSFER contact. Evaluation scoring honours weights, exclusions, automatic fail targets and thresholds. GetMetricDataV2 gains transfer and handle-time metrics. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * fix(gcpbigquery): requestId replay, job drop on reset, strict append schema merge, CAST FORMAT ranges A replayed requestId no longer reports an unfinished or failed job as an empty success. Jobs dropped by Reset or Restore do not execute. Jobs are refused after Close. Append loads compare modes and nested RECORD fields. Hive partition columns are validated. CAST FORMAT rejects out-of-range day, year and offset parts and applies AT TIME ZONE only to TIMESTAMP. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * feat(neptune): JSON-LD @JSON and @direction, openCypher extended datetime lab mode rdf:JSON literals are canonicalised per RFC 8785. datetime() keeps milliseconds and the input offset when neptune_lab_mode has DatetimeMillisecond=enabled. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * fix(gcpbigquery): split quoted CSV over bytes, cap extract destination URIs The custom-quote splitter no longer copies the input into runes. Extract jobs with more than 500 destination URIs are rejected. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * fix(connect): finite evaluation scores, attachment cleanup on instance delete, upload window Evaluation weights are capped and negative option scores floor at zero so scores never become NaN. DeleteInstance removes attachment objects from S3. Uploads left PROCESSING for an hour read as FAILED. The bucket is created only after the request validates. CONTACTS_TRANSFERRED_IN is not a GetMetricDataV2 metric and is removed. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * fix(neptune): lab-mode flag without backend lock, strict JSON-LD value objects, GraphBinary subgraph datetime() read the lab mode under the backend lock while holding the graph semaphore, which could deadlock against a snapshot; the flag is now held per graph. Value objects with @type reject @language and @direction, and a @JSON term in a @list container yields one literal. subgraph() results encode as the GraphBinary Graph type. Meta-properties are dropped as Neptune does. Adds a differential test for the CSV quote splitter. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * feat(neptune): Gremlin set cardinality by default, documented unsupported steps, traverser bulk Vertex properties default to set cardinality and list is rejected, as the Neptune compliance page states. io() writes, program(), tx() and lambdas return UnsupportedOperationException. barrier() merges equal traversers with bulk, applies the withSack merge operator and supports normSack. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * fix(neptune): per-value property drop, injective merge keys, typed Date and UUID values Dropping one value of a multi-valued property no longer removes the key. Dedup and barrier keys include the property value and are length-prefixed. Date values keep their type across GraphSON, GraphBinary and snapshots. UUID property values are rejected as Neptune documents. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * feat(ociidentity): bulk tag operations, network sources, identity providers, stored credentials, cross-service compartment delete BulkEditTags and BulkDeleteTags run as tagging work requests with per-resource errors. Network sources, the authentication policy, region subscriptions, SAML2 identity providers and group mappings are routed and persisted. Customer secret keys and SMTP credentials are stored and credential creation replays on opc-retry-token. DeleteCompartment refuses a compartment that still holds buckets, DNS resources or streams. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * fix(ociidentity): digest SMTP passwords, constant-cost verification, strict SAML metadata, bounded bulk edits SMTP passwords are stored as a salted digest and legacy plaintext is digested on restore. Verification derives once even for unknown users and outside the lock. Replay secrets are pruned. SAML metadata must carry a base64 certificate and an absolute http(s) redirect URL. Bulk tag edits validate value types, cap tags per resource and scope the retry token. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * feat(gcpcompute): regional Cloud Armor policies, interconnects, licenses, GPUs, consensus peering, wider catalogue Regional security policies and edge policy attachment are routed with in-use protection. Licenses, interconnects, interconnect attachments, instant snapshot groups, future reservations and accelerator types are real resources. guestAccelerators are validated at insert. updatePeering supports the CONSENSUS strategy. The catalogue covers 43 regions and more machine families, and regions and projects report quota usage. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * fix(gcpcompute): accept legacy GPU types and custom N1 machines, N2D Local SSD, consensus state on mixed peerings GPU types outside the catalogue that were accepted before are accepted again, and custom N1 machine types may carry GPUs. N2D instances accept Local SSD. A CONSENSUS update no longer writes handshake state onto an INDEPENDENT peer. listPreconfiguredExpressionSets is not routed until its expressions can be sourced. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * docs: regenerate service READMEs and operation badge Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY * refactor(ociidentity): unexport credential helpers that return unexported types Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NVwMjLknMM32Xje6Qik6wY --------- Co-authored-by: Witness Patrol <blackbird7181@gmail.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
1 parent d7774b9 commit 05a2f37

205 files changed

Lines changed: 19306 additions & 862 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.badges/operations.svg‎

Lines changed: 3 additions & 3 deletions
Loading

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ Every service links to its own page with a coverage breakdown — audited operat
741741
| [DynamoDB Streams](services/dynamodbstreams/README.md) | A | 4 | clean |
742742
| [ElastiCache](services/elasticache/README.md) | A | 75 | 4 structural gaps; 1 deferred |
743743
| [MemoryDB](services/memorydb/README.md) | A | 45 | 3 gaps; 2 structural gaps; 3 deferred |
744-
| [Neptune](services/neptune/README.md) | A | — | 13 families; 7 gaps; 2 structural gaps; 2 deferred |
744+
| [Neptune](services/neptune/README.md) | A | — | 13 families; 6 gaps; 2 structural gaps; 2 deferred |
745745
| [QLDB](services/qldb/README.md) | Removed | — | removed service |
746746
| [QLDB Session](services/qldbsession/README.md) | Removed | — | removed service |
747747
| [RDS](services/rds/README.md) | A | 52 | 5 gaps; 7 structural gaps |
@@ -972,7 +972,7 @@ Every service links to its own page with a coverage breakdown — audited operat
972972
| [Cloud Scheduler](services/gcpscheduler/README.md) | B | 10 | clean |
973973
| [Cloud Spanner](services/gcpspanner/README.md) | B | 31 | 2 gaps |
974974
| [Cloud Tasks](services/gcpcloudtasks/README.md) | B | 20 | clean |
975-
| [Compute Engine](services/gcpcompute/README.md) | B | — | 8 families; 6 gaps |
975+
| [Compute Engine](services/gcpcompute/README.md) | B | 1 | 6 gaps |
976976
| [Eventarc](services/gcpeventarc/README.md) | B | 47 | 3 gaps |
977977
| [Google Cloud Batch](services/gcpbatch/README.md) | B | 14 | 4 gaps |
978978
| [Google Cloud Firestore](services/gcpfirestore/README.md) | B | 17 | 3 gaps |
@@ -1000,7 +1000,7 @@ Every service links to its own page with a coverage breakdown — audited operat
10001000
| [OCI Events](services/ocievents/README.md) | B | 6 | 4 gaps |
10011001
| [OCI File Storage](services/ocifilestorage/README.md) | B | 74 | 3 gaps |
10021002
| [OCI Functions](services/ocifunctions/README.md) | B | 16 | 2 gaps |
1003-
| [OCI Identity](services/ociidentity/README.md) | B | 76 | 7 gaps |
1003+
| [OCI Identity](services/ociidentity/README.md) | B | 97 | 7 gaps |
10041004
| [OCI Load Balancer](services/ociloadbalancer/README.md) | B | 61 | 3 gaps |
10051005
| [OCI Logging](services/ocilogging/README.md) | B | 32 | 2 gaps |
10061006
| [OCI Monitoring](services/ocimonitoring/README.md) | B | 18 | 3 gaps |
@@ -1028,7 +1028,7 @@ Every service links to its own page with a coverage breakdown — audited operat
10281028
| [Cloudfrontkeyvaluestore](services/cloudfrontkeyvaluestore/README.md) | A | 6 | 2 structural gaps |
10291029
| [Cloudhsmv2](services/cloudhsmv2/README.md) | B | 18 | 3 structural gaps |
10301030
| [Codegurureviewer](services/codegurureviewer/README.md) | B | 14 | 2 structural gaps |
1031-
| [Connect](services/connect/README.md) | B | 393 | 10 gaps; 2 structural gaps |
1031+
| [Connect](services/connect/README.md) | B | 397 | 9 gaps; 2 structural gaps |
10321032
| [Cur](services/cur/README.md) | B | 7 | 1 gap |
10331033
| [Directconnect](services/directconnect/README.md) | A | 73 | 8 structural gaps; 1 deferred |
10341034
| [Dsql](services/dsql/README.md) | A | 16 | 8 gaps; 2 structural gaps |

‎internal/app/cli.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3975,6 +3975,7 @@ func wireOCIIdentityKeys(byName map[string]service.Registerable) {
39753975
if h, found := byName["OCIObjectStorage"].(*ociobjectstoragebackend.Handler); found {
39763976
h.Backend.Auth.Link(identityH.Backend.Auth)
39773977
h.Backend.SetTagLookup(identityH.Backend.TagDefinition)
3978+
identityH.Backend.AddCompartmentUsage(h.Backend.HoldsInCompartment)
39783979
}
39793980

39803981
if h, found := byName["OCIVault"].(*ocivaultbackend.Handler); found {
@@ -3990,6 +3991,7 @@ func wireOCIIdentityKeys(byName map[string]service.Registerable) {
39903991
return valid
39913992
})
39923993
h.Backend.SetTagLookup(identityH.Backend.TagDefinition)
3994+
identityH.Backend.AddCompartmentUsage(h.Backend.HoldsInCompartment)
39933995
}
39943996

39953997
if h, found := byName["OCIFunctions"].(*ocifunctionsbackend.Handler); found {
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
package app
2+
3+
import (
4+
"bytes"
5+
"io"
6+
"net/http"
7+
"net/url"
8+
"strings"
9+
"testing"
10+
11+
"github.com/aws/aws-sdk-go-v2/aws"
12+
connectsdk "github.com/aws/aws-sdk-go-v2/service/connect"
13+
connecttypes "github.com/aws/aws-sdk-go-v2/service/connect/types"
14+
"github.com/aws/aws-sdk-go-v2/service/s3"
15+
"github.com/stretchr/testify/assert"
16+
"github.com/stretchr/testify/require"
17+
18+
"github.com/blackbirdworks/gopherstack/pkgs/testclient"
19+
)
20+
21+
func connectDo(t *testing.T, method, target string, body []byte) (int, []byte) {
22+
t.Helper()
23+
24+
req, err := http.NewRequestWithContext(t.Context(), method, target, bytes.NewReader(body))
25+
require.NoError(t, err)
26+
27+
resp, err := testclient.New(t).Do(req)
28+
require.NoError(t, err)
29+
30+
defer resp.Body.Close()
31+
32+
data, err := io.ReadAll(resp.Body)
33+
require.NoError(t, err)
34+
35+
return resp.StatusCode, data
36+
}
37+
38+
// connectAttachedFileCase drives the attached-file upload through real S3 pre-signed URLs.
39+
func connectAttachedFileCase(t *testing.T, e *connectWiringEnv) {
40+
t.Helper()
41+
42+
content := []byte("wired attachment")
43+
44+
task, err := e.connect.CreateContact(t.Context(), &connectsdk.CreateContactInput{
45+
InstanceId: e.instance.Id, Channel: connecttypes.ChannelTask,
46+
InitiationMethod: connecttypes.ContactInitiationMethodApi, Name: aws.String("wired task"),
47+
})
48+
require.NoError(t, err)
49+
50+
desc, err := e.connect.DescribeContact(t.Context(),
51+
&connectsdk.DescribeContactInput{InstanceId: e.instance.Id, ContactId: task.ContactId})
52+
require.NoError(t, err)
53+
54+
resource := desc.Contact.Arn
55+
56+
start, err := e.connect.StartAttachedFileUpload(t.Context(), &connectsdk.StartAttachedFileUploadInput{
57+
InstanceId: e.instance.Id, AssociatedResourceArn: resource, FileName: aws.String("wired.txt"),
58+
FileSizeInBytes: aws.Int64(int64(len(content))), FileUseCaseType: connecttypes.FileUseCaseTypeAttachment,
59+
})
60+
require.NoError(t, err)
61+
62+
upload := aws.ToString(start.UploadUrlMetadata.Url)
63+
parsed, err := url.Parse(upload)
64+
require.NoError(t, err)
65+
assert.Contains(t, parsed.Path, "/connect-attached-files-")
66+
assert.NotEmpty(t, parsed.Query().Get("X-Amz-Signature"), "a real SigV4 pre-signed S3 URL")
67+
68+
complete := &connectsdk.CompleteAttachedFileUploadInput{
69+
InstanceId: e.instance.Id, FileId: start.FileId, AssociatedResourceArn: resource,
70+
}
71+
72+
_, err = e.connect.CompleteAttachedFileUpload(t.Context(), complete)
73+
assert.Equal(t, "InvalidRequestException", connectErrCode(err), "nothing uploaded yet")
74+
75+
status, _ := connectDo(t, http.MethodPut, upload, content)
76+
require.Equal(t, http.StatusOK, status)
77+
78+
_, err = e.connect.CompleteAttachedFileUpload(t.Context(), complete)
79+
require.NoError(t, err)
80+
81+
got, err := e.connect.GetAttachedFile(t.Context(), &connectsdk.GetAttachedFileInput{
82+
InstanceId: e.instance.Id, FileId: start.FileId, AssociatedResourceArn: resource,
83+
})
84+
require.NoError(t, err)
85+
assert.Equal(t, connecttypes.FileStatusTypeApproved, got.FileStatus)
86+
87+
status, body := connectDo(t, http.MethodGet, aws.ToString(got.DownloadUrlMetadata.Url), nil)
88+
require.Equal(t, http.StatusOK, status)
89+
assert.Equal(t, content, body)
90+
91+
_, err = e.connect.DeleteAttachedFile(t.Context(), &connectsdk.DeleteAttachedFileInput{
92+
InstanceId: e.instance.Id, FileId: start.FileId, AssociatedResourceArn: resource,
93+
})
94+
require.NoError(t, err)
95+
96+
loc := strings.SplitN(strings.TrimPrefix(parsed.Path, "/"), "/", 2)
97+
require.Len(t, loc, 2)
98+
99+
_, err = e.objects.HeadObject(t.Context(), &s3.HeadObjectInput{Bucket: aws.String(loc[0]), Key: aws.String(loc[1])})
100+
require.Error(t, err, "the object is removed with the file")
101+
}

‎internal/app/connect_wiring.go‎

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
package app
22

33
import (
4+
"bytes"
45
"context"
6+
"errors"
57
"io"
8+
"net/url"
9+
"time"
610

11+
"github.com/aws/aws-sdk-go-v2/aws"
712
awss3 "github.com/aws/aws-sdk-go-v2/service/s3"
813

14+
"github.com/blackbirdworks/gopherstack/pkgs/awsmeta"
915
"github.com/blackbirdworks/gopherstack/pkgs/service"
1016
appintegrationsbackend "github.com/blackbirdworks/gopherstack/services/appintegrations"
1117
connectbackend "github.com/blackbirdworks/gopherstack/services/connect"
@@ -47,6 +53,69 @@ func (c connectShares) DeleteShare(_ context.Context, shareARN string) error {
4753
type connectResolvers struct {
4854
lambda lambdabackend.StorageBackend
4955
s3 s3backend.StorageBackend
56+
s3h *s3backend.S3Handler
57+
}
58+
59+
const connectPresignFallbackKey = "AKIAGOPHERSTACK"
60+
61+
func (r connectResolvers) EnsureBucket(ctx context.Context, bucket string) error {
62+
if r.BucketExists(ctx, bucket) {
63+
return nil
64+
}
65+
66+
_, err := r.s3.CreateBucket(ctx, &awss3.CreateBucketInput{Bucket: &bucket})
67+
if err != nil && !r.BucketExists(ctx, bucket) {
68+
return err
69+
}
70+
71+
return nil
72+
}
73+
74+
func (r connectResolvers) ObjectSize(ctx context.Context, bucket, key string) (int64, bool, error) {
75+
out, err := r.s3.HeadObject(ctx, &awss3.HeadObjectInput{Bucket: &bucket, Key: &key})
76+
if errors.Is(err, s3backend.ErrNoSuchKey) {
77+
return 0, false, nil
78+
}
79+
80+
if err != nil {
81+
return 0, false, err
82+
}
83+
84+
return aws.ToInt64(out.ContentLength), true, nil
85+
}
86+
87+
func (r connectResolvers) PutObject(ctx context.Context, bucket, key string, data []byte) error {
88+
_, err := r.s3.PutObject(ctx, &awss3.PutObjectInput{Bucket: &bucket, Key: &key, Body: bytes.NewReader(data)})
89+
90+
return err
91+
}
92+
93+
func (r connectResolvers) DeleteObject(ctx context.Context, bucket, key string) error {
94+
_, err := r.s3.DeleteObject(ctx, &awss3.DeleteObjectInput{Bucket: &bucket, Key: &key})
95+
96+
return err
97+
}
98+
99+
func (r connectResolvers) Presign(
100+
ctx context.Context,
101+
method, baseURL, bucket, key string,
102+
ttl time.Duration,
103+
at time.Time,
104+
bound map[string]string,
105+
) string {
106+
accessKey := awsmeta.AccessKeyID(ctx)
107+
if accessKey == "" {
108+
accessKey = connectPresignFallbackKey
109+
}
110+
111+
region := awsmeta.Region(ctx)
112+
if region == "" {
113+
region = r.s3h.DefaultRegion
114+
}
115+
116+
target := baseURL + "/" + bucket + "/" + (&url.URL{Path: key}).EscapedPath()
117+
118+
return r.s3h.PresignURL(method, target, accessKey, region, ttl, at, bound)
50119
}
51120

52121
func (r connectResolvers) LambdaFunctionExists(_ context.Context, functionARN string) bool {
@@ -166,6 +235,6 @@ func wireConnectIntegrations(byName map[string]service.Registerable) {
166235
s3H, sok := byName["S3"].(*s3backend.S3Handler)
167236

168237
if lok && sok {
169-
cn.Backend.SetResolvers(connectResolvers{lambda: lambdaH.Backend, s3: s3H.Backend})
238+
cn.Backend.SetResolvers(connectResolvers{lambda: lambdaH.Backend, s3: s3H.Backend, s3h: s3H})
170239
}
171240
}

‎internal/app/connect_wiring_test.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ func TestInitializeServices_ConnectWiring(t *testing.T) {
6666
assert.Equal(t, "InvalidRequestException", connectErrCode(err))
6767
}},
6868
{name: "prompts read S3 objects", run: connectPromptCase},
69+
{name: "attached files use S3 pre-signed URLs", run: connectAttachedFileCase},
6970
{name: "outbound email is delivered through SES", run: connectOutboundEmailCase},
7071
{name: "analytics association owns a RAM share", run: connectAnalyticsShareCase},
7172
{name: "storage config needs its bucket", run: func(t *testing.T, e *connectWiringEnv) {

‎internal/app/ocidns_wiring.go‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ func wireOCIDNS(byName map[string]service.Registerable) {
2121
dnsH.Backend.Auth.Link(identityH.Backend.Auth)
2222
dnsH.Backend.SetCompartmentChecker(identityH.Backend.CompartmentActive)
2323
dnsH.Backend.SetTagLookup(identityH.Backend.TagDefinition)
24+
identityH.Backend.AddCompartmentUsage(dnsH.Backend.HoldsInCompartment)
2425
}
2526

2627
if coreH, found := byName["OCICore"].(*ocicorebackend.Handler); found {

0 commit comments

Comments
 (0)