mirror of
https://github.com/hanzoai/s3.git
synced 2026-11-02 13:11:24 +00:00
hanzoai/s3 was an AGPL-3.0 MinIO fork whose network-copyleft blocks embedding
and reselling as a managed service. Replace it wholesale with a fork of
SeaweedFS (github.com/seaweedfs/seaweedfs, Apache-2.0, Go) which ships a
built-in S3 gateway + Filer.
- License: AGPL-3.0 -> Apache-2.0 (upstream LICENSE kept verbatim, incl.
"Copyright 2025 Chris Lu"); NOTICE added crediting SeaweedFS. No AGPL/BUSL/
SSPL/GPL or enterprise ("ee") files remain.
- Module: go.mod path set to github.com/hanzoai/s3 with a self-replace
(replace github.com/seaweedfs/seaweedfs => ./) so the ~1800 internal Go files
keep their upstream import paths with zero churn. Internal identifiers and
import paths are intentionally NOT renamed.
- CLI rebrand: the binary is built as `s3` (was `weed`); root usage, per-command
help/usage/flag strings, shell autocomplete program name, and the product name
in CLI output now read "Hanzo S3" / `s3`. Users never see `weed`.
(e.g. `s3 server`, `s3 filer`, `s3 master`, `s3 volume`, `s3 s3`, `s3 mount`.)
- Build: `make` (or `go build -o s3 ./weed`) builds the `s3` binary green;
`cmd/weed-db` and `cmd/weed-sql` also build; `go vet ./weed/command/` clean.
- README/LLM.md rewritten for Hanzo S3; AGENTS.md/CLAUDE.md symlinks preserved.
- Dropped a 33MB prebuilt Mach-O `stress` binary upstream had committed; `.gitignore`
updated to ignore the `s3` build output.
103 lines
3.3 KiB
Go
103 lines
3.3 KiB
Go
package s3tables
|
|
|
|
import "testing"
|
|
|
|
// TestIcebergLayoutValidator_AcceptsRealWorldManifestNames pins down the
|
|
// filename patterns we must accept across Iceberg engines. The original strict
|
|
// regex only covered Iceberg-internal naming (`{uuid}-m{n}.avro`,
|
|
// `snap-{n}-{n}-{uuid}.avro`) and rejected real manifests written by Flink and
|
|
// other writers, causing 403s during INSERT commits. The catch-all entries
|
|
// added alongside this test must keep these names valid.
|
|
func TestIcebergLayoutValidator_AcceptsRealWorldManifestNames(t *testing.T) {
|
|
cases := []struct {
|
|
name string
|
|
path string
|
|
}{
|
|
{
|
|
"flink-style manifest (job-id + checkpoint + operator-id + counter)",
|
|
"metadata/02678a59b3d6b460ba392851d77155fc-1-cbc357ccb763df2852fee8c4fc7d55f2-00001.avro",
|
|
},
|
|
{
|
|
"spark-style manifest with two uuids and -m suffix",
|
|
"metadata/00000000-0000-0000-0000-000000000000-m0.avro",
|
|
},
|
|
{
|
|
"snapshot manifest list with iceberg-internal naming",
|
|
"metadata/snap-7234891234567890123-1-82e3eec4-3aee-414f-a444-94c03c641d20.avro",
|
|
},
|
|
{
|
|
"versioned table metadata",
|
|
"metadata/v1.metadata.json",
|
|
},
|
|
{
|
|
"uuid-named metadata json (newer iceberg)",
|
|
"metadata/82e3eec4-3aee-414f-a444-94c03c641d20.metadata.json",
|
|
},
|
|
{
|
|
"flink-style metadata json with dashes and digits",
|
|
"metadata/02678a59-1-cbc357cc.metadata.json",
|
|
},
|
|
{
|
|
"version hint",
|
|
"metadata/version-hint.text",
|
|
},
|
|
{
|
|
"trino/iceberg stats file",
|
|
"metadata/table.stats",
|
|
},
|
|
}
|
|
|
|
v := NewIcebergLayoutValidator()
|
|
for _, tc := range cases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
if err := v.ValidateFilePath(tc.path); err != nil {
|
|
t.Errorf("expected %q to be accepted, got error: %v", tc.path, err)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
// TestIcebergLayoutValidator_RejectsClearlyBadMetadataNames guards the
|
|
// catch-all from being too permissive — paths that look like attempts to
|
|
// escape the metadata layout or have forbidden file types must still fail.
|
|
func TestIcebergLayoutValidator_RejectsClearlyBadMetadataNames(t *testing.T) {
|
|
cases := []struct {
|
|
name string
|
|
path string
|
|
}{
|
|
{"random extension", "metadata/random-file.txt"},
|
|
{"executable masquerading as avro path", "metadata/evil.sh"},
|
|
{"subdirectory under metadata is not allowed", "metadata/sub/file.avro"},
|
|
{"top-level dir other than metadata or data", "garbage/file.avro"},
|
|
{"catch-all anchors must reject trailing extension", "metadata/file.avro.txt"},
|
|
}
|
|
|
|
v := NewIcebergLayoutValidator()
|
|
for _, tc := range cases {
|
|
t.Run(tc.name, func(t *testing.T) {
|
|
if err := v.ValidateFilePath(tc.path); err == nil {
|
|
t.Errorf("expected %q to be rejected, but it passed validation", tc.path)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
// TestIcebergLayoutValidator_AcceptsRealWorldDataFiles is a sanity check that
|
|
// the patterns most engines actually emit for data files still pass.
|
|
func TestIcebergLayoutValidator_AcceptsRealWorldDataFiles(t *testing.T) {
|
|
cases := []string{
|
|
"data/00000-0-ede83b82-08e1-40cd-af8a-6d83680a5194-00001.parquet",
|
|
"data/part-00000.parquet",
|
|
"data/some-file.orc",
|
|
"data/year=2026/month=05/00000-0-uuid.parquet",
|
|
}
|
|
v := NewIcebergLayoutValidator()
|
|
for _, p := range cases {
|
|
t.Run(p, func(t *testing.T) {
|
|
if err := v.ValidateFilePath(p); err != nil {
|
|
t.Errorf("expected %q to be accepted, got error: %v", p, err)
|
|
}
|
|
})
|
|
}
|
|
}
|