Skip to content

Sync merge validates config but does not reliably apply live role/workflow/provider definitions #303

@michaelw

Description

@michaelw

Summary

Incoming config from MergeConfiguration is validated/normalized, but new and updated role/workflow/provider definitions do not reliably become the live in-memory config.

This appears to originate in 38739ebd (making progress on config diffs). The intent in that commit and later follow-ups (9f84556, 709f9738) appears to be to apply incoming synced config immediately, but the live config does not reflect those changes.

Why this looks like a bug rather than intended behavior

  • RegisterWithThandServer calls MergeConfiguration(registration) and then returns; there is no later persistence step that would justify discarding the normalized result.
  • The naming and comments in the sync path read as though incoming config should be applied, not merely validated.
  • git log upstream/main..origin/mw/main -- internal/config/sync.go is empty, so this does not appear to come from fork-only integration work.

Minimal repro

I copied focused regression tests into an untouched upstream/main worktree and ran:

go test ./internal/config -run 'TestMergeConfiguration_(ServerSends(New|Updated)(Roles|Workflow|Provider)s?|PartialConfig_OnlyRoles)|TestApplyPatch_AppliesRoles'

Focused failing tests:

  • TestMergeConfiguration_ServerSendsNewRoles
  • TestMergeConfiguration_ServerSendsNewWorkflows
  • TestMergeConfiguration_ServerSendsUpdatedWorkflow
  • TestMergeConfiguration_ServerSendsNewProviders
  • TestMergeConfiguration_ServerSendsUpdatedProvider
  • TestMergeConfiguration_PartialConfig_OnlyRoles
  • TestApplyPatch_AppliesRoles

Representative failing output:

--- FAIL: TestMergeConfiguration_ServerSendsNewRoles (0.00s)
    sync_test.go:172:
        Messages:    expected synced role to be stored locally
--- FAIL: TestMergeConfiguration_ServerSendsNewWorkflows (0.00s)
    sync_test.go:230:
        Messages:    expected synced workflow to be stored locally
--- FAIL: TestMergeConfiguration_ServerSendsUpdatedWorkflow (0.07s)
    sync_test.go:264:
        expected: "Updated workflow"
        actual  : "Existing workflow"
--- FAIL: TestMergeConfiguration_ServerSendsNewProviders (0.00s)
    sync_test.go:288:
        Messages:    expected synced provider to be stored locally
--- FAIL: TestMergeConfiguration_ServerSendsUpdatedProvider (0.06s)
    sync_test.go:322:
        expected: "Updated provider description"
        actual  : "Old provider description"
--- FAIL: TestApplyPatch_AppliesRoles (0.00s)
    sync_test.go:618:
        Error:       map[string]models.Role(nil) does not contain "new-role"

Analysis

The likely failure mode is that the sync path computes merged/normalized definitions but does not reliably commit them back onto the live config object, and updated entries can also be reduced to ineffective partial typed state before apply.

Scope

This issue is only about the sync path failing to apply incoming config into live in-memory definitions.

Please keep separate from:

  • stale-snapshot/lost-update concurrency in the sync path
  • broader lock-discipline cleanup across config readers/writers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions