Skip to content

Conversation

@anoadragon453
Copy link
Member

@anoadragon453 anoadragon453 commented Nov 5, 2025

Otherwise MasConfigModel would always fail to validate, as the yaml parser would not produce a FilePath instance.

Could not validate Matrix Authentication Service configuration: Input should be an instance of Path

Missed in #19071.

Pull Request Checklist

  • Pull request is based on the develop branch
  • Pull request includes a changelog file. The entry should:
    • Be a short description of your change which makes sense to users. "Fixed a bug that prevented receiving messages from other servers." instead of "Moved X method from EventStore to EventWorkerStore.".
    • Use markdown where necessary, mostly for code blocks.
    • End with either a period (.) or an exclamation mark (!).
    • Start with a capital letter.
    • Feel free to credit yourself, by adding a sentence "Contributed by @github_username." or "Contributed by [Your Name]." to the end of the entry.
  • Code style is correct (run the linters)

Otherwise `MasConfigModel` would always fail to validate, as the yaml
parser would not produce a `FilePath` instance.
@anoadragon453 anoadragon453 marked this pull request as ready for review November 5, 2025 14:00
@anoadragon453 anoadragon453 requested a review from a team as a code owner November 5, 2025 14:00
@@ -0,0 +1 @@
Fix a bug introduced in 1.142.0rc1 where any attempt to configure `matrix_authentication_service.secret_path` would prevent the homeserver from starting up. No newline at end of file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How was this problem caught?

Can we be sure it doesn't happen elsewhere? (feels like no without manually auditing things or test coverage to stress these pieces)

When having a cursory look, only this stood out to me,

class MatrixRtcConfigModel(ParseModel):
transports: list = []

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How was this problem caught?

I raised this after the CI for element-hq/ess-helm#853 started failing on RC3

Comment on lines +36 to +38
- the field's type is a `Path` or `FilePath`. Strict mode will refuse to
coerce from `str` (likely what the yaml parser will produce) to `FilePath`,
raising a `ValidationError`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kinda feels like a bug with the pydantic.FilePath type 🤔. Of course it has to be parsed from a string. Feels like it should act like Annotated[StrictStr, AfterValidator(validate_file_path)]

May be worth finding existing issues tracking this or creating one.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see both sides of the argument. On one hand, it would be a bit odd to allow coercion for one specific type (str -> FilePath) in strict mode. On the other, most people will be taking in paths as str types. There should be a simple way to validate that the file exists etc. (which is what people expect to do when setting the type of the field to FilePath).

So I agree that there's something either wrong/missing. I'll raise it as an issue in a bit while waiting for the release assets to build.

@anoadragon453
Copy link
Member Author

Failing CI tests are flake and are unrelated to this PR.

@anoadragon453 anoadragon453 merged commit 18f1d28 into release-v1.142 Nov 7, 2025
41 of 43 checks passed
@anoadragon453 anoadragon453 deleted the anoa/fix_mas_secret_path branch November 7, 2025 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants