Skip to content

Fail builds on app.toml parse errors instead of silently continuing#765

Merged
phinze merged 1 commit into
mainfrom
phinze/mir-1016-unknown-apptoml-fields-silently-drop-services-instead-of
Apr 15, 2026
Merged

Fail builds on app.toml parse errors instead of silently continuing#765
phinze merged 1 commit into
mainfrom
phinze/mir-1016-unknown-apptoml-fields-silently-drop-services-instead-of

Conversation

@phinze
Copy link
Copy Markdown
Contributor

@phinze phinze commented Apr 15, 2026

The build server had this pattern in two places where it loaded app.toml:

ac, err := b.loadAppConfig(tr)
if err != nil {
    b.Log.Warn("error loading app config, ignoring", "error", err)
}

Any parse error got logged and discarded, and the build continued as if no app.toml existed. Services, env vars, build config, addons -- all silently gone. The user saw a successful deploy with the wrong number of services and no indication that anything went wrong.

This bit us on a deploy where a v0.7.0 CLI sent an [aliases] section to a v0.6.1 server. DisallowUnknownFields correctly rejected the unknown field, but the error was swallowed. The app deployed with 1 service instead of 3, leading to a ~23 hour degradation and eventual outage when crash cooldown kicked in.

The fix is straightforward: return the error instead of ignoring it. The build path now also sends the parse error to the client via sendErrorStatus, so the user gets the full diagnostic (file path, line number, "did you mean?" suggestions) rather than a mysterious "no services defined" error downstream.

The build server code change itself doesn't have direct test coverage. buildFromDir is deeply wired into the Builder and hard to unit test in isolation, but we're on the cusp of breaking that whole section into a saga which will make it much more testable. In the meantime we have unit test coverage on the appconfig parsing layer confirming that unknown fields are correctly rejected, including a new version-skew scenario test added here.

Closes MIR-1016

The build server was swallowing loadAppConfig errors with a warning log
and continuing as if no app.toml existed. This meant any parse failure
(unknown fields, malformed TOML, validation errors) silently dropped
all services, env vars, and build config defined in app.toml.

In practice this hit us when a v0.7.0 CLI sent an [aliases] section
that the v0.6.1 server didn't recognize. DisallowUnknownFields fired
correctly, but the error was discarded. The deploy succeeded with 1
service instead of 3, causing a prolonged outage.

Both call sites (buildFromDir and AnalyzeApp) now return the error
instead of swallowing it. The build path also sends the error to the
client via sendErrorStatus so the user sees the actual parse diagnostic
(with file path, line numbers, and "did you mean?" suggestions).
@phinze phinze requested a review from a team as a code owner April 15, 2026 21:25
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fbcc1b91-336f-4ca2-945b-b9a560b7a55b

📥 Commits

Reviewing files that changed from the base of the PR and between f6184bb and bc88510.

📒 Files selected for processing (2)
  • appconfig/appconfig_test.go
  • servers/build/build.go

📝 Walkthrough

Walkthrough

This pull request adds a test to verify that unknown configuration fields are properly rejected during app config parsing, and modifies error handling in the build process. Previously, app config loading failures were logged as warnings and execution continued with an unchanged configuration. The changes now cause the build and analysis operations to fail fast when app config loading encounters errors, returning wrapped error messages to the client instead of proceeding with partial or nil configuration state.


Comment @coderabbitai help to get the list of available commands and usage tips.

@phinze phinze merged commit 8149629 into main Apr 15, 2026
12 checks passed
@phinze phinze deleted the phinze/mir-1016-unknown-apptoml-fields-silently-drop-services-instead-of branch April 15, 2026 23:29
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.

2 participants