Skip to content
This repository was archived by the owner on Sep 9, 2026. It is now read-only.

Make instance fake work for KSA - #34

Merged
Maximilian-Nesslauer merged 2 commits into
KSAModding:masterfrom
Maximilian-Nesslauer:ksa-fake-instance
Jul 4, 2026
Merged

Maximilian-Nesslauer merged 2 commits into
KSAModding:masterfrom
Maximilian-Nesslauer:ksa-fake-instance

Conversation

@Maximilian-Nesslauer

Copy link
Copy Markdown
Member

What

instance fake --game KSA always failed, for the two stacked reasons described in #30. This makes it work end to end; it is the client-side prerequisite for the xKAN-meta_testing step of KSP-CKAN#4457 (the metadata tester verifies mods by installing them into a fake instance).

  • FakeInstance and the CmdLine fake path normalize the requested version (build counter pinned to 0, matching how every KSA version is stored since Ignore KSA's non-monotonic build counter for version ordering #14), so the raw in-game version string (2026.6.9.4750) is accepted.
  • FakeInstance writes a minimal Content/Versions/v<year>.<month>.X.<revision>.json with the build field, which is the only on-disk version source KsaBuildVersionProvider reads (KSP2 falls back to its known-versions list, KSA does not). The faked instance now has a detectable version and passes AddInstance. The directory, file name, and body helpers live next to the provider so reader and writer share the contract, mirroring the KspBuildIdVersionProvider.buildIDfilenames precedent.

Hardening on top, from a code-review pass over the change:

  • The full KSA version including the revision is validated against the build map. Checking WithoutBuild (the pre-existing gate) would have degenerated the check to year.month for KSA and accepted revisions that never shipped.
  • The CLI rejects an unknown fully defined KSA version outright instead of letting the version selection dialog silently substitute a different known revision of the same month. For KSA the revision is the real game version, unlike the build-metadata 4th component of KSP.
  • The KSP-only --MakingHistory/--BreakingGround options are rejected for other games instead of creating bogus KSP DLC folders inside the faked instance (previously reachable for KSP2 as well).

Testing

  • New Core tests: the raw and the normalized version string both register a valid instance with the normalized version and the version file; an unknown year.month and an unknown revision within a known month throw BadGameVersionKraken.
  • New CmdLine end-to-end tests: raw version works, unknown revision fails, DLC options for KSA fail.
  • Full net10.0 test suite green; net481 builds clean.

Closes #30.

- Normalize the requested version (build counter pinned to 0) in
  FakeInstance and the CmdLine fake path, so raw in-game version strings
  like 2026.6.9.4750 are accepted
- Write a minimal Content/Versions/v<year>.<month>.X.<revision>.json with
  the build field so KsaBuildVersionProvider detects the faked version and
  the instance is valid; the path, file name, and body helpers live next
  to the provider so reader and writer share the contract
- Validate the full KSA version including the revision against the build
  map, and reject unknown fully defined versions in the CLI instead of
  silently substituting a different known revision
- Reject the KSP-only --MakingHistory/--BreakingGround options for other
  games instead of creating bogus KSP DLC folders in the faked instance
- Tests: Core fake-instance cases (raw, normalized, unknown) and CmdLine
  end-to-end cases (raw version works, unknown revision fails, DLC
  options fail)
@Maximilian-Nesslauer Maximilian-Nesslauer added bug Something isn't working enhancement New feature or request client labels Jul 4, 2026
@Maximilian-Nesslauer Maximilian-Nesslauer moved this to In Progress in CKAN-KSA Jul 4, 2026
# Conflicts:
#	Tests/CmdLine/GameInstanceTests.cs
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working client enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

instance fake always fails for KSA (fake instances lack a detectable version)

2 participants