Repository navigation
Merged
Conversation
This was referenced Oct 15, 2026
Merged
…collisions (#944) UploadStageOutputs kept an absolute data_output path whole, so "/data/processed/a.csv" arrived downstream as "<dest_path>/data/processed/a.csv", while a relative pattern was keyed by basename only. With instance_count > 1 every instance uploaded to the same output/ prefix and same-named outputs overwrote each other. OutputRelPath keys every file by its path relative to the pattern's directory part (globRoot), absolute and relative alike. Instances of a multi-instance stage upload under StageInstanceOutputPrefix (output/<instance-index>/), decided from the definition's instance_count, which the runner now hands the data handler. Two files of one upload mapping to one key, or two source stages delivering one local path, fail instead of overwriting; a key that would leave dest_path is refused. data_input.pattern is matched against the same relative path (within the instance directory for a multi-instance source); Validate rejects an absolute pattern, which could never match. examples/pipelines/README.md documents the layout; fanout-fanin.json (absolute patterns, colliding fan-in names) and ml-training.json (evaluate reads /models/0/best.h5) follow it. TestS3KeyGeneration re-implemented the old rule in its body and asserted the bug; it now calls the code with the README's table. The examples are run through the real upload/download on the emulator, and the real spored is shown to upload instance 1 of 2 under output/1/. Each guard was watched failing against a compiling revert. (#944)
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #944
Stacked on #972 (fix/943). This PR's base is
fix/943. Merge in order: #931, #942, #957, #972, then this.Cost safety. Found by reading
pkg/pipeline/data_handoff.go, then tested locally against the in-process Substrate emulator, and with the realsporedbuilt from this tree. No AWS resources were created, nothing was launched and nothing was deployed.What was wrong
UploadStageOutputskept an absolutedata_outputpath whole. Sopreprocess's/data/processed/a.csvinexamples/pipelines/ml-training.jsonarrived intrainas/data/input/data/processed/a.csv. A relative pattern was keyed by basename only, which collapsed any subdirectories.instance_count > 1, every instance uploaded to the sameoutput/prefix.train's fourbest.h5overwrote each other, and the last upload won.source_stagesthat both outputx.csvoverwrote each other indest_path.fanout-fanin.json'sdata_input.patternvalues were absolute (/data/chunks/chunk-1-*). They are matched against key-relative paths, so they could never match, and those stages received nothing.TestS3KeyGenerationre-implemented the old rule in its own body without calling the code, and asserted the bug.What changed
OutputRelPathkeys a file by its path relative to the pattern's directory part: everything before the first segment containing*,?or[, or the file's directory for a literal path. So/data/processed/*→a.csv,/data/*/part.csv→2026/part.csv,/logs/training.log→training.log. Absolute and relative patterns behave alike.instance_count > 1uploads underoutput/<instance-index>/(StageInstanceOutputPrefix). Its files arrive downstream as<dest_path>/<index>/<file>. Both sides decide this from the definition'sinstance_count, which the runner now hands to the data handler.dest_path(../) is refused.data_input.pattern. It is matched against the same relative path. For a multi-instance source it is matched within each instance's directory, so*.h5picks every instance's model.Validaterejects an absolute pattern, and rejects bad pattern syntax at validate time.examples/pipelines/README.mddocuments the mapping and the S3 layout. There was no pipeline documentation at all. The examples follow it:fanout-fanin.jsongets relative patterns and distinct fan-in names, andml-training.json'sevaluatereads/models/0/best.h5.Tests (each watched failing against a revert that compiles)
TestS3KeyGeneration,TestMLTrainingExampleDataLandsWhereTheExampleReadsIt,TestFanoutExamplePatternsSelectTheirChunksTestS3KeyGeneration,TestMLTrainingExampleDataLandsWhereTheExampleReadsItTestUploadRefusesTwoFilesWithOneKeyTestDownloadRefusesTwoSourcesWritingOnePathfilepath.IsLocalcheckTestDownloadRefusesAKeyOutsideDestPathTestValidateRejectsAnAbsoluteInputPatternTestMLTrainingExampleDataLandsWhereTheExampleReadsItTestStageRunnerEndToEnd_OutputsAreKeyedByInstanceAndPatternDir(the real spored, instance 1 of 2)The two example tests load the real example files. They re-root the examples' absolute paths into a temp dir and run the real upload and download against the emulator, so they assert what the README says, not what the code happens to do.
make check: all pass except the known Docker-onlyTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker.make check-nested: clean.go test -count=1 ./lambda/pipeline-orchestrator/ ./pkg/pipeline/: pass. Use-count=1because the e2e tests build spored, and the test cache does not see spored's sources.Deploy
Stage instances download
sporedat boot, so this takes effect whensporedis released, through the normal release that publishes tospawn-binaries-*. The orchestrator Lambda is unaffected by this PR.Caveats
<dest_path>/data/processed/a.csv, the old accidental path, now finds<dest_path>/a.csv. A consumer of a multi-instance stage now gets<index>/directories. Both are what the examples always implied, and the CHANGELOG says so.