1 project files import profiles and asset change impact
forgejo-actions edited this page 2026-07-15 12:43:13 +00:00

Project Files, Import Profiles, And Asset Change Impact

Purpose

Use Project Files and the Import asset inspector to find native files under res://, understand which loader owns them, inspect typed loader diagnostics and dependency edges, and preview the rebuild and validation impact of a change before editing or replacing an asset.

The surfaces are projections over separate owners. EditorProjectFilesState owns filesystem indexing and selection. EditorImporterRegistry owns extension/prefix classification and hot-reload policy. EditorAssetEditorRegistry owns prioritized resource/path routing into typed editor handlers. AuthoredAssetDashboard owns observed typed-loader status, schema metadata, dependencies, and diagnostics. EditorAuthoredContentWorkspace and AuthoringDependencyGraphSnapshot own where-used, staleness, cycles, transitive rebuild sets, and validation impact. The inspector combines those views; reimport writes editor-local import metadata but never replaces the native source asset.

Steps

Inspect An Existing Asset

  1. Open the FileSystem tool (aether.filesystem) and select Rescan when files have been added, removed, or moved outside the editor. The index recursively scans the configured asset root, stores normalized forward-slash paths without the res:// prefix, and caps the result at 20,000 files. Use directory navigation, text search, kind filters, or favorites to select a file.

  2. Open the selected asset's Import tool (aether.import). The Import view is the active import profile; it is not a mutable sidecar profile. It reports source extension, classified ProjectAssetKind, importer label, native storage, dedicated editor route, hot-reload status or policy, schema version, and dependency-owner count.

  3. Read the profile according to its data source:

    • A matching AuthoredAssetDashboardRow means a typed loader has observed the asset. Use its Loaded, Reloaded, Failed, Removed, or Waiting for load state, schema version, and loader diagnostics as the authoritative import health.
    • No dashboard row means the file is a direct asset. The inspector falls back to the importer registry's hot-reload policy and reports Not schema-backed; an unknown extension falls back further to Raw Asset Loader and Loader dependent.
    • The file remains the source of truth at res://.... The editor does not generate an opaque imported copy.
  4. Switch to Dependencies. Depends On is assembled for every indexed owner at the selected asset path; Used By is the graph's direct reverse-reference list. A stale marker means the dependency signature captured by the graph differs from the current signature index. Follow a path link to select that file in Project Files; navigation succeeds only when the target is present in the current project-file index.

  5. Switch to Impact before changing a shared asset. The preview reports:

    • direct uses of the selected normalized path;
    • the transitive incremental rebuild owner set reached through reverse references;
    • impacted owners that already have validation issues, including diagnostics on the selected owner itself;
    • whether the standalone VFS manifest packages the path; and
    • owner cycles that contain the selected asset.

    This is a dry run. A non-empty validation count means validation-bearing owners are affected, not that the proposed change has already been validated. A cycle means refresh ordering may need more than one pass.

  6. Make the source change through its dedicated editor or external source tool. Importer-backed assets expose typed options plus Import/Reimport and Reset Options; those actions persist import metadata separately from the source. Return to Project Files and rescan if path or file metadata changed, then wait for or trigger the owning typed-loader workflow. Recheck Import, Dependencies, and Impact until the dashboard and dependency signatures no longer report failure or staleness.

  7. Run the validation or packaging gate appropriate to the asset before handing it off. For a broad content change, use:

    cargo run --bin aether-bake -- --consumer cli --fail-on-diagnostics
    cargo run -p xtask -- docs-check --root .
    

    Use the narrower commands documented by the asset's owning system when available; the inspector itself has no generic reimport command.

