From a841dc464cf24d809a90eed54d6975f3d3a3aa23 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Nov 2026 09:06:56 +0000 Subject: [PATCH 1/2] feat: add typed working-storage diagnostics for tiled generation Tile spools, the spool workspace, and payload publication reported their failures as DecodeFailure, so a full disk, a refused workspace, or a process out of file handles looked like a source decoding problem. The diagnostics contract reserved dedicated codes for these conditions. - usdGeoCore: add SpoolWorkspaceFailed, SpoolWriteFailed, SpoolIncomplete, OpenFileBudgetExhausted, and PayloadCommitFailed, with IsWorkingStorageFailure and StoppedByWorkingStorageFailure. - usdPointCloudTiling: emit them from TileSpoolWriter, TileSpoolReader, and RemoveSpoolDirectory; detect EMFILE/ENFILE on spool open. - usdPointCloudAuthoring: emit them for workspace preparation, spool reopening, and payload Begin/Commit, including the layer-level overload. - Plugins: project a tiled read stopped by working storage onto LAS018, LAZ009, PLY008, and COPC013; other causes keep the existing codes. - Tests for missing, unfinalized, unwritable, and descriptor-exhausted spools, an unmarked spool workspace, payload conflicts, and the LAS plugin projection; contract, README, roadmap, and changelog updates. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JQZ6zAKFPpAYkZd9nBKCWu --- CHANGELOG.md | 13 ++ docs/architecture/DIAGNOSTICS.md | 63 +++++++-- docs/roadmap/implementation-status.md | 14 ++ libs/usd-geo-core/README.md | 13 +- libs/usd-geo-core/include/usdgeo/Diagnostic.h | 37 +++++ libs/usd-geo-core/tests/test_core.cpp | 30 ++++ libs/usd-pointcloud-authoring/README.md | 10 ++ .../src/PointCloudLayer.cpp | 13 +- .../src/PointCloudStreaming.cpp | 22 +-- .../tests/test_usd_authoring.cpp | 39 ++++++ libs/usd-pointcloud-tiling/README.md | 7 + libs/usd-pointcloud-tiling/src/Spool.cpp | 69 ++++++--- .../tests/test_tiling.cpp | 131 ++++++++++++++++++ plugins/pointcloud-copc/README.md | 5 + .../usdgeocopc/UsdGeoCopcDiagnostics.h | 4 + .../src/UsdGeoCopcFileFormat.cpp | 4 +- plugins/pointcloud-las/docs/DIAGNOSTICS.md | 3 +- .../include/usdgeolas/UsdGeoLasDiagnostics.h | 4 + .../src/UsdGeoLasFileFormat.cpp | 4 +- .../tests/test_pointcloud_las.cpp | 34 +++++ plugins/pointcloud-laz/docs/DIAGNOSTICS.md | 3 +- .../include/usdgeolaz/UsdGeoLazDiagnostics.h | 4 + .../src/UsdGeoLazFileFormat.cpp | 4 +- plugins/pointcloud-ply/README.md | 5 + .../include/usdgeoply/UsdGeoPlyDiagnostics.h | 4 + .../src/UsdGeoPlyFileFormat.cpp | 4 +- 26 files changed, 490 insertions(+), 53 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d7ab06..502c701 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,8 +20,21 @@ All notable changes to this project are documented here. exact file-format arguments. The layout is in the [file-format argument contract](docs/architecture/FILE_FORMAT_ARGUMENTS.md#generated-payload-ownership). +- Typed working-storage diagnostics: `usdgeo::DiagnosticCode` gains + `SpoolWorkspaceFailed`, `SpoolWriteFailed`, `SpoolIncomplete`, + `OpenFileBudgetExhausted`, and `PayloadCommitFailed`, with + `usdgeo::IsWorkingStorageFailure` and + `usdgeo::StoppedByWorkingStorageFailure`. Tiled reads stopped by their own + storage report the new plugin codes `LAS018`, `LAZ009`, `PLY008`, and + `COPC013`. + ### Changed +- Tile spools, the spool workspace, and payload publication report the + working-storage codes above instead of `DecodeFailure`, so a full disk, a + refused workspace, or a process out of file handles is no longer presented + as a source decoding problem. A tiled read stopped this way reports the new + plugin code rather than `LAS016`, `LAZ007`, `PLY007`, or `COPC007`. - Layer authoring builds content in an in-memory stage that loads nothing, and payload files are exported from in-memory layers. No authoring call renames a caller's layer or gives a scratch layer a file identity any more. diff --git a/docs/architecture/DIAGNOSTICS.md b/docs/architecture/DIAGNOSTICS.md index c614a9b..78f7547 100644 --- a/docs/architecture/DIAGNOSTICS.md +++ b/docs/architecture/DIAGNOSTICS.md @@ -41,6 +41,18 @@ Category names obey rule 1 below: a name is never reused for a different meaning. Decision messages are fixed constants owned by `usdgeo::cache`, so no transport specific and no token content can reach one. +Tiled reads report failures of their own working storage under one +additional fatal code per plugin, chosen when the first error is a +[working-storage code](#working-storage-codes); every other tiled authoring +failure keeps the plugin's existing "could not be authored" code: + +| Plugin | Working storage failed | Other tiled authoring failure | +| --- | --- | --- | +| `pointcloud-las` | `LAS018` | `LAS016` | +| `pointcloud-laz` | `LAZ009` | `LAZ007` | +| `pointcloud-ply` | `PLY008` | `PLY007` | +| `pointcloud-copc` | `COPC013` | `COPC007` | + Remaining limitations of the current migration: - The reader compatibility projection still classifies some legacy messages @@ -75,11 +87,24 @@ enum class DiagnosticCode { UnsupportedExtraBytesType, MissingWaveformData, NonFiniteCoordinate, - DecodeFailure, - UnknownFormatArgument, - UnsupportedFormatArgument, - InvalidFormatArgument, - ConflictingFormatArguments + NonFiniteExtraBytes, + DecodeFailure, + SourceOpenFailed, + SourceSizeUnavailable, + UnknownFormatArgument, + UnsupportedFormatArgument, + InvalidFormatArgument, + ConflictingFormatArguments, + InvalidPointTileId, + InvalidPointSourceRange, + InvalidLodItem, + InvalidLodHierarchy, + InvalidPointTile, + SpoolWorkspaceFailed, + SpoolWriteFailed, + SpoolIncomplete, + OpenFileBudgetExhausted, + PayloadCommitFailed, }; struct Diagnostic { @@ -138,12 +163,6 @@ Sampling and tile-generation failures follow the same rule: readers and generators collect diagnostics, and the authoring layer refuses to author a hierarchy that fails validation rather than emitting a partial LOD root. -The [streaming and tiling](../roadmap/streaming-and-tiling.md) work adds -conditions this taxonomy does not yet cover — spool write failures, incomplete -spool detection, exhausted open-file budgets, and payload commit failures. -Each gets a new `DiagnosticCode` value and a new plugin code when it ships; -none reuses an existing meaning. - `v0.10.0` adds resolver identity and generated-cache decisions to the same taxonomy: identity unavailable, unstable, stable, or changed, and cache reuse disabled, cache hit, or cache invalidated. These explain the decision without @@ -153,3 +172,25 @@ leaking transport specifics or validation-token contents, so a message such as source validation identity.` is. The contract is in [RESOLVER_SOURCE.md](RESOLVER_SOURCE.md); the code names follow rule 1 above and are not reserved in advance. + +## Working-storage codes + +The [streaming and tiling](../roadmap/streaming-and-tiling.md) work added +failure conditions that belong to the generator's own files rather than to the +source. They previously surfaced as `DecodeFailure`, which told a caller to +suspect the input when the disk, the workspace, or the process was at fault. +Each now has its own value; none reuses an existing meaning: + +| Code | Raised when | +| --- | --- | +| `SpoolWorkspaceFailed` | The tile-spool workspace cannot be determined, created, initialized, recovered, or removed, or an existing directory carries no spool marker and is refused rather than emptied. | +| `SpoolWriteFailed` | A tile spool cannot be created, or its header, records, flush, or footer cannot be written. | +| `SpoolIncomplete` | A tile spool is missing, truncated, structurally invalid, or lacks the footer that commits its point count. | +| `OpenFileBudgetExhausted` | Opening a tile spool fails because the process has no file handles left (`EMFILE` or `ENFILE`). | +| `PayloadCommitFailed` | A payload generation cannot be prepared, staged, or published into its payload directory. | + +`usdgeo::IsWorkingStorageFailure` classifies a code, and +`usdgeo::StoppedByWorkingStorageFailure` reports whether the first error in a +list is one; a plugin uses the latter to choose its working-storage code. +Open-file exhaustion is recognized from the C runtime's `errno` after a failed +open, which every supported platform sets. diff --git a/docs/roadmap/implementation-status.md b/docs/roadmap/implementation-status.md index c557ddb..1118430 100644 --- a/docs/roadmap/implementation-status.md +++ b/docs/roadmap/implementation-status.md @@ -434,6 +434,20 @@ remain be explicit. options select the workspace, marked leftovers are recovered on the next invocation, and conversion ties the workspace to its transaction marker. +#### Working-storage diagnostics + +The [diagnostics contract](../architecture/DIAGNOSTICS.md) reserved typed +codes for the spool and payload failures that tiled generation introduced. + +- [x] Report spool write failures, incomplete spool detection, exhausted + open-file budgets, spool workspace failures, and payload commit + failures through dedicated `usdgeo::DiagnosticCode` values instead of + `DecodeFailure` +- [x] Project them onto one new fatal code per plugin (`LAS018`, `LAZ009`, + `PLY008`, `COPC013`) when the first error of a tiled read is a + working-storage failure, keeping the existing authoring codes for every + other cause + #### Research - runtime streaming (no release gate) - [x] Add an opt-in COPC runtime-streaming probe that takes a requested node diff --git a/libs/usd-geo-core/README.md b/libs/usd-geo-core/README.md index c920e48..4020b62 100644 --- a/libs/usd-geo-core/README.md +++ b/libs/usd-geo-core/README.md @@ -41,7 +41,8 @@ usdgeo/SpatialBounds.h Vec3d, SpatialBounds usdgeo/GeoReference.h GeoReference and its coordinate transforms usdgeo/TileId.h TileId usdgeo/CacheKey.h CacheArguments, NormalizeCacheArguments, StableCacheKey -usdgeo/Diagnostic.h Severity, DiagnosticCode, Diagnostic +usdgeo/Diagnostic.h Severity, DiagnosticCode, Diagnostic, + IsWorkingStorageFailure, StoppedByWorkingStorageFailure usdgeo/RandomAccessSource.h RandomAccessSource, LocalRandomAccessSource ``` @@ -82,6 +83,14 @@ Fallible operations return `bool` and use out-parameters; source reads report typed `Diagnostic` values for invalid ranges, missing files, and short reads. Validity predicates are `noexcept` and total (`IsValid`, `IsFinite`). +Five codes describe the generator's own working storage rather than the +source: `SpoolWorkspaceFailed`, `SpoolWriteFailed`, `SpoolIncomplete`, +`OpenFileBudgetExhausted`, and `PayloadCommitFailed`. +`IsWorkingStorageFailure` classifies a code, and +`StoppedByWorkingStorageFailure` reports whether the first error in a +diagnostic list, the one that stopped the operation, is one of them. Their +meaning is in the [diagnostics contract](../../docs/architecture/DIAGNOSTICS.md#working-storage-codes). + ## Threading and ownership All types are plain values with automatic storage. There is no shared mutable @@ -126,8 +135,6 @@ bundle. See [BUILDING.md](../../docs/guides/BUILDING.md). ## Planned work -- Diagnostic codes for the spool and payload failures introduced by - [streaming and tiling](../../docs/roadmap/streaming-and-tiling.md). - Cache-key inputs for tiling configuration, once that configuration exists. - `usdGeoCache` builds on `StableCacheKey` for USDC cache identity, layout, lookup, and invalidation. Generation and manifest publication belong to its diff --git a/libs/usd-geo-core/include/usdgeo/Diagnostic.h b/libs/usd-geo-core/include/usdgeo/Diagnostic.h index 3260177..1a77e1d 100644 --- a/libs/usd-geo-core/include/usdgeo/Diagnostic.h +++ b/libs/usd-geo-core/include/usdgeo/Diagnostic.h @@ -3,6 +3,7 @@ #include #include #include +#include namespace usdgeo { @@ -37,8 +38,32 @@ enum class DiagnosticCode { InvalidLodItem, InvalidLodHierarchy, InvalidPointTile, + // Tiled working storage. These describe the generator's own files rather + // than the source, so a caller can tell a full disk, a refused workspace, + // or a process out of file handles apart from bad input. + SpoolWorkspaceFailed, + SpoolWriteFailed, + SpoolIncomplete, + OpenFileBudgetExhausted, + PayloadCommitFailed, }; +// True for the codes that report a failure of the generator's own working +// storage (tile spools, their workspace, or payload publication) rather than +// a problem with the source or the request. +constexpr bool IsWorkingStorageFailure(DiagnosticCode code) noexcept { + switch (code) { + case DiagnosticCode::SpoolWorkspaceFailed: + case DiagnosticCode::SpoolWriteFailed: + case DiagnosticCode::SpoolIncomplete: + case DiagnosticCode::OpenFileBudgetExhausted: + case DiagnosticCode::PayloadCommitFailed: + return true; + default: + return false; + } +} + struct Diagnostic { DiagnosticCode code = DiagnosticCode::DecodeFailure; Severity severity = Severity::Error; @@ -47,4 +72,16 @@ struct Diagnostic { std::optional pointIndex; }; +// True when the first error, the one that stopped the operation, is a working +// storage failure. Later entries only add context to that first error. +inline bool StoppedByWorkingStorageFailure( + const std::vector& diagnostics) noexcept { + for (const auto& diagnostic : diagnostics) { + if (diagnostic.severity == Severity::Error) { + return IsWorkingStorageFailure(diagnostic.code); + } + } + return false; +} + } // namespace usdgeo \ No newline at end of file diff --git a/libs/usd-geo-core/tests/test_core.cpp b/libs/usd-geo-core/tests/test_core.cpp index 7666c78..bf3573d 100644 --- a/libs/usd-geo-core/tests/test_core.cpp +++ b/libs/usd-geo-core/tests/test_core.cpp @@ -145,6 +145,35 @@ void TestDiagnostics() { Check(pointError.pointIndex.has_value() && pointError.pointIndex.value() == 42); } +void TestWorkingStorageDiagnostics() { + using usdgeo::DiagnosticCode; + for (const auto code : {DiagnosticCode::SpoolWorkspaceFailed, + DiagnosticCode::SpoolWriteFailed, + DiagnosticCode::SpoolIncomplete, + DiagnosticCode::OpenFileBudgetExhausted, + DiagnosticCode::PayloadCommitFailed}) { + Check(usdgeo::IsWorkingStorageFailure(code)); + } + for (const auto code : {DiagnosticCode::DecodeFailure, + DiagnosticCode::SourceOpenFailed, + DiagnosticCode::InvalidPointTile, + DiagnosticCode::TruncatedRecord}) { + Check(!usdgeo::IsWorkingStorageFailure(code)); + } + + // The first error decides; warnings before it and context after it do not. + const usdgeo::Diagnostic warning{DiagnosticCode::SpoolWriteFailed, + usdgeo::Severity::Warning, "w"}; + const usdgeo::Diagnostic storage{DiagnosticCode::SpoolIncomplete, + usdgeo::Severity::Error, "spool"}; + const usdgeo::Diagnostic decode{DiagnosticCode::DecodeFailure, + usdgeo::Severity::Error, "decode"}; + Check(!usdgeo::StoppedByWorkingStorageFailure({})); + Check(usdgeo::StoppedByWorkingStorageFailure({warning, storage, decode})); + Check(!usdgeo::StoppedByWorkingStorageFailure({warning, decode, storage})); + Check(!usdgeo::StoppedByWorkingStorageFailure({warning})); +} + } // namespace int main() { @@ -152,5 +181,6 @@ int main() { TestGeoReference(); TestTileAndCacheKeys(); TestDiagnostics(); + TestWorkingStorageDiagnostics(); return 0; } diff --git a/libs/usd-pointcloud-authoring/README.md b/libs/usd-pointcloud-authoring/README.md index b3f3efc..478d2fd 100644 --- a/libs/usd-pointcloud-authoring/README.md +++ b/libs/usd-pointcloud-authoring/README.md @@ -123,6 +123,16 @@ authored, so a failed call does not leave a partially populated prim or a LOD root with missing children. OpenUSD's own diagnostics (`TF_RUNTIME_ERROR`) are emitted by the calling bundle, not here. +Tiled authoring reports failures of its own working storage with dedicated +codes, so a bundle can tell a full disk or a refused workspace from bad input: +`SpoolWorkspaceFailed` when the spool workspace cannot be determined, created, +recovered, or removed (including a directory that carries no spool marker and +is therefore refused rather than emptied), `SpoolWriteFailed`, +`SpoolIncomplete`, and `OpenFileBudgetExhausted` from the tile spools, and +`PayloadCommitFailed` when a payload generation cannot be prepared, staged, or +published. The first error is the cause; later entries add context. +`usdgeo::StoppedByWorkingStorageFailure` tests for this case. + ## Threading and ownership Authoring functions take an `SdfLayer*` or `UsdStageRefPtr` owned by the diff --git a/libs/usd-pointcloud-authoring/src/PointCloudLayer.cpp b/libs/usd-pointcloud-authoring/src/PointCloudLayer.cpp index 092bea0..4c97dd0 100644 --- a/libs/usd-pointcloud-authoring/src/PointCloudLayer.cpp +++ b/libs/usd-pointcloud-authoring/src/PointCloudLayer.cpp @@ -1039,9 +1039,11 @@ bool AuthorGeneratedTilePayloads( const std::vector& tiles, const PointCloudPayloadOptions& options, std::vector& generatedPayloads, + DiagnosticCode& code, std::string& error) { if (!stage || !IsValidPrimPath(primPath) || tiles.empty() || options.directory.empty() || options.rootLayerPath.empty()) { + code = DiagnosticCode::InvalidPointTile; error = "invalid tiled point-cloud payload request"; return false; } @@ -1049,15 +1051,18 @@ bool AuthorGeneratedTilePayloads( detail::PayloadGeneration payloads(options.directory, options.owner); std::vector manifestEntries; if (!payloads.Begin(names, error)) { + code = DiagnosticCode::PayloadCommitFailed; return false; } if (!detail::AuthorClaimedTilePayloads(stage, primPath, tiles, options, payloads, manifestEntries)) { + code = DiagnosticCode::DecodeFailure; error = "unable to author tiled point-cloud payloads"; return false; } if (!detail::CommitTilePayloads(stage->GetRootLayer(), payloads, manifestEntries, error)) { + code = DiagnosticCode::PayloadCommitFailed; return false; } for (const auto& name : names) { @@ -1079,9 +1084,10 @@ bool AuthorPointCloudTiledAssetWithPayloads( const std::vector& tiles, const PointCloudPayloadOptions& options, std::vector& generatedPayloads) { + DiagnosticCode code = DiagnosticCode::DecodeFailure; std::string error; return AuthorGeneratedTilePayloads(stage, primPath, tiles, options, - generatedPayloads, error); + generatedPayloads, code, error); } bool AuthorPointCloudTiledAssetWithPayloads( @@ -1111,10 +1117,11 @@ bool AuthorPointCloudTiledAssetWithPayloads( "unable to create tiled point-cloud stage"); } std::vector generatedPayloads; + DiagnosticCode code = DiagnosticCode::DecodeFailure; std::string error; if (!AuthorGeneratedTilePayloads(stage, primPath, tiles, options, - generatedPayloads, error)) { - return fail(DiagnosticCode::DecodeFailure, error); + generatedPayloads, code, error)) { + return fail(code, error); } layer->TransferContent(stage->GetRootLayer()); return true; diff --git a/libs/usd-pointcloud-authoring/src/PointCloudStreaming.cpp b/libs/usd-pointcloud-authoring/src/PointCloudStreaming.cpp index 8107a0d..5134701 100644 --- a/libs/usd-pointcloud-authoring/src/PointCloudStreaming.cpp +++ b/libs/usd-pointcloud-authoring/src/PointCloudStreaming.cpp @@ -221,14 +221,14 @@ std::filesystem::path MakeSpoolDirectory( directory /= usdgeo::StableCacheKey({{"payloadOwner", options.owner}}); } if (directory.empty()) { - AddError(diagnostics, DiagnosticCode::DecodeFailure, + AddError(diagnostics, DiagnosticCode::SpoolWorkspaceFailed, "unable to determine point spool directory"); return {}; } std::error_code error; if (std::filesystem::exists(directory, error)) { if (error || !std::filesystem::is_directory(directory, error)) { - AddError(diagnostics, DiagnosticCode::DecodeFailure, + AddError(diagnostics, DiagnosticCode::SpoolWorkspaceFailed, "point spool directory is not a directory"); return {}; } @@ -244,27 +244,27 @@ std::filesystem::path MakeSpoolDirectory( markerValue == kSpoolMarker; markerFile.close(); if (!markerIsValid) { - AddError(diagnostics, DiagnosticCode::DecodeFailure, + AddError(diagnostics, DiagnosticCode::SpoolWorkspaceFailed, "point spool directory is not recoverable"); return {}; } std::filesystem::remove_all(directory, error); if (error) { - AddError(diagnostics, DiagnosticCode::DecodeFailure, + AddError(diagnostics, DiagnosticCode::SpoolWorkspaceFailed, "unable to recover point spool directory"); return {}; } } std::filesystem::create_directories(directory, error); if (error) { - AddError(diagnostics, DiagnosticCode::DecodeFailure, + AddError(diagnostics, DiagnosticCode::SpoolWorkspaceFailed, "unable to create point spool directory"); return {}; } std::ofstream marker(directory / ".usdgeo-spool", std::ios::binary); if (!marker || !(marker << kSpoolMarker << '\n')) { std::filesystem::remove_all(directory, error); - AddError(diagnostics, DiagnosticCode::DecodeFailure, + AddError(diagnostics, DiagnosticCode::SpoolWorkspaceFailed, "unable to initialize point spool directory"); return {}; } @@ -300,7 +300,7 @@ bool AuthorPointCloudTiledAssetFromStream( const auto payloadDirectoryExisted = std::filesystem::exists( std::filesystem::path(options.directory), payloadDirectoryError); if (payloadDirectoryError) { - AddError(diagnostics, DiagnosticCode::DecodeFailure, + AddError(diagnostics, DiagnosticCode::PayloadCommitFailed, "unable to inspect point payload directory"); return false; } @@ -479,7 +479,7 @@ bool AuthorPointCloudTiledAssetFromStream( } std::string payloadError; if (!payloads.Begin(payloadNames, payloadError)) { - AddError(diagnostics, DiagnosticCode::DecodeFailure, payloadError); + AddError(diagnostics, DiagnosticCode::PayloadCommitFailed, payloadError); cleanup(); return false; } @@ -513,7 +513,7 @@ bool AuthorPointCloudTiledAssetFromStream( options.spoolIoStats) || tileId.ToString() != entry.first || !SameSchema(schema, tileSchema)) { - AddError(diagnostics, DiagnosticCode::DecodeFailure, + AddError(diagnostics, DiagnosticCode::SpoolIncomplete, "unable to reopen point tile spool"); return failTile(); } @@ -544,7 +544,7 @@ bool AuthorPointCloudTiledAssetFromStream( } } if (!reader.IsComplete() || data.positions.empty()) { - AddError(diagnostics, DiagnosticCode::DecodeFailure, + AddError(diagnostics, DiagnosticCode::SpoolIncomplete, "point tile spool is incomplete or empty"); return failTile(); } @@ -591,7 +591,7 @@ bool AuthorPointCloudTiledAssetFromStream( } if (!detail::CommitTilePayloads(stage->GetRootLayer(), payloads, manifestEntries, payloadError)) { - AddError(diagnostics, DiagnosticCode::DecodeFailure, payloadError); + AddError(diagnostics, DiagnosticCode::PayloadCommitFailed, payloadError); cleanup(); return false; } diff --git a/libs/usd-pointcloud-authoring/tests/test_usd_authoring.cpp b/libs/usd-pointcloud-authoring/tests/test_usd_authoring.cpp index ba004d5..14e139b 100644 --- a/libs/usd-pointcloud-authoring/tests/test_usd_authoring.cpp +++ b/libs/usd-pointcloud-authoring/tests/test_usd_authoring.cpp @@ -1220,6 +1220,9 @@ void TestStreamPayloadFailureRollsBackGeneratedPayloads() { {payloadDirectory.string(), (payloadDirectory / "PointCloud.usda").string(), 1}, diagnostics)); Check(!diagnostics.empty()); + Check(diagnostics.front().code == + usdgeo::DiagnosticCode::PayloadCommitFailed); + Check(usdgeo::StoppedByWorkingStorageFailure(diagnostics)); Check(layer->GetPrimAtPath(pxr::SdfPath("/PointCloud")) == nullptr); Check(!std::filesystem::exists(firstPayload)); Check(std::filesystem::exists(conflictingPayload)); @@ -1254,6 +1257,41 @@ bool AuthorOwnedStream(pxr::SdfLayer* layer, diagnostics); } +void TestUnmarkedSpoolWorkspaceIsRefused() { + // A spool directory that this library did not create may hold someone + // else's files. Authoring must refuse it as a workspace failure, not + // recover it by deleting its contents. + const auto layer = pxr::SdfLayer::CreateAnonymous("unmarked_spool.usda"); + usdgeo::GeoReference reference; + reference.epsgCode = 26910; + TestPointStream stream({MakeTestChunk({{0.25, 0.0, 0.0}})}); + const auto payloadDirectory = + std::filesystem::temp_directory_path() / "usd_geo_unmarked_spool"; + const auto spoolDirectory = payloadDirectory / "not-a-spool"; + const auto userFile = spoolDirectory / "keep.txt"; + std::filesystem::remove_all(payloadDirectory); + std::filesystem::create_directories(spoolDirectory); + { + std::ofstream keep(userFile, std::ios::binary); + keep << "user data"; + } + std::vector diagnostics; + usdgeo::PointCloudPayloadOptions options{ + payloadDirectory.string(), + (payloadDirectory / "PointCloud.usda").string(), 1}; + options.spoolDirectory = spoolDirectory.string(); + Check(!usdgeo::AuthorPointCloudTiledAssetFromStream( + layer.operator->(), "/PointCloud", stream, reference, {1.0, 0}, + options, diagnostics)); + Check(diagnostics.size() == 1); + Check(diagnostics.front().code == + usdgeo::DiagnosticCode::SpoolWorkspaceFailed); + Check(usdgeo::StoppedByWorkingStorageFailure(diagnostics)); + Check(layer->GetPrimAtPath(pxr::SdfPath("/PointCloud")) == nullptr); + Check(std::filesystem::exists(userFile)); + std::filesystem::remove_all(payloadDirectory); +} + void TestOwnedPayloadsLiveInTheirOwnersGeneration() { const auto directory = UniqueTestDirectory("usd_geo_owned_payloads"); const auto ownerDirectory = OwnerDirectory(directory, "layer-a"); @@ -1545,6 +1583,7 @@ int main() { TestStreamCancellationDuringSpoolReadCleansSpools(); TestStreamFailureDoesNotMutateLayer(); TestStreamPayloadFailureRollsBackGeneratedPayloads(); + TestUnmarkedSpoolWorkspaceIsRefused(); TestOwnedPayloadsLiveInTheirOwnersGeneration(); TestInterruptedOwnedGenerationIsRecovered(); TestFailedOwnedGenerationKeepsPublishedPayloads(); diff --git a/libs/usd-pointcloud-tiling/README.md b/libs/usd-pointcloud-tiling/README.md index 4aaa835..54110a4 100644 --- a/libs/usd-pointcloud-tiling/README.md +++ b/libs/usd-pointcloud-tiling/README.md @@ -43,6 +43,13 @@ owner-scoped `.spool` directory, marks it before writing, and removes a marked leftover before the next run so an interrupted process can be recovered without scanning the system temporary directory. +Spool failures carry working-storage codes rather than `DecodeFailure`: a +spool that cannot be created, written, flushed, or finalized reports +`SpoolWriteFailed`; one that is missing, truncated, or lacks its committed +footer reports `SpoolIncomplete`; an open refused because the process has no +file handles left (`EMFILE` / `ENFILE`) reports `OpenFileBudgetExhausted`; and +a working directory that cannot be removed reports `SpoolWorkspaceFailed`. + `PointTileManifest` records the tile ID, LOD level, source bounds, point count, and portable payload path for generated tile assets. Its v1 serializer sorts entries by tile ID and LOD, rejects duplicate entries and unsafe paths, and diff --git a/libs/usd-pointcloud-tiling/src/Spool.cpp b/libs/usd-pointcloud-tiling/src/Spool.cpp index b8c4a96..48ce9e6 100644 --- a/libs/usd-pointcloud-tiling/src/Spool.cpp +++ b/libs/usd-pointcloud-tiling/src/Spool.cpp @@ -1,5 +1,6 @@ #include "usdpointcloud/Spool.h" +#include #include #include #include @@ -28,10 +29,20 @@ constexpr std::streamoff kFooterSize = void Error(std::vector& diagnostics, usdgeo::DiagnosticCode code, - const char* message) { + const std::string& message) { diagnostics.push_back({code, usdgeo::Severity::Error, message}); } +// The code for a spool file that could not be opened. The standard streams +// report no reason, but the C runtime beneath them sets errno, which is the +// only portable way to tell a process out of file handles from any other +// open failure. Call ClearOpenError() immediately before opening. +void ClearOpenError() noexcept { errno = 0; } + +bool OpenFileBudgetExhausted() noexcept { + return errno == EMFILE || errno == ENFILE; +} + template bool Write(std::ofstream& stream, const T& value) { stream.write(reinterpret_cast(&value), sizeof(value)); @@ -245,10 +256,17 @@ bool TileSpoolWriter::Open(const std::filesystem::path& path, EnsureSpoolFileDescriptorBudget(); #endif impl_ = std::make_unique(); + ClearOpenError(); impl_->stream.open(path, std::ios::binary | std::ios::trunc); if (!impl_->stream) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, - ("unable to create tile spool: " + path.string()).c_str()); + if (OpenFileBudgetExhausted()) { + Error(diagnostics, usdgeo::DiagnosticCode::OpenFileBudgetExhausted, + "unable to create tile spool, the process has no file " + "handles left: " + path.string()); + } else { + Error(diagnostics, usdgeo::DiagnosticCode::SpoolWriteFailed, + "unable to create tile spool: " + path.string()); + } impl_.reset(); return false; } @@ -263,14 +281,14 @@ bool TileSpoolWriter::Open(const std::filesystem::path& path, if (!Write(impl_->stream, version) || !Write(impl_->stream, coordinateSpace) || !Write(impl_->stream, tile.level) || !Write(impl_->stream, tile.x) || !Write(impl_->stream, tile.y) || !Write(impl_->stream, attributeCount)) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolWriteFailed, "unable to write tile spool header"); return false; } for (const auto& attribute : schema.attributes) { const auto type = static_cast(attribute.type); if (!WriteString(impl_->stream, attribute.name) || !Write(impl_->stream, type)) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolWriteFailed, "unable to write tile spool schema"); return false; } @@ -313,7 +331,7 @@ bool TileSpoolWriter::Append(const SpoolPoint& point, bool TileSpoolWriter::Flush(std::vector& diagnostics) { if (!impl_ || !impl_->open) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolWriteFailed, "unable to flush tile spool"); return false; } @@ -323,14 +341,14 @@ bool TileSpoolWriter::Flush(std::vector& diagnostics) { sizeof(point.sourcePosition)) || !impl_->stream.write(reinterpret_cast(&point.stagePosition), sizeof(point.stagePosition))) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolWriteFailed, "unable to write tile spool point"); return false; } for (std::size_t index = 0; index < point.attributes.size(); ++index) { if (!WriteAttribute(impl_->stream, impl_->schema.attributes[index].type, point.attributes[index])) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolWriteFailed, "unable to write tile spool attribute"); return false; } @@ -340,7 +358,7 @@ bool TileSpoolWriter::Flush(std::vector& diagnostics) { std::vector().swap(impl_->points); impl_->buffered = 0; if (!impl_->stream.flush()) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolWriteFailed, "unable to flush tile spool"); return false; } @@ -364,7 +382,7 @@ bool TileSpoolWriter::Close(std::vector& diagnostics) { const auto start = impl_->stream.tellp(); if (!impl_->stream.write(kFooter, sizeof(kFooter) - 1) || !Write(impl_->stream, impl_->pointCount) || !impl_->stream.flush()) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolWriteFailed, "unable to finalize tile spool"); return false; } @@ -401,7 +419,20 @@ bool TileSpoolReader::Open(const std::filesystem::path& path, std::vector& diagnostics, SpoolIoStats* ioStats) { impl_ = std::make_unique(); + ClearOpenError(); impl_->stream.open(path, std::ios::binary); + if (!impl_->stream) { + if (OpenFileBudgetExhausted()) { + Error(diagnostics, usdgeo::DiagnosticCode::OpenFileBudgetExhausted, + "unable to open tile spool, the process has no file " + "handles left: " + path.string()); + } else { + Error(diagnostics, usdgeo::DiagnosticCode::SpoolIncomplete, + "unable to open tile spool: " + path.string()); + } + impl_.reset(); + return false; + } char header[sizeof(kHeader) - 1] = {}; std::uint8_t coordinateSpace = 0; std::uint32_t attributeCount = 0; @@ -411,7 +442,7 @@ bool TileSpoolReader::Open(const std::filesystem::path& path, !Read(impl_->stream, tile.level) || !Read(impl_->stream, tile.x) || !Read(impl_->stream, tile.y) || !Read(impl_->stream, attributeCount) || attributeCount > 100000) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolIncomplete, "invalid or truncated tile spool header"); return false; } @@ -422,7 +453,7 @@ bool TileSpoolReader::Open(const std::filesystem::path& path, PointAttribute attribute; std::uint8_t type = 0; if (!ReadString(impl_->stream, attribute.name) || !Read(impl_->stream, type)) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolIncomplete, "invalid or truncated tile spool schema"); return false; } @@ -446,13 +477,13 @@ bool TileSpoolReader::Open(const std::filesystem::path& path, fileEnd - dataStart < kFooterSize || (fileEnd - dataStart - kFooterSize) % static_cast(impl_->recordSize) != 0) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolIncomplete, "invalid tile spool record layout"); return false; } impl_->dataEnd = fileEnd - kFooterSize; if (impl_->dataEnd < dataStart) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolIncomplete, "invalid tile spool footer layout"); return false; } @@ -471,7 +502,7 @@ bool TileSpoolReader::ReadNext(SpoolPoint& point, } const auto position = impl_->stream.tellg(); if (position < 0 || position > impl_->dataEnd) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolIncomplete, "incomplete tile spool"); return false; } @@ -482,7 +513,7 @@ bool TileSpoolReader::ReadNext(SpoolPoint& point, if (!impl_->stream.read(footer, sizeof(footer)) || std::memcmp(footer, kFooter, sizeof(footer)) != 0 || !Read(impl_->stream, count) || count != impl_->pointsRead) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolIncomplete, "incomplete tile spool"); return false; } @@ -501,7 +532,7 @@ bool TileSpoolReader::ReadNext(SpoolPoint& point, !impl_->stream.read(reinterpret_cast(&point.sourcePosition), sizeof(point.sourcePosition)) || !impl_->stream.read(reinterpret_cast(&point.stagePosition), sizeof(point.stagePosition))) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolIncomplete, "truncated tile spool point"); return false; } @@ -509,7 +540,7 @@ bool TileSpoolReader::ReadNext(SpoolPoint& point, for (std::size_t index = 0; index < point.attributes.size(); ++index) { if (!ReadAttribute(impl_->stream, impl_->schema.attributes[index].type, point.attributes[index])) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolIncomplete, "truncated tile spool point"); return false; } @@ -534,7 +565,7 @@ bool RemoveSpoolDirectory(const std::filesystem::path& directory, std::error_code error; std::filesystem::remove_all(directory, error); if (error) { - Error(diagnostics, usdgeo::DiagnosticCode::DecodeFailure, + Error(diagnostics, usdgeo::DiagnosticCode::SpoolWorkspaceFailed, "unable to remove tile spool directory"); return false; } diff --git a/libs/usd-pointcloud-tiling/tests/test_tiling.cpp b/libs/usd-pointcloud-tiling/tests/test_tiling.cpp index 9840a61..e91f55b 100644 --- a/libs/usd-pointcloud-tiling/tests/test_tiling.cpp +++ b/libs/usd-pointcloud-tiling/tests/test_tiling.cpp @@ -9,6 +9,10 @@ #include #include +#if defined(__unix__) || defined(__APPLE__) +#include +#endif + namespace { void Check(bool condition) { @@ -356,10 +360,133 @@ void TestIncompleteSpool() { std::vector diagnostics; Check(!reader.Open(path, tile, schema, diagnostics)); Check(!diagnostics.empty()); + Check(diagnostics.front().code == + usdgeo::DiagnosticCode::SpoolIncomplete); + Check(usdgeo::StoppedByWorkingStorageFailure(diagnostics)); } std::filesystem::remove(path); } +usdpointcloud::SpoolSchema TestSpoolSchema() { + usdpointcloud::SpoolSchema schema; + schema.attributes.push_back( + {"intensity", usdpointcloud::PointAttributeType::UInt16}); + return schema; +} + +usdpointcloud::SpoolPoint TestSpoolPoint(double x) { + return {{x, 0.0, 0.0}, {x, 0.0, 0.0}, {std::uint16_t{7}}}; +} + +void TestMissingSpoolIsIncomplete() { + const auto path = + std::filesystem::temp_directory_path() / "usdgeo-missing-spool.bin"; + std::filesystem::remove(path); + usdpointcloud::TileSpoolReader reader; + usdpointcloud::PointTileId tile; + usdpointcloud::SpoolSchema schema; + std::vector diagnostics; + Check(!reader.Open(path, tile, schema, diagnostics)); + Check(diagnostics.size() == 1); + Check(diagnostics.front().code == usdgeo::DiagnosticCode::SpoolIncomplete); + usdpointcloud::SpoolPoint point; + Check(!reader.ReadNext(point, diagnostics)); + Check(!reader.IsComplete()); +} + +void TestUnfinalizedSpoolIsIncomplete() { + // Points are flushed but the writer never closes, as when a generator is + // killed: the reader must refuse the spool rather than report its points + // as the whole tile. + const auto path = std::filesystem::temp_directory_path() / + "usdgeo-unfinalized-spool.bin"; + const usdpointcloud::PointTileId tile{0, 1, 2, 0}; + std::vector diagnostics; + { + usdpointcloud::TileSpoolWriter writer; + Check(writer.Open(path, tile, TestSpoolSchema(), 1, diagnostics)); + Check(writer.Append(TestSpoolPoint(1.0), diagnostics)); + Check(writer.Append(TestSpoolPoint(2.0), diagnostics)); + Check(writer.Flush(diagnostics)); + Check(diagnostics.empty()); + } + usdpointcloud::TileSpoolReader reader; + usdpointcloud::PointTileId readTile; + usdpointcloud::SpoolSchema readSchema; + if (reader.Open(path, readTile, readSchema, diagnostics)) { + usdpointcloud::SpoolPoint point; + while (reader.ReadNext(point, diagnostics)) { + } + } + Check(!reader.IsComplete()); + Check(!diagnostics.empty()); + Check(diagnostics.front().code == usdgeo::DiagnosticCode::SpoolIncomplete); + reader.Close(); + std::filesystem::remove(path); +} + +void TestUnwritableSpoolReportsWriteFailure() { + const auto directory = std::filesystem::temp_directory_path() / + "usdgeo-missing-spool-directory"; + std::filesystem::remove_all(directory); + usdpointcloud::TileSpoolWriter writer; + std::vector diagnostics; + Check(!writer.Open(directory / "tile_0.bin", {0, 0, 0, 0}, + TestSpoolSchema(), 1, diagnostics)); + Check(diagnostics.size() == 1); + Check(diagnostics.front().code == usdgeo::DiagnosticCode::SpoolWriteFailed); + Check(usdgeo::StoppedByWorkingStorageFailure(diagnostics)); + Check(!std::filesystem::exists(directory)); +} + +void TestExhaustedOpenFileBudgetIsReported() { +#if defined(__unix__) || defined(__APPLE__) + // Lower the soft descriptor limit below every descriptor already open, so + // the next open fails exactly as it would in a generator holding one + // spool per tile, then restore it. + const auto directory = std::filesystem::temp_directory_path(); + const auto writePath = directory / "usdgeo-budget-spool-write.bin"; + const auto readPath = directory / "usdgeo-budget-spool-read.bin"; + std::vector diagnostics; + { + usdpointcloud::TileSpoolWriter writer; + Check(writer.Open(readPath, {0, 0, 0, 0}, TestSpoolSchema(), 1, + diagnostics)); + Check(writer.Append(TestSpoolPoint(1.0), diagnostics)); + Check(writer.Close(diagnostics)); + } + rlimit original{}; + Check(getrlimit(RLIMIT_NOFILE, &original) == 0); + rlimit exhausted = original; + exhausted.rlim_cur = 0; + Check(setrlimit(RLIMIT_NOFILE, &exhausted) == 0); + usdpointcloud::TileSpoolWriter writer; + std::vector writeDiagnostics; + const auto writeOpened = writer.Open(writePath, {0, 0, 0, 0}, + TestSpoolSchema(), 1, + writeDiagnostics); + usdpointcloud::TileSpoolReader reader; + usdpointcloud::PointTileId tile; + usdpointcloud::SpoolSchema schema; + std::vector readDiagnostics; + const auto readOpened = + reader.Open(readPath, tile, schema, readDiagnostics); + Check(setrlimit(RLIMIT_NOFILE, &original) == 0); + + Check(!writeOpened); + Check(writeDiagnostics.size() == 1); + Check(writeDiagnostics.front().code == + usdgeo::DiagnosticCode::OpenFileBudgetExhausted); + Check(!readOpened); + Check(readDiagnostics.size() == 1); + Check(readDiagnostics.front().code == + usdgeo::DiagnosticCode::OpenFileBudgetExhausted); + Check(usdgeo::StoppedByWorkingStorageFailure(readDiagnostics)); + std::filesystem::remove(writePath); + std::filesystem::remove(readPath); +#endif +} + } // namespace int main() { @@ -369,6 +496,10 @@ int main() { TestInvalidRouting(); TestSpoolRoundTrip(); TestIncompleteSpool(); + TestMissingSpoolIsIncomplete(); + TestUnfinalizedSpoolIsIncomplete(); + TestUnwritableSpoolReportsWriteFailure(); + TestExhaustedOpenFileBudgetIsReported(); TestPointBudgetStreamPlanning(); TestPointBudgetPlanningMatchesVectorForUnevenDistribution(); TestPointBudgetDepthLimit(); diff --git a/plugins/pointcloud-copc/README.md b/plugins/pointcloud-copc/README.md index a6645e2..6d10968 100644 --- a/plugins/pointcloud-copc/README.md +++ b/plugins/pointcloud-copc/README.md @@ -49,5 +49,10 @@ categories `usdgeo::cache` publishes, each message naming its exact category: | `COPC011` | status | `resolver-identity-changed` | | `COPC012` | warning | `generated-cache-invalidated` | +A tiled read that cannot author reports `COPC007` with the reason, or +`COPC013` when the read was stopped by its own working storage (payload +staging or publication) rather than by the source. See the +[diagnostics contract](../../docs/architecture/DIAGNOSTICS.md#working-storage-codes). + Interoperability with an external resolver is recorded in the [resolver read baseline](../../docs/reference/RESOLVER_BASELINE.md). diff --git a/plugins/pointcloud-copc/include/usdgeocopc/UsdGeoCopcDiagnostics.h b/plugins/pointcloud-copc/include/usdgeocopc/UsdGeoCopcDiagnostics.h index d10ba20..db12903 100644 --- a/plugins/pointcloud-copc/include/usdgeocopc/UsdGeoCopcDiagnostics.h +++ b/plugins/pointcloud-copc/include/usdgeocopc/UsdGeoCopcDiagnostics.h @@ -29,6 +29,10 @@ inline constexpr const char* ResolverCacheReuseDisabled = "COPC009"; inline constexpr const char* ResolverCacheReusePermitted = "COPC010"; inline constexpr const char* ResolverIdentityChanged = "COPC011"; inline constexpr const char* ResolverCacheInvalidated = "COPC012"; +// A tiled read stopped by its own working storage (tile spools, their +// workspace, the process file-handle budget, or payload publication) rather +// than by the source; see usdgeo::IsWorkingStorageFailure. +inline constexpr const char* TiledStorageFailed = "COPC013"; inline std::string Message(const char* code, const std::string& message) { return "[" + std::string(code) + "] " + message; diff --git a/plugins/pointcloud-copc/src/UsdGeoCopcFileFormat.cpp b/plugins/pointcloud-copc/src/UsdGeoCopcFileFormat.cpp index 887307b..a9dd8d7 100644 --- a/plugins/pointcloud-copc/src/UsdGeoCopcFileFormat.cpp +++ b/plugins/pointcloud-copc/src/UsdGeoCopcFileFormat.cpp @@ -594,7 +594,9 @@ bool UsdGeoCopcFileFormat::Read(SdfLayer* layer, if (!usdgeo::AuthorPointCloudTiledAssetWithPayloads( layer, "/PointCloud", tiles, payloadOptions, diagnostics)) { TF_RUNTIME_ERROR("%s", usdgeocopc::diagnostics::Message( - usdgeocopc::diagnostics::PointCloudAuthorFailed, + usdgeo::StoppedByWorkingStorageFailure(diagnostics) + ? usdgeocopc::diagnostics::TiledStorageFailed + : usdgeocopc::diagnostics::PointCloudAuthorFailed, "Unable to author tiled COPC point cloud: " + DiagnosticDetail( diagnostics, diff --git a/plugins/pointcloud-las/docs/DIAGNOSTICS.md b/plugins/pointcloud-las/docs/DIAGNOSTICS.md index 7316a3f..357d173 100644 --- a/plugins/pointcloud-las/docs/DIAGNOSTICS.md +++ b/plugins/pointcloud-las/docs/DIAGNOSTICS.md @@ -29,4 +29,5 @@ user-visible contract; see the | LAS014 | FATAL | import | USD layer could not be created | | LAS015 | FATAL | import | USD stage metrics could not be set | | LAS016 | FATAL | import | LAS point cloud could not be authored | -| LAS017 | FATAL | import | LAS file-format arguments are invalid or unsupported | \ No newline at end of file +| LAS017 | FATAL | import | LAS file-format arguments are invalid or unsupported | +| LAS018 | FATAL | import | Tiled LAS read stopped by its own working storage (tile spool, spool workspace, file-handle budget, or payload publication) | diff --git a/plugins/pointcloud-las/include/usdgeolas/UsdGeoLasDiagnostics.h b/plugins/pointcloud-las/include/usdgeolas/UsdGeoLasDiagnostics.h index 3e3b9b7..aa3ca70 100644 --- a/plugins/pointcloud-las/include/usdgeolas/UsdGeoLasDiagnostics.h +++ b/plugins/pointcloud-las/include/usdgeolas/UsdGeoLasDiagnostics.h @@ -21,6 +21,10 @@ inline constexpr const char* UsdLayerCreateFailed = "LAS014"; inline constexpr const char* StageMetricsFailed = "LAS015"; inline constexpr const char* PointCloudAuthorFailed = "LAS016"; inline constexpr const char* FormatArgumentInvalid = "LAS017"; +// A tiled read stopped by its own working storage (tile spools, their +// workspace, the process file-handle budget, or payload publication) rather +// than by the source; see usdgeo::IsWorkingStorageFailure. +inline constexpr const char* TiledStorageFailed = "LAS018"; inline std::string Message(const char* code, const std::string& message) { return "[" + std::string(code) + "] " + message; diff --git a/plugins/pointcloud-las/src/UsdGeoLasFileFormat.cpp b/plugins/pointcloud-las/src/UsdGeoLasFileFormat.cpp index 2b81e01..3c8e644 100644 --- a/plugins/pointcloud-las/src/UsdGeoLasFileFormat.cpp +++ b/plugins/pointcloud-las/src/UsdGeoLasFileFormat.cpp @@ -305,7 +305,9 @@ bool UsdGeoLasFileFormat::Read(SdfLayer* layer, layer, "/PointCloud", selected, reference, {request.tileSize, 0}, payloadOptions, diagnostics)) { TF_RUNTIME_ERROR("%s", usdgeolas::diagnostics::Message( - usdgeolas::diagnostics::PointCloudAuthorFailed, + usdgeo::StoppedByWorkingStorageFailure(diagnostics) + ? usdgeolas::diagnostics::TiledStorageFailed + : usdgeolas::diagnostics::PointCloudAuthorFailed, "Unable to author tiled LAS point cloud: " + DiagnosticDetail( diagnostics, diff --git a/plugins/pointcloud-las/tests/test_pointcloud_las.cpp b/plugins/pointcloud-las/tests/test_pointcloud_las.cpp index 8300f05..a4c0dd5 100644 --- a/plugins/pointcloud-las/tests/test_pointcloud_las.cpp +++ b/plugins/pointcloud-las/tests/test_pointcloud_las.cpp @@ -365,11 +365,45 @@ void TestMissingFileDiagnostic() { mark.Clear(); } +void TestTiledStorageFailureDiagnostic() { + // A payload directory that is a regular file cannot hold the tile-spool + // workspace. The read must say its own working storage failed, not that + // the LAS source could not be authored. + pxr::TfErrorMark mark; + const auto source = std::filesystem::path(USDGEOLAS_SOURCE_DIR) / + "tests" / "fixtures" / "conformance.las"; + const auto uniqueSuffix = + std::chrono::high_resolution_clock::now().time_since_epoch().count(); + const auto blocker = std::filesystem::temp_directory_path() / + ("usd_pointcloud_plugins_payload_blocker_" + + std::to_string(uniqueSuffix)); + { + std::ofstream file(blocker, std::ios::binary); + file << "not a directory"; + } + const pxr::SdfLayer::FileFormatArguments arguments = { + {"payloadDirectory", blocker.string()}, + {"tile", "true"}, + {"tileSize", "1"}}; + Check(!pxr::SdfLayer::FindOrOpen(source.string(), arguments)); + Check(!mark.IsClean()); + bool reported = false; + for (auto error = mark.GetBegin(); error != mark.GetEnd(); ++error) { + reported = reported || + error->GetCommentary().find("[LAS018]") != std::string::npos; + } + Check(reported); + mark.Clear(); + Check(std::filesystem::is_regular_file(blocker)); + std::filesystem::remove(blocker); +} + } // namespace int main() { TestFileFormatIntegration(); TestMissingFileDiagnostic(); + TestTiledStorageFailureDiagnostic(); TestCheckedInAssets(); return 0; } \ No newline at end of file diff --git a/plugins/pointcloud-laz/docs/DIAGNOSTICS.md b/plugins/pointcloud-laz/docs/DIAGNOSTICS.md index ba410e9..f4b9282 100644 --- a/plugins/pointcloud-laz/docs/DIAGNOSTICS.md +++ b/plugins/pointcloud-laz/docs/DIAGNOSTICS.md @@ -24,4 +24,5 @@ record condition. | LAZ005 | FATAL | import | USD layer could not be created | | LAZ006 | FATAL | import | USD stage metrics could not be set | | LAZ007 | FATAL | import | LAZ point cloud could not be authored | -| LAZ008 | FATAL | import | LAZ file-format arguments are invalid or unsupported | \ No newline at end of file +| LAZ008 | FATAL | import | LAZ file-format arguments are invalid or unsupported | +| LAZ009 | FATAL | import | Tiled LAZ read stopped by its own working storage (tile spool, spool workspace, file-handle budget, or payload publication) | diff --git a/plugins/pointcloud-laz/include/usdgeolaz/UsdGeoLazDiagnostics.h b/plugins/pointcloud-laz/include/usdgeolaz/UsdGeoLazDiagnostics.h index 8934c98..a94dbdb 100644 --- a/plugins/pointcloud-laz/include/usdgeolaz/UsdGeoLazDiagnostics.h +++ b/plugins/pointcloud-laz/include/usdgeolaz/UsdGeoLazDiagnostics.h @@ -12,6 +12,10 @@ inline constexpr const char* UsdLayerCreateFailed = "LAZ005"; inline constexpr const char* StageMetricsFailed = "LAZ006"; inline constexpr const char* PointCloudAuthorFailed = "LAZ007"; inline constexpr const char* FormatArgumentInvalid = "LAZ008"; +// A tiled read stopped by its own working storage (tile spools, their +// workspace, the process file-handle budget, or payload publication) rather +// than by the source; see usdgeo::IsWorkingStorageFailure. +inline constexpr const char* TiledStorageFailed = "LAZ009"; inline std::string Message(const char* code, const std::string& message) { return "[" + std::string(code) + "] " + message; diff --git a/plugins/pointcloud-laz/src/UsdGeoLazFileFormat.cpp b/plugins/pointcloud-laz/src/UsdGeoLazFileFormat.cpp index 0f4b365..293e490 100644 --- a/plugins/pointcloud-laz/src/UsdGeoLazFileFormat.cpp +++ b/plugins/pointcloud-laz/src/UsdGeoLazFileFormat.cpp @@ -285,7 +285,9 @@ bool UsdGeoLazFileFormat::Read(SdfLayer* layer, layer, "/PointCloud", selected, reference, {request.tileSize, 0}, payloadOptions, diagnostics)) { TF_RUNTIME_ERROR("%s", usdgeolaz::diagnostics::Message( - usdgeolaz::diagnostics::PointCloudAuthorFailed, + usdgeo::StoppedByWorkingStorageFailure(diagnostics) + ? usdgeolaz::diagnostics::TiledStorageFailed + : usdgeolaz::diagnostics::PointCloudAuthorFailed, "Unable to author tiled LAZ point cloud: " + DiagnosticDetail( diagnostics, diff --git a/plugins/pointcloud-ply/README.md b/plugins/pointcloud-ply/README.md index d216776..1649d18 100644 --- a/plugins/pointcloud-ply/README.md +++ b/plugins/pointcloud-ply/README.md @@ -19,6 +19,11 @@ The `epsg` file-format argument is required. `linearUnit`, `sourceUpAxis`, and directory of its own. See [payload ownership](../../docs/architecture/FILE_FORMAT_ARGUMENTS.md#generated-payload-ownership). +A tiled read that cannot author reports `PLY007` with the reason, or `PLY008` +when the read was stopped by its own working storage (tile spool, spool +workspace, file-handle budget, or payload publication) rather than by the +source. See the [diagnostics contract](../../docs/architecture/DIAGNOSTICS.md#working-storage-codes). + Faces, mesh authoring, PLY writing, and metadata-only reads are out of scope. See the [capability matrix](../../docs/reference/CAPABILITY_MATRIX.md) and [file-format argument contract](../../docs/architecture/FILE_FORMAT_ARGUMENTS.md) diff --git a/plugins/pointcloud-ply/include/usdgeoply/UsdGeoPlyDiagnostics.h b/plugins/pointcloud-ply/include/usdgeoply/UsdGeoPlyDiagnostics.h index f5bbe89..deffafb 100644 --- a/plugins/pointcloud-ply/include/usdgeoply/UsdGeoPlyDiagnostics.h +++ b/plugins/pointcloud-ply/include/usdgeoply/UsdGeoPlyDiagnostics.h @@ -11,6 +11,10 @@ inline constexpr const char* DecodeFailed = "PLY004"; inline constexpr const char* UsdLayerCreateFailed = "PLY005"; inline constexpr const char* StageMetricsFailed = "PLY006"; inline constexpr const char* PointCloudAuthorFailed = "PLY007"; +// A tiled read stopped by its own working storage (tile spools, their +// workspace, the process file-handle budget, or payload publication) rather +// than by the source; see usdgeo::IsWorkingStorageFailure. +inline constexpr const char* TiledStorageFailed = "PLY008"; inline std::string Message(const char* code, const std::string& message) { return "[" + std::string(code) + "] " + message; diff --git a/plugins/pointcloud-ply/src/UsdGeoPlyFileFormat.cpp b/plugins/pointcloud-ply/src/UsdGeoPlyFileFormat.cpp index 268b6ef..1e076b3 100644 --- a/plugins/pointcloud-ply/src/UsdGeoPlyFileFormat.cpp +++ b/plugins/pointcloud-ply/src/UsdGeoPlyFileFormat.cpp @@ -213,7 +213,9 @@ bool UsdGeoPlyFileFormat::Read(SdfLayer* layer, layer, "/PointCloud", selected, reference, {request.tileSize, 0}, payloadOptions, diagnostics)) { TF_RUNTIME_ERROR("%s", usdgeoply::diagnostics::Message( - usdgeoply::diagnostics::PointCloudAuthorFailed, + usdgeo::StoppedByWorkingStorageFailure(diagnostics) + ? usdgeoply::diagnostics::TiledStorageFailed + : usdgeoply::diagnostics::PointCloudAuthorFailed, DiagnosticDetail( diagnostics, "Unable to author tiled PLY point cloud")) From 034ac533ec041f94e70d029ca6a4fdb85e1493b3 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 3 Nov 2026 09:12:29 +0000 Subject: [PATCH 2/2] ci: bootstrap ost 0.23.19 and recheck the runtime artifacts Move openstrata.ci.yaml's bootstrap from ost 0.22.8 to 0.23.19, the latest open-strata release, regenerate ost-source-ci.yml with that CLI, and move release.yml's OST_VERSION with it. The regenerated workflow passes OpenUSD requirement arguments to artifact pull and verify, adds an `ost library pull` step (nothing to pull here), supports the pyramid and package verify modes, and uploads .strata/reports and dist outputs as job artifacts. The three OpenUSD 26.08 runtime artifacts are rechecked, not re-pinned: the registry still serves the 26.08-gl-windows-x86_64, 26.08-metal-macos-arm64, and 26.08-gl-linux-x86_64 leaves at the pinned OCI digests, and 26.08 is still the newest version in ost's runtime matrix. The provenance comment, which still named superseded digests, now records the leaves and digests. Windows cells and the Windows release job declare host Python 3.13. ost 0.23.x `runtime validate` links and runs a C++ consumer, and the Windows runtime's USD DLLs import python313.dll; usd-vrm-plugins and usd-3dgs-plugins measured the 0xC0000135 failure without it on the same digest. README, BUILDING, and OPENUSD name the new pin; CHANGELOG records the move. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01JQZ6zAKFPpAYkZd9nBKCWu --- .github/workflows/ost-source-ci.yml | 157 ++++++++++++++++++++++------ .github/workflows/release.yml | 6 +- CHANGELOG.md | 19 ++++ README.md | 2 +- docs/compatibility/OPENUSD.md | 2 +- docs/guides/BUILDING.md | 3 +- openstrata.ci.yaml | 55 +++++++--- 7 files changed, 193 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ost-source-ci.yml b/.github/workflows/ost-source-ci.yml index 99d98a3..a253924 100644 --- a/.github/workflows/ost-source-ci.yml +++ b/.github/workflows/ost-source-ci.yml @@ -41,6 +41,9 @@ jobs: - name: workspace-pr-windows lane: pull_request runtime_artifact: sha256:ebb0c7da509ee14ada19ee5b461de6996aad0024b5c9640f12dde76912e849b5 + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -51,13 +54,18 @@ jobs: hosted: true runner_profile: windows-hosted verify: test + intent_flags: "" + up_to: 5 runtime_remote: "oci://ghcr.io/animu-sphere/openstrata-runtime-cy2026-usd@sha256:d3ff79a6f330558c3b9a427a927d340fe3dcab1fe89107faa0ea9f66a104b7bf" - host_python: "" + host_python: "3.13" host_packages_apt: "" host_packages_brew: "" - name: workspace-pr-macos-arm64 lane: pull_request runtime_artifact: sha256:8d1322126b8f3aa4dd1791184603d7e1b4571bd4d6d89dd80bb75bdf5eef397c + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -68,6 +76,8 @@ jobs: hosted: true runner_profile: macos-arm64-hosted verify: test + intent_flags: "" + up_to: 5 runtime_remote: "oci://ghcr.io/animu-sphere/openstrata-runtime-cy2026-usd@sha256:8486d94286b60cc20b53c926757f1802442569f9d9a7eecdadf2c9895b2efeb6" host_python: "3.13" host_packages_apt: "" @@ -75,6 +85,9 @@ jobs: - name: workspace-pr-linux lane: pull_request runtime_artifact: sha256:3bf31789daa60ef650df35ab276bd67d0c0ee44a960311f78835cc0962efe261 + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -85,6 +98,8 @@ jobs: hosted: true runner_profile: linux-hosted verify: test + intent_flags: "" + up_to: 5 runtime_remote: "oci://ghcr.io/animu-sphere/openstrata-runtime-cy2026-usd@sha256:8d2d599489ee623044f4360ad3a2b979e2966e6ad2f949e5aa9083570e59cc4f" host_python: "3.13" host_packages_apt: "libx11-dev libxt-dev libxext-dev libgl1-mesa-dev" @@ -96,7 +111,7 @@ jobs: if: ${{ matrix.hosted }} shell: bash run: echo "::notice title=OpenStrata hosted-runner usage::This job uses GitHub-hosted infrastructure. Private repositories may incur GitHub Actions usage charges. Review repository billing and Actions usage settings." - - name: Bootstrap ost 0.22.8 (pinned release asset, checksum-verified) + - name: Bootstrap ost 0.23.19 (pinned release asset, checksum-verified) if: ${{ matrix.hosted }} shell: bash run: | @@ -114,7 +129,7 @@ jobs: *) : ;; esac asset="ost-cli-${triple}.${ext}" - base="https://github.com/animu-sphere/open-strata/releases/download/v0.22.8" + base="https://github.com/animu-sphere/open-strata/releases/download/v0.23.19" curl -fsSLo "$asset" "$base/$asset" curl -fsSLo "$asset.sha256" "$base/$asset.sha256" actual="$( (command -v sha256sum > /dev/null && sha256sum "$asset" || shasum -a 256 "$asset") | cut -d' ' -f1 )" @@ -148,7 +163,7 @@ jobs: echo "$exported_path" >> "$GITHUB_PATH" json_executable="$(printf '%s' "$executable" | sed 's/\\/\\\\/g; s/"/\\"/g')" json_exported_path="$(printf '%s' "$exported_path" | sed 's/\\/\\\\/g; s/"/\\"/g')" - printf '{"schema":1,"pinned_version":"%s","asset":"%s","sha256":"%s","executable":"%s","exported_path":"%s"}\n' "0.22.8" "$asset" "$actual" "$json_executable" "$json_exported_path" > .ost-ci/bootstrap.json + printf '{"schema":1,"pinned_version":"%s","asset":"%s","sha256":"%s","executable":"%s","exported_path":"%s"}\n' "0.23.19" "$asset" "$actual" "$json_executable" "$json_exported_path" > .ost-ci/bootstrap.json - name: Check ost is available and record its version shell: bash run: | @@ -161,8 +176,8 @@ jobs: fi echo "$version" - if [ "${{ matrix.hosted }}" = "true" ] && [ "$version" != "ost 0.22.8" ]; then - echo "::error title=ost bootstrap::expected 'ost 0.22.8', got '$version'" ; exit 1 + if [ "${{ matrix.hosted }}" = "true" ] && [ "$version" != "ost 0.23.19" ]; then + echo "::error title=ost bootstrap::expected 'ost 0.23.19', got '$version'" ; exit 1 fi printf '{"schema":1,"ost_version":"%s"}\n' "$version" > .ost-ci/ost-version.json - name: Validate the CI manifest @@ -174,30 +189,47 @@ jobs: uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .ost-ci-home/artifacts - key: ost-registry-0.22.8-${{ runner.os }}-${{ runner.arch }}-${{ matrix.name }}-${{ matrix.runtime_artifact }} + key: ost-registry-0.23.19-${{ runner.os }}-${{ runner.arch }}-${{ matrix.name }}-${{ matrix.runtime_artifact }} - name: Pull the pinned runtime SDK from its remote reference if: ${{ matrix.runtime_remote != '' }} shell: bash run: | set -euo pipefail mkdir -p .ost-ci + set -- + if [ -n "${{ matrix.require_openusd }}" ]; then + set -- "$@" --require-openusd "${{ matrix.require_openusd }}" + fi + if [ -n "${{ matrix.require_openusd_version }}" ]; then + set -- "$@" --require-openusd-version "${{ matrix.require_openusd_version }}" + fi if ost artifact show "${{ matrix.runtime_artifact }}" --json > /dev/null 2>&1 \ - && ost artifact verify "${{ matrix.runtime_artifact }}" ${{ matrix.evidence_flags }} --json > .ost-ci/runtime-cache-verify.json; then + && ost artifact verify "${{ matrix.runtime_artifact }}" ${{ matrix.evidence_flags }} "$@" --json > .ost-ci/runtime-cache-verify.json; then echo "pinned runtime already present and verified (cache hit) -- skipping the remote pull" else if [ "${{ matrix.hosted }}" = "true" ] && [ -n "${OST_HOME:-}" ]; then rm -rf "${OST_HOME}/artifacts" fi - ost artifact pull "${{ matrix.runtime_remote }}" --expect-artifact "${{ matrix.runtime_artifact }}" --require-kind runtime --json | tee .ost-ci/runtime-pull.json + ost artifact pull "${{ matrix.runtime_remote }}" --expect-artifact "${{ matrix.runtime_artifact }}" --require-kind runtime "$@" --json | tee .ost-ci/runtime-pull.json fi - name: Verify and materialize the pinned runtime SDK shell: bash run: | set -euo pipefail mkdir -p .ost-ci - printf '{"schema":1,"runtime_artifact":"%s","source":"%s"}\n' "${{ matrix.runtime_artifact }}" "${{ matrix.runtime_remote != '' && 'remote-pull' || 'local-registry' }}" > .ost-ci/runtime-source.json - ost artifact verify ${{ matrix.runtime_artifact }} --minimum-trust ${{ matrix.minimum_trust }} ${{ matrix.evidence_flags }} + printf '{"schema":1,"runtime_artifact":"%s","require_openusd":"%s","require_openusd_version":"%s","source":"%s"}\n' "${{ matrix.runtime_artifact }}" "${{ matrix.require_openusd }}" "${{ matrix.require_openusd_version }}" "${{ matrix.runtime_remote != '' && 'remote-pull' || 'local-registry' }}" > .ost-ci/runtime-source.json + set -- + if [ -n "${{ matrix.require_openusd }}" ]; then + set -- "$@" --require-openusd "${{ matrix.require_openusd }}" + fi + if [ -n "${{ matrix.require_openusd_version }}" ]; then + set -- "$@" --require-openusd-version "${{ matrix.require_openusd_version }}" + fi + ost artifact verify ${{ matrix.runtime_artifact }} --minimum-trust ${{ matrix.minimum_trust }} ${{ matrix.evidence_flags }} "$@" ost runtime pull ${{ matrix.platform }} --profile ${{ matrix.profile }} --from-artifact ${{ matrix.runtime_artifact }} --force + - name: Pull digest-pinned external library artifacts + shell: bash + run: ost library pull --target ${{ matrix.platform }} --profile ${{ matrix.profile }} --json - name: Remove resumable transfer state before caching if: ${{ matrix.hosted && vars.OST_CI_DISABLE_CACHE != 'true' && steps.runtime-cache-restore.outputs.cache-hit != 'true' }} shell: bash @@ -207,7 +239,7 @@ jobs: uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .ost-ci-home/artifacts - key: ost-registry-0.22.8-${{ runner.os }}-${{ runner.arch }}-${{ matrix.name }}-${{ matrix.runtime_artifact }} + key: ost-registry-0.23.19-${{ runner.os }}-${{ runner.arch }}-${{ matrix.name }}-${{ matrix.runtime_artifact }} - name: Install the host packages this runtime needs to be consumed if: ${{ matrix.host_packages_apt != '' || matrix.host_packages_brew != '' }} shell: bash @@ -268,11 +300,19 @@ jobs: run: ost plugin test --workspace --graph-only --json - name: Build the workspace from source shell: bash - run: ost build --target ${{ matrix.platform }} --profile ${{ matrix.profile }} + run: ost build --target ${{ matrix.platform }} --profile ${{ matrix.profile }} ${{ matrix.intent_flags }} - name: Run the workspace test suite - if: ${{ matrix.verify == 'test' }} + if: ${{ matrix.verify != 'build' }} + shell: bash + run: ost test --target ${{ matrix.platform }} --profile ${{ matrix.profile }} ${{ matrix.intent_flags }} + - name: Run the workspace verification pyramid + if: ${{ matrix.verify == 'pyramid' || matrix.verify == 'package' }} shell: bash - run: ost test --target ${{ matrix.platform }} --profile ${{ matrix.profile }} + run: ost plugin test --workspace --target ${{ matrix.platform }} --profile ${{ matrix.profile }} --up-to ${{ matrix.up_to }} --json + - name: Package the workspace and aggregate product (never published from this workflow) + if: ${{ matrix.verify == 'package' }} + shell: bash + run: ost plugin package --workspace --product --target ${{ matrix.platform }} --profile ${{ matrix.profile }} --json - name: Upload the build logs and CI evidence if: always() uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 @@ -280,6 +320,10 @@ jobs: name: report-${{ matrix.name }} path: | .strata/targets/ + **/.strata/reports/ + **/dist/plugins/ + **/dist/tools/ + dist/products/ .ost-ci/ mainline: if: github.event_name == 'push' @@ -300,6 +344,9 @@ jobs: - name: pointcloud-las-main-windows lane: main runtime_artifact: sha256:ebb0c7da509ee14ada19ee5b461de6996aad0024b5c9640f12dde76912e849b5 + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -312,12 +359,15 @@ jobs: runner_profile: windows-hosted bundle: plugins/pointcloud-las runtime_remote: "oci://ghcr.io/animu-sphere/openstrata-runtime-cy2026-usd@sha256:d3ff79a6f330558c3b9a427a927d340fe3dcab1fe89107faa0ea9f66a104b7bf" - host_python: "" + host_python: "3.13" host_packages_apt: "" host_packages_brew: "" - name: pointcloud-laz-main-windows lane: main runtime_artifact: sha256:ebb0c7da509ee14ada19ee5b461de6996aad0024b5c9640f12dde76912e849b5 + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -330,12 +380,15 @@ jobs: runner_profile: windows-hosted bundle: plugins/pointcloud-laz runtime_remote: "oci://ghcr.io/animu-sphere/openstrata-runtime-cy2026-usd@sha256:d3ff79a6f330558c3b9a427a927d340fe3dcab1fe89107faa0ea9f66a104b7bf" - host_python: "" + host_python: "3.13" host_packages_apt: "" host_packages_brew: "" - name: pointcloud-las-main-macos-arm64 lane: main runtime_artifact: sha256:8d1322126b8f3aa4dd1791184603d7e1b4571bd4d6d89dd80bb75bdf5eef397c + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -354,6 +407,9 @@ jobs: - name: pointcloud-laz-main-macos-arm64 lane: main runtime_artifact: sha256:8d1322126b8f3aa4dd1791184603d7e1b4571bd4d6d89dd80bb75bdf5eef397c + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -372,6 +428,9 @@ jobs: - name: pointcloud-las-main-linux lane: main runtime_artifact: sha256:3bf31789daa60ef650df35ab276bd67d0c0ee44a960311f78835cc0962efe261 + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -390,6 +449,9 @@ jobs: - name: pointcloud-laz-main-linux lane: main runtime_artifact: sha256:3bf31789daa60ef650df35ab276bd67d0c0ee44a960311f78835cc0962efe261 + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -408,6 +470,9 @@ jobs: - name: pointcloud-copc-main-windows lane: main runtime_artifact: sha256:ebb0c7da509ee14ada19ee5b461de6996aad0024b5c9640f12dde76912e849b5 + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -420,12 +485,15 @@ jobs: runner_profile: windows-hosted bundle: plugins/pointcloud-copc runtime_remote: "oci://ghcr.io/animu-sphere/openstrata-runtime-cy2026-usd@sha256:d3ff79a6f330558c3b9a427a927d340fe3dcab1fe89107faa0ea9f66a104b7bf" - host_python: "" + host_python: "3.13" host_packages_apt: "" host_packages_brew: "" - name: pointcloud-copc-main-macos-arm64 lane: main runtime_artifact: sha256:8d1322126b8f3aa4dd1791184603d7e1b4571bd4d6d89dd80bb75bdf5eef397c + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -444,6 +512,9 @@ jobs: - name: pointcloud-copc-main-linux lane: main runtime_artifact: sha256:3bf31789daa60ef650df35ab276bd67d0c0ee44a960311f78835cc0962efe261 + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -462,6 +533,9 @@ jobs: - name: pointcloud-ply-main-windows lane: main runtime_artifact: sha256:ebb0c7da509ee14ada19ee5b461de6996aad0024b5c9640f12dde76912e849b5 + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -474,12 +548,15 @@ jobs: runner_profile: windows-hosted bundle: plugins/pointcloud-ply runtime_remote: "oci://ghcr.io/animu-sphere/openstrata-runtime-cy2026-usd@sha256:d3ff79a6f330558c3b9a427a927d340fe3dcab1fe89107faa0ea9f66a104b7bf" - host_python: "" + host_python: "3.13" host_packages_apt: "" host_packages_brew: "" - name: pointcloud-ply-main-macos-arm64 lane: main runtime_artifact: sha256:8d1322126b8f3aa4dd1791184603d7e1b4571bd4d6d89dd80bb75bdf5eef397c + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -498,6 +575,9 @@ jobs: - name: pointcloud-ply-main-linux lane: main runtime_artifact: sha256:3bf31789daa60ef650df35ab276bd67d0c0ee44a960311f78835cc0962efe261 + require_openusd: "" + require_openusd_version: "" + openusd_flags: "" target_trust: local minimum_trust: local require_evidence: all @@ -520,7 +600,7 @@ jobs: if: ${{ matrix.hosted }} shell: bash run: echo "::notice title=OpenStrata hosted-runner usage::This job uses GitHub-hosted infrastructure. Private repositories may incur GitHub Actions usage charges. Review repository billing and Actions usage settings." - - name: Bootstrap ost 0.22.8 (pinned release asset, checksum-verified) + - name: Bootstrap ost 0.23.19 (pinned release asset, checksum-verified) if: ${{ matrix.hosted }} shell: bash run: | @@ -538,7 +618,7 @@ jobs: *) : ;; esac asset="ost-cli-${triple}.${ext}" - base="https://github.com/animu-sphere/open-strata/releases/download/v0.22.8" + base="https://github.com/animu-sphere/open-strata/releases/download/v0.23.19" curl -fsSLo "$asset" "$base/$asset" curl -fsSLo "$asset.sha256" "$base/$asset.sha256" actual="$( (command -v sha256sum > /dev/null && sha256sum "$asset" || shasum -a 256 "$asset") | cut -d' ' -f1 )" @@ -572,7 +652,7 @@ jobs: echo "$exported_path" >> "$GITHUB_PATH" json_executable="$(printf '%s' "$executable" | sed 's/\\/\\\\/g; s/"/\\"/g')" json_exported_path="$(printf '%s' "$exported_path" | sed 's/\\/\\\\/g; s/"/\\"/g')" - printf '{"schema":1,"pinned_version":"%s","asset":"%s","sha256":"%s","executable":"%s","exported_path":"%s"}\n' "0.22.8" "$asset" "$actual" "$json_executable" "$json_exported_path" > .ost-ci/bootstrap.json + printf '{"schema":1,"pinned_version":"%s","asset":"%s","sha256":"%s","executable":"%s","exported_path":"%s"}\n' "0.23.19" "$asset" "$actual" "$json_executable" "$json_exported_path" > .ost-ci/bootstrap.json - name: Check ost is available and record its version shell: bash run: | @@ -585,8 +665,8 @@ jobs: fi echo "$version" - if [ "${{ matrix.hosted }}" = "true" ] && [ "$version" != "ost 0.22.8" ]; then - echo "::error title=ost bootstrap::expected 'ost 0.22.8', got '$version'" ; exit 1 + if [ "${{ matrix.hosted }}" = "true" ] && [ "$version" != "ost 0.23.19" ]; then + echo "::error title=ost bootstrap::expected 'ost 0.23.19', got '$version'" ; exit 1 fi printf '{"schema":1,"ost_version":"%s"}\n' "$version" > .ost-ci/ost-version.json - name: Validate the CI manifest @@ -598,30 +678,47 @@ jobs: uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .ost-ci-home/artifacts - key: ost-registry-0.22.8-${{ runner.os }}-${{ runner.arch }}-${{ matrix.name }}-${{ matrix.runtime_artifact }} + key: ost-registry-0.23.19-${{ runner.os }}-${{ runner.arch }}-${{ matrix.name }}-${{ matrix.runtime_artifact }} - name: Pull the pinned runtime SDK from its remote reference if: ${{ matrix.runtime_remote != '' }} shell: bash run: | set -euo pipefail mkdir -p .ost-ci + set -- + if [ -n "${{ matrix.require_openusd }}" ]; then + set -- "$@" --require-openusd "${{ matrix.require_openusd }}" + fi + if [ -n "${{ matrix.require_openusd_version }}" ]; then + set -- "$@" --require-openusd-version "${{ matrix.require_openusd_version }}" + fi if ost artifact show "${{ matrix.runtime_artifact }}" --json > /dev/null 2>&1 \ - && ost artifact verify "${{ matrix.runtime_artifact }}" ${{ matrix.evidence_flags }} --json > .ost-ci/runtime-cache-verify.json; then + && ost artifact verify "${{ matrix.runtime_artifact }}" ${{ matrix.evidence_flags }} "$@" --json > .ost-ci/runtime-cache-verify.json; then echo "pinned runtime already present and verified (cache hit) -- skipping the remote pull" else if [ "${{ matrix.hosted }}" = "true" ] && [ -n "${OST_HOME:-}" ]; then rm -rf "${OST_HOME}/artifacts" fi - ost artifact pull "${{ matrix.runtime_remote }}" --expect-artifact "${{ matrix.runtime_artifact }}" --require-kind runtime --json | tee .ost-ci/runtime-pull.json + ost artifact pull "${{ matrix.runtime_remote }}" --expect-artifact "${{ matrix.runtime_artifact }}" --require-kind runtime "$@" --json | tee .ost-ci/runtime-pull.json fi - name: Verify and materialize the pinned runtime SDK shell: bash run: | set -euo pipefail mkdir -p .ost-ci - printf '{"schema":1,"runtime_artifact":"%s","source":"%s"}\n' "${{ matrix.runtime_artifact }}" "${{ matrix.runtime_remote != '' && 'remote-pull' || 'local-registry' }}" > .ost-ci/runtime-source.json - ost artifact verify ${{ matrix.runtime_artifact }} --minimum-trust ${{ matrix.minimum_trust }} ${{ matrix.evidence_flags }} + printf '{"schema":1,"runtime_artifact":"%s","require_openusd":"%s","require_openusd_version":"%s","source":"%s"}\n' "${{ matrix.runtime_artifact }}" "${{ matrix.require_openusd }}" "${{ matrix.require_openusd_version }}" "${{ matrix.runtime_remote != '' && 'remote-pull' || 'local-registry' }}" > .ost-ci/runtime-source.json + set -- + if [ -n "${{ matrix.require_openusd }}" ]; then + set -- "$@" --require-openusd "${{ matrix.require_openusd }}" + fi + if [ -n "${{ matrix.require_openusd_version }}" ]; then + set -- "$@" --require-openusd-version "${{ matrix.require_openusd_version }}" + fi + ost artifact verify ${{ matrix.runtime_artifact }} --minimum-trust ${{ matrix.minimum_trust }} ${{ matrix.evidence_flags }} "$@" ost runtime pull ${{ matrix.platform }} --profile ${{ matrix.profile }} --from-artifact ${{ matrix.runtime_artifact }} --force + - name: Pull digest-pinned external library artifacts + shell: bash + run: ost library pull --target ${{ matrix.platform }} --profile ${{ matrix.profile }} --json - name: Remove resumable transfer state before caching if: ${{ matrix.hosted && vars.OST_CI_DISABLE_CACHE != 'true' && steps.runtime-cache-restore.outputs.cache-hit != 'true' }} shell: bash @@ -631,7 +728,7 @@ jobs: uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 with: path: .ost-ci-home/artifacts - key: ost-registry-0.22.8-${{ runner.os }}-${{ runner.arch }}-${{ matrix.name }}-${{ matrix.runtime_artifact }} + key: ost-registry-0.23.19-${{ runner.os }}-${{ runner.arch }}-${{ matrix.name }}-${{ matrix.runtime_artifact }} - name: Install the host packages this runtime needs to be consumed if: ${{ matrix.host_packages_apt != '' || matrix.host_packages_brew != '' }} shell: bash diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f6a900e..1b42642 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,7 @@ concurrency: cancel-in-progress: false env: - OST_VERSION: '0.22.8' + OST_VERSION: '0.23.19' OST_REPOSITORY: animu-sphere/open-strata OST_PLATFORM: cy2026 OST_PROFILE: usd @@ -40,7 +40,9 @@ jobs: ost_home: '' runtime_artifact: sha256:ebb0c7da509ee14ada19ee5b461de6996aad0024b5c9640f12dde76912e849b5 runtime_remote: oci://ghcr.io/animu-sphere/openstrata-runtime-cy2026-usd@sha256:d3ff79a6f330558c3b9a427a927d340fe3dcab1fe89107faa0ea9f66a104b7bf - host_python: '' + # ost 0.23.x runtime validation runs a C++ consumer whose USD DLLs + # import python313.dll; see openstrata.ci.yaml. + host_python: '3.13' host_packages_apt: '' up_to: 4 - name: linux-x86_64 diff --git a/CHANGELOG.md b/CHANGELOG.md index 502c701..043fe2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,25 @@ All notable changes to this project are documented here. - The authoring stream benchmark builds on macOS, where `std::uintmax_t` and `std::uint64_t` are distinct types. +### CI + +- Bootstrap OpenStrata `ost` 0.23.19 (from 0.22.8) in source CI and the + release workflow, and regenerate `ost-source-ci.yml` with that CLI. The + generated workflow passes OpenUSD requirement arguments to artifact pull and + verify, adds an `ost library pull` step (nothing is pulled; the workspace + declares no external libraries), supports the `pyramid` and `package` verify + modes, and uploads the `.strata/reports` and `dist` outputs as job + artifacts. +- The three OpenUSD 26.08 runtime artifacts are rechecked rather than + re-pinned: the registry still serves the `26.08-gl-windows-x86_64`, + `26.08-metal-macos-arm64`, and `26.08-gl-linux-x86_64` leaves at the pinned + digests, and 26.08 is still the newest version in ost's runtime matrix. The + provenance comment in `openstrata.ci.yaml` now names those leaves and + digests. +- Windows cells declare `host_python: "3.13"`. ost 0.23.x `runtime validate` + links and runs a C++ consumer, and the Windows runtime's USD DLLs import + `python313.dll`, which is on PATH only after host Python is set up. + ### Compatibility - Payload files written by earlier tiled reads directly into diff --git a/README.md b/README.md index f7538d0..b428590 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ remote read actually costs is recorded in the ## Quick Start Requirements: CMake 3.23+, a C++17 compiler, OpenUSD 26.08 (the plugin -contract accepts `>=26.08,<27.0`), and OpenStrata 0.22.7 for the pinned +contract accepts `>=26.08,<27.0`), and OpenStrata 0.23.19 for the pinned workspace build. Build and test everything through the pinned OpenStrata workspace: diff --git a/docs/compatibility/OPENUSD.md b/docs/compatibility/OPENUSD.md index f76f266..3f28e68 100644 --- a/docs/compatibility/OPENUSD.md +++ b/docs/compatibility/OPENUSD.md @@ -23,7 +23,7 @@ provided by a separately installed resolver such as | --- | --- | | Validated OpenUSD version | 26.08 | | Accepted range | `>=26.08,<27.0` | -| OpenStrata CLI | 0.22.7 | +| OpenStrata CLI | 0.23.19 (CI bootstrap) | | OpenStrata platform / profile | `cy2026` / `usd` | | C++ standard | C++17 | | CMake | 3.23 or newer | diff --git a/docs/guides/BUILDING.md b/docs/guides/BUILDING.md index bf9e442..44ee3b3 100644 --- a/docs/guides/BUILDING.md +++ b/docs/guides/BUILDING.md @@ -9,7 +9,8 @@ Requirements: - CMake 3.23 or newer - A C++17 compiler -- OpenStrata `ost` 0.22.7 for the pinned workspace build +- OpenStrata `ost` 0.23.19 for the pinned workspace build (the CI bootstrap + in `openstrata.ci.yaml`) - OpenUSD 26.08 for the USD targets, with the plugin contract accepting `>=26.08,<27.0` diff --git a/openstrata.ci.yaml b/openstrata.ci.yaml index 77cba65..e03841b 100644 --- a/openstrata.ci.yaml +++ b/openstrata.ci.yaml @@ -29,29 +29,47 @@ # macOS needs no equivalent: the OpenGL framework ships with the SDK. # # Digest provenance: -# All three runtimes are the validated OpenUSD 26.08 (PXR_VERSION 2608) builds -# published by animu-sphere, and are the same artifacts usd-vrm-plugins pins. -# Each carries an SPDX SBOM and SLSA/in-toto provenance, which is what the +# All three runtimes are the validated OpenUSD 26.08 (PXR_VERSION 2608) +# imaging leaves of ost's canonical runtime matrix, published by animu-sphere, +# and are the same artifacts usd-vrm-plugins and usd-3dgs-plugins pin. Each +# carries an SPDX SBOM and SLSA/in-toto provenance, which is what the # `--require-sbom --require-provenance` gate `ost ci generate` renders demands. # -# DO NOT re-pin from the moving `26.08-` GHCR tags. Those tags point -# at a separate runtime build configured WITH Vulkan, whose `pxrTargets.cmake` -# puts `Vulkan::Vulkan` in the `hgiVulkan` link interface while `pxrConfig.cmake` -# never issues a matching `find_dependency(Vulkan)`. Consuming it fails at the -# CMake generate step with "the link interface of target hgiVulkan contains: -# Vulkan::Vulkan but the target was not found" on every platform. +# Windows: leaf 26.08-gl-windows-x86_64 +# OST artifact sha256:ebb0c7da... / OCI sha256:d3ff79a6... +# macOS: leaf 26.08-metal-macos-arm64 +# OST artifact sha256:8d132212... / OCI sha256:8486d942... +# Linux: leaf 26.08-gl-linux-x86_64 +# OST artifact sha256:3bf31789... / OCI sha256:8d2d5994... # -# The OCI manifest digest is NOT stable across republishes (provenance embeds -# the producing commit), so `expected_oci_digest` must be re-pinned from the -# push output every time, while `runtime_artifact` stays put. -# Windows: OST artifact sha256:c3ed4012... / OCI sha256:07cb8441... -# macOS: OST artifact sha256:a9bb847a... / OCI sha256:dc0c980b... -# Linux: OST artifact sha256:03f7d4ef... / OCI sha256:367a32bd... +# Rechecked 2026-11-03 for the ost 0.23.19 bootstrap: the registry still +# serves each leaf tag at the OCI digest pinned below, and 26.08 is still the +# newest version in ost's runtime matrix, so no cell is re-pinned. +# +# DO NOT re-pin from the legacy `26.08-` GHCR tags (no variant). +# Those pointed at a runtime build configured WITH Vulkan, whose +# `pxrTargets.cmake` puts `Vulkan::Vulkan` in the `hgiVulkan` link interface +# while `pxrConfig.cmake` never issues a matching `find_dependency(Vulkan)`. +# Consuming it fails at the CMake generate step with "the link interface of +# target hgiVulkan contains: Vulkan::Vulkan but the target was not found". +# Re-pin only from the `---` leaves above. +# +# Neither the OCI manifest digest nor `runtime_artifact` is stable across a +# republish (provenance embeds the producing commit): re-pin both from the +# producer's push output, and check ost's support/runtime-migrations.json for +# a recorded replacement when a pinned digest stops resolving. +# +# WINDOWS HOST PYTHON. ost 0.23.x `runtime validate` links and runs a C++ +# consumer (`consumer-link`). The Windows runtime bundles no interpreter and +# its USD DLLs import python313.dll, so without a host Python on PATH that +# consumer exits 0xC0000135 (DLL not found). Every Windows cell therefore +# declares host_python "3.13", as the Linux and macOS cells already did; +# usd-vrm-plugins and usd-3dgs-plugins measured this on the same digest. schema: 1 bootstrap: ost: - version: "0.22.8" + version: "0.23.19" repository: animu-sphere/open-strata runners: @@ -83,6 +101,7 @@ cells: bundle: plugins/pointcloud-las platform: cy2026 profile: usd + host_python: "3.13" up_to: 4 - name: pointcloud-laz-main-windows @@ -95,6 +114,7 @@ cells: bundle: plugins/pointcloud-laz platform: cy2026 profile: usd + host_python: "3.13" up_to: 4 - name: pointcloud-las-main-macos-arm64 @@ -163,6 +183,7 @@ cells: bundle: plugins/pointcloud-copc platform: cy2026 profile: usd + host_python: "3.13" up_to: 4 - name: pointcloud-copc-main-macos-arm64 @@ -203,6 +224,7 @@ cells: bundle: plugins/pointcloud-ply platform: cy2026 profile: usd + host_python: "3.13" up_to: 4 - name: pointcloud-ply-main-macos-arm64 @@ -256,6 +278,7 @@ cells: expected_oci_digest: sha256:d3ff79a6f330558c3b9a427a927d340fe3dcab1fe89107faa0ea9f66a104b7bf platform: cy2026 profile: usd + host_python: "3.13" - name: workspace-pr-macos-arm64 lane: pull_request