Skip to content

Sync fxceless d510ee4: a hook this loader does not understand is left out, not the profile - #170

Merged
pablogonz12 merged 1 commit into
mainfrom
sync/fx-loader
Nov 25, 2026
Merged

pablogonz12 merged 1 commit into
mainfrom
sync/fx-loader

Conversation

@pablogonz12

@pablogonz12 pablogonz12 commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

The profile loader is strict at every level: deny_unknown_fields on Hook too, so a profile
written for a newer loader (a hook with when/new_scale) made an older build reject the whole
file — title profile not read: TOML parse error at line N — and run with none of its hooks.
A live title profile has three render-scale hooks and two first-world hooks waiting for it: the two
that keep the title alive must not go with the three that wait.

Hooks are now taken out of the document and read one at a time: a hook carrying a field this
version does not know is skipped on its own with one warning naming it, and everything else in the
profile still applies. The top level is read as strictly as before — a file that is not a profile
is still rejected and reported.

  • profile::parse does it; load_dir calls it (crates/victory-core/src/profile.rs).
  • Test: three hooks, the middle one with a field of a later loader; the other two load, in order.
  • docs/title-profiles.md: what an older build does with a newer hook.

Credit: the change is ours (pablogonz12), written on the fxceless-fork sync branch.

Gates:

  • cargo xwin clippy --target x86_64-pc-windows-msvc --workspace --all-targets -- -D warnings: clean.
  • cargo test -p victory-core --lib profile: 11 passed.
  • Dry run (no --execute) on a copy of the live profile: build.toml matched, 2 hooks, every module missing=0;
    the same copy with one unknown field logs hook "from a later loader" not placed: unknown field shinier and
    still binds, 2 hooks.
  • cargo xtask policy: 240 files ok. Asset grep empty.

No behaviour change when profiles are well-formed, so no off switch. Not tested in a game run.

Summary by CodeRabbit

  • Bug Fixes
    • Profiles can now load valid hooks even when another hook contains an unsupported field. The invalid hook is skipped with a warning, while the rest of the profile remains available.
  • Documentation
    • Clarified how profiles behave when a hook contains an unsupported field.

… profile

A profile written for this branch (a hook with `when` or `new_scale`) made
an older build reject the whole file — `title profile not read: TOML parse
error at line N` — and run with none of its hooks: the two that keep the
title alive went with the three that ask for a resolution patch. Values
now, the hooks are taken out of the document and read one at a time, so a
hook carrying a field this version does not know is skipped on its own
with one warning naming it (`hook "…" not placed: unknown field …`), and
everything else in the profile still applies.

The top level is read as strictly as before (`deny_unknown_fields`: a file
that is not a profile at all is still rejected and reported), and only the
`[[hooks]]` entries are read one at a time.

- `profile::parse` does it; `load_dir` calls it.
- Test: three hooks, the middle one with a field of a later loader; the
  other two load, in order.
- `docs/title-profiles.md`: `when` and `new_scale` need this version, and
  what an older build does with a newer hook.

Checked against a copy of the live profile with the pending resolution
hooks appended (in /tmp, never the live file): `matched, 5 hooks`, 2
applied (the rest wait for their switches), imports bound with 0 missing;
a copy with one unknown field logs the one warning and still binds.

(cherry picked from commit 14b07b4)
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Changes: Profile hook parsing

Layer / File(s) Summary
Parse profiles and load hooks
crates/victory-core/src/profile.rs, docs/title-profiles.md
The parser deserializes hooks individually and logs a warning when a hook fails. load_dir uses the parser. A test checks that valid hooks remain when another hook has an unknown field. The documentation describes the behavior.

Possibly related PRs

Suggested reviewers: fxceless

Change: Bug fix

Merge Risk: Minimal · up to e0ca9

Profile loading now skips only a hook with an unrecognized field and keeps the rest of the profile. Well-formed profiles behave as before. No actionable merge risk remains.

Architecture risk: Medium · up to e0ca9

The change affects 2 systems.

Changed systems: crates, docs

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — crates (service) was modified; 1 changed file maps to changed impact.
  • observed — docs (service) was modified; 1 changed file maps to changed impact.

Before / after behavior

  • observed — Modified behavior in crates/victory-core/src/profile.rs: Added parse, which reads the profile without its hooks array, then deserializes hooks individually. Valid hooks are appended; a hook that fails deserialization is skipped with a warning naming the profile and hook (or its index-based fallback).
  • observed — Modified behavior in crates/victory-core/src/profile.rs: load_dir now parses file contents through parse instead of deserializing the entire profile at once; profile-level parse errors remain handled by the existing warning-and-skip path.
  • observed — Modified behavior in crates/victory-core/src/profile.rs: Added a test with two valid hooks surrounding a hook containing an unknown field; it asserts that only the valid hooks remain in the profile selected by for_build.
  • observed — Modified behavior in docs/title-profiles.md: The documentation adds that a hook containing a field the loader does not recognize is skipped individually with a warning naming it; the rest of the profile continues to apply. The existing statement that unmatched profiles are logged with the image’s short hash and searched directories remains.

Reliability and maintainability

  • inferred — Risk-relevant change factors for crates: blast_radius_1; direct_dependents_1
Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4f744b67-ee52-4fe2-9fcb-8b55dfa9169c
Commits

Reviewing files that changed from the base of the PR and between 1aada59 and e0ca95e.

Files selected for processing: 2

  • crates/victory-core/src/profile.rs
  • docs/title-profiles.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant