Summary
When the output-file cap is already full, findTruncatedArtifact() treats the first supported filename as an omitted artifact before applying the normal walk path-shape and file-size checks.
Impact
An oversized file or a supported file with an invalid/overlong path can be reported as artifact_truncation.reasons.max_files, even though an uncapped walk would classify it as size or path. Callers therefore receive the wrong truncation reason for an artifact that was never eligible for collection under the normal walk.
Relevant code
api/src/job.ts: findTruncatedArtifact() returns relativePath for supported files after suppression checks, without checkPathShape() or the runtime file-size check
walkDir() records that returned path as max_files when the output cap is full
- the ordinary file path applies filename filtering, path-shape validation, and size classification before collection
Suggested direction
Make the bounded probe apply the same eligibility/classification order as the ordinary walk while preserving its I/O budgets. Add tests where the cap is full and the next supported artifact is oversized or has an invalid path.
Summary
When the output-file cap is already full,
findTruncatedArtifact()treats the first supported filename as an omitted artifact before applying the normal walk path-shape and file-size checks.Impact
An oversized file or a supported file with an invalid/overlong path can be reported as
artifact_truncation.reasons.max_files, even though an uncapped walk would classify it assizeorpath. Callers therefore receive the wrong truncation reason for an artifact that was never eligible for collection under the normal walk.Relevant code
api/src/job.ts:findTruncatedArtifact()returnsrelativePathfor supported files after suppression checks, withoutcheckPathShape()or the runtime file-size checkwalkDir()records that returned path asmax_fileswhen the output cap is fullSuggested direction
Make the bounded probe apply the same eligibility/classification order as the ordinary walk while preserving its I/O budgets. Add tests where the cap is full and the next supported artifact is oversized or has an invalid path.