[#99] Resolve ContentDirectory references when content files lack the .cf extension#105
Draft
SkowronskiAndrew wants to merge 1 commit into
Draft
[#99] Resolve ContentDirectory references when content files lack the .cf extension#105SkowronskiAndrew wants to merge 1 commit into
SkowronskiAndrew wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes ContentDirectory reference resolution when content files in archives omit the .cf extension by normalizing content-file identifiers so analyzed files and ContentLayout-derived references resolve to the same serialized-file ids regardless of on-disk naming.
Changes:
- Added
ContentFileDependencyMap.NormalizeFileNameto canonicalize content-file keys (lowercase + strip trailing.cf). - Updated serialized-file id assignment, dependency-map lookup, and external-reference fallback naming to use the normalized key.
- Updated ContentLayout dependency-map population and layout-to-core linking to use normalized keys while preserving canonical
"<hash>.cf"display names for layout-only stub rows.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| Analyzer/Util/ContentFileDependencyMap.cs | Introduces content-file name normalization to make ids extension-agnostic. |
| Analyzer/SQLite/Writers/SerializedFileSQLiteWriter.cs | Uses normalized content-file keys when assigning ids and resolving external references. |
| Analyzer/SQLite/Writers/ContentLayoutSQLWriter.cs | Normalizes dependency-map keys/resolved names and uses normalized keys when linking layout entries to analyzed serialized files. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…xtension ContentLayout reference resolution keyed content files as <hash>.cf, but the analyzed file was keyed by its actual on-disk name. Builds whose archive entries omit the extension (just <hash>) never matched, so references fell through to the .cfid placeholders in the external reference table, producing phantom .cfid rows in serialized_files (NULL archive) and a flood of dangling_refs. Normalize content-file names to the bare content hash (strip a trailing .cf) at every site where the name becomes a serialized-file id key, so a content file resolves to the same id whether or not the extension is present on disk.
SkowronskiAndrew
force-pushed
the
issue99-optional-cf-extension
branch
from
July 21, 2026 15:15
58f122d to
8c4f5f1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes a break in the ContentLayout reference resolution added under #99, found while
analyzing a real Addressables-built content directory.
ContentLayout reference resolution keyed each content file as
<contenthash>.cf, butthe analyzed file was keyed by its actual on-disk name. In a build whose archive
entries omit the extension (the entry is just
<contenthash>, not<contenthash>.cf)the two keys never matched. Resolution then fell through to the
.cfidplaceholders inthe file's external reference table, producing phantom
.cfidrows inserialized_files(with NULL archive) and a flood of
dangling_refs— none of which should happen when amatching ContentLayout.json is supplied. The extension is informational (the loader
identifies content by hash), so a build is free to omit it, and this tool must handle
both forms.
Changes
ContentFileDependencyMap.NormalizeFileName— strips a trailing.cf(case-insensitive on the extension) so a content file resolves to the same
serialized-file id whether or not the extension is present on disk. The name's case is
otherwise preserved, matching the case-sensitive serialized-file name matching from Match SerializedFile names case-sensitively #106.
Non-content files never end in
.cf, so it is a no-op for them.the analyzed file's id, the dependency-map lookup, and the external-reference fallback
name (
SerializedFileSQLiteWriter); the dependency-map keys and resolved dependencynames (
ContentLayoutSQLWriter.PopulateContentFileDependencies); and the layout linkid (
ContentLayoutSQLWriter.LinkSerializedFiles).<hash>.cfdisplay name, sincethat file was never seen on disk; only the id key is normalized.
.resS/.resourcewere reviewed and need no change: content directory builds referencethem via
cah:/<hash>and the tool never opens them by filename, so their extensionsare already irrelevant.
Testing
dotnet test— full suite green (259 passed), including theAnalyzeContentLayoutTeststhat cover the
.cf-extension reference build (unchanged behavior).directory packed into
.archivefiles with extensionless entries):.cfidrows inserialized_files: 0 (was: several)dangling_refs: 8, all targetingunity default resources— the expectedbuilt-in case (was: many, spanning content files)
serialized_filesrow is theunity default resourcesbuilt-in
content_layout_serialized_filesentry links to its realanalyzed row (0 unlinked)
No automated fixture for the extensionless case is added here; a no-extension archive
reference build will be added to
TestCommon/Dataseparately.