Add A New Import Family

  1. Add a stable EditorImporterDescriptor in src/editor/importer_registry.rs. Specify a non-empty ID and label, at least one lowercase extension, an optional normalized path prefix, the correct project kind, a hot-reload policy, and a priority. Classification lowercases paths, converts backslashes to slashes, and picks the first matching descriptor after priority and path-specific sorting.

  2. Claim the importer ID under exactly one extension in assets/editor/extensions.json. The extension manifest is the ownership boundary; the importer registry remains the routing boundary.

  3. Extend ProjectAssetKind only when existing kinds cannot describe the resource. Update its label, search key, icon, and filter list. Register dedicated routing separately with an EditorAssetEditorDescriptor; provide its extension owner, labels, supported kinds, optional path conventions, priority, and typed handler. Do not add routing branches to Project Files or the Asset Inspector.

  4. For typed import health, add or reuse an AuthoredAssetKind descriptor and make the loader emit AuthoredAssetMetadata through AuthoredAssetDashboardSource or an equivalent dashboard sync. Metadata must use canonical asset paths and include schema version, dependency signatures, folder invalidations, and validation issues that the loader truly owns.

  5. Add dependency ownership through the appropriate AuthoringDependencyGraphIndexer or diagnostics provider. Index owner kind, owner asset path, relation, dependency path, captured signature, and validation metadata. Do not infer domain dependencies in the UI; the inspector consumes AuthoringDependencyQuery so ownership stays in the graph.

  6. Add focused checks and run them with the registry and graph tests:

    cargo test -p aether project_asset_kind_classifies_engine_asset_formats
    cargo test -p aether importer_registry_prefers_path_specific_formats
    cargo test -p aether asset_editor_registry_prefers_specific_paths_over_generic_resource_kinds
    cargo test -p aether importers_route_project_asset_kinds_to_real_loader_families
    cargo test -p aether explain_asset_change_preserves_owner_level_rebuild_and_validation_impact
    cargo run -p xtask -- docs-check --root .
    

Expected Outputs

  • A normalized project-file entry with size, modified time, searchable kind, and stable selection path.
  • One deterministic importer route and an extension owner for every registered importer ID.
  • Typed hot-reload, schema, dependency, and validation data when the asset family supports AuthoredAssetMetadata.
  • Direct dependencies, direct uses, signature staleness, transitive rebuild owners, validation-bearing owners, VFS packaging status, and cycles from one merged dependency snapshot.
  • A deterministic extension-owned editor route where supported, with raw/direct fallback behavior for files that have no typed editor or whose optional editor extension is disabled.

Common Mistakes

  • Treating editor-local import options as source content. Reimport metadata is a separate editor document; the native res:// asset remains authoritative.
  • Assuming a successful filesystem rescan refreshes typed loader state. Rescan updates file metadata and selection; dashboard and dependency owners refresh through their own loaders and workspace cache.
  • Adding an importer without claiming its stable ID in assets/editor/extensions.json.
  • Registering an asset editor without claiming its stable ID under the same extension owner in assets/editor/extensions.json.
  • Hardcoding a file-kind or path branch in Project Files when the rule belongs in EditorAssetEditorRegistry.
  • Using only an extension to distinguish shared formats. .tmx requires path-specific priority so prefabs are not classified as tilemaps.
  • Emitting dependencies with inconsistent res:// prefixes, slash direction, or case. Graph and dashboard matching canonicalize paths, while Project Files navigation still requires an indexed target.
  • Reading No Impact as proof that a change is harmless. It means no indexed owners match the current snapshot and filter; missing or stale providers must be repaired first.
  • Interpreting Validation Impact as predicted new errors. It lists impacted owners that already carry diagnostics.

Recovery Paths

If the scan fails, verify the configured asset root exists and is readable, then select Rescan. A failed scan clears entries and directories, records the error, and increments the index revision. If the scan is truncated, reduce generated files under the asset root or inspect the omitted domain outside Project Files before relying on where-used navigation.

If the wrong importer appears, test importer_for_path_with_extensions with the res://-relative path and compare lifecycle state, extension, prefix, and priority. If no importer matches, the file will be Other with the raw-loader fallback until an enabled descriptor is registered. If the importer is correct but the Open action is wrong or absent, inspect EditorAssetEditorRegistry priority, matchers, and extension ownership separately.

If typed diagnostics are absent, distinguish Direct Asset from a loader integration failure: confirm the asset kind descriptor, dashboard sync, canonical dashboard path, and current hot-reload event. If dependencies or impact are incomplete, refresh the authored-content workspace and inspect the responsible graph indexer or diagnostics provider; do not patch the inspector with domain-specific edges.

If staleness remains after reload, compare the dependency path and current disk signature, then rebuild the owning workspace snapshot. For a reported cycle, reload the listed owners in dependency order, repeat until signatures converge, and run the owning validation gate. If a dependency link does nothing, rescan Project Files and verify that the target exists under the active asset root.