| index 89b500c98..55669f900 100644 |
| --- a/internal/appconfig/syncexec.go |
| +++ b/internal/appconfig/syncexec.go |
| @@ -725,22 +725,24 @@ func SyncExecWithCallbacks(ctx context.Context, reg *registry.Registry, s releas |
| continue // nothing was ever staged for this route: nothing to warn about |
| } |
| fmt.Printf(" %s: exec_delivery is off (or was never set) but %s still exists from an earlier opt-in — it holds DECRYPTED secrets and carlos will never update or remove it while this app stays un-opted-in; delete it by hand once the app's own supervisor has stopped reading it\n", rt.Host, path) |
| - case Stamped(rt): |
| + case stampedForDelivery(rt): |
| // A route can gain a unit stamp AFTER exec delivery already |
| // staged this file (the test above this comment's home, |
| // TestSyncExecLeavesAStampedRoutesOldFileAlone, does exactly |
| // that): execAddrCandidate excludes it the moment it is |
| // stamped, so the opt-out branch above never sees it again and |
| // stays silent forever. The same "frozen, not updated" fact is |
| - // true here for a different reason — the unit's drop-in now |
| - // owns EnvironmentFile, so nothing even reads this file — and |
| - // it deserves the same one-line-per-pass notice rather than |
| - // silence. |
| + // true here and deserves the same one-line-per-pass notice. |
| + // What this line does NOT claim is that nothing reads the file: |
| + // a unit still loading it is exactly what the root pass's |
| + // unmanaged-file guard refuses (unitsync.go, planStamped), and |
| + // the stamp alone is no evidence the unit moved off it (review |
| + // round 1 P2-7). |
| path := ConfigEnvPath(dataDir, rt) |
| if _, err := os.Stat(path); err != nil { |
| continue // nothing was ever staged for this route: nothing to warn about |
| } |
| - fmt.Printf(" %s: %s is from before this route named its unit; nothing reads it now (the unit's drop-in resets its EnvironmentFile list) and carlos will never update or remove it — delete it once you are satisfied\n", rt.Host, path) |
| + fmt.Printf(" %s: %s was written by exec delivery before this route named its unit; exec delivery has stopped updating it and carlos will never remove it. Check what still reads it before deleting it\n", rt.Host, path) |
| } |
| } |
| // An empty route list is never authority to delete anything — |
| @@ -1089,24 +1091,28 @@ func (r RestartPending) Empty() bool { |
| } |
| |
| // BlockedStamps applies the door-side rails to the stamped routes of |
| -// (acct, app) in routes. Uniqueness is checked against the FULL list |
| -// regardless of envName, so a route of another account or another |
| +// (acct, app) in routes, the routes planStamped would deliver |
| +// (stampedForDelivery, the one classification for delivery and its |
| +// notices; review round 1 P2-4). Uniqueness is checked against the FULL |
| +// list regardless of envName, so a route of another account or another |
| // environment still blocks this one's unit — but only this account's |
| // hosts are returned, no other account's host is named in a reason, and |
| // (spec §3.4: "the same environment and account narrowing applies as for |
| // Hosts") only routes bound to envName ("" = every route of the app) are |
| // returned, so a write to one environment does not report a blocked route |
| -// it never reached. |
| +// it never reached. Owned-environment reachability is AwaitingRestart's |
| +// (it needs the bundle), which is why the notice applies it before taking |
| +// a host from here. |
| func BlockedStamps(routes []registry.Route, acct, app, envName string) []BlockedHost { |
| byUnit := map[string]int{} |
| for _, rt := range routes { |
| - if Stamped(rt) && StampShape(rt) == nil && DeliverableUnitName(rt.Unit) == nil && BareHostname(rt.Host) { |
| + if stampedForDelivery(rt) && StampShape(rt) == nil && DeliverableUnitName(rt.Unit) == nil && BareHostname(rt.Host) { |
| byUnit[rt.Unit]++ |
| } |
| } |
| var out []BlockedHost |
| for _, rt := range routes { |
| - if !Stamped(rt) || rt.App != app || release.RouteAccount(rt) != acct { |
| + if !stampedForDelivery(rt) || rt.App != app || release.RouteAccount(rt) != acct { |
| continue |
| } |
| if envName != "" && rt.Environment != envName { |
| @@ -1156,10 +1162,13 @@ func BlockedStamps(routes []registry.Route, acct, app, envName string) []Blocked |
| // short list read as a complete one. |
| func AwaitingRestart(ctx context.Context, s release.Store, routes []registry.Route, acct, app, envName string, keys []string) RestartPending { |
| var out RestartPending |
| - out.Blocked = BlockedStamps(routes, acct, app, envName) |
| - blocked := map[string]bool{} |
| - for _, b := range out.Blocked { |
| - blocked[b.Host] = true |
| + // The door-side rails over the full box list; a blocked host is |
| + // reported only once the loop below has established that this write |
| + // reaches it (environment narrowing, and an owned environment's |
| + // standalone boundary; review round 1 P2-5). |
| + blocked := map[string]string{} |
| + for _, b := range BlockedStamps(routes, acct, app, envName) { |
| + blocked[b.Host] = b.Reason |
| } |
| // The instance layer, through the same loader the sweeps use, so this |
| // notice and the pass that writes the files agree about what sits above |
| @@ -1198,7 +1207,7 @@ func AwaitingRestart(ctx context.Context, s release.Store, routes []registry.Rou |
| return e |
| } |
| for _, rt := range routes { |
| - stamped := Stamped(rt) && !blocked[rt.Host] |
| + stamped := stampedForDelivery(rt) |
| if (!execAddrCandidate(rt) && !stamped) || rt.App != app || release.RouteAccount(rt) != acct { |
| continue |
| } |
| @@ -1214,6 +1223,26 @@ func AwaitingRestart(ctx context.Context, s release.Store, routes []registry.Rou |
| def := loadDefault |
| if rt.Environment != "" { |
| eb = loadEnv(rt.Environment) |
| + // An OWNED environment is standalone (team-scoped credentials |
| + // §3): a default-bundle write reaches none of its routes, and |
| + // its opt-in never inherits the default bundle's. Decided |
| + // before the blocked notice, which is about routes the write |
| + // reaches; a bundle that cannot be read decides nothing here. |
| + if eb.err == nil && eb.found && eb.m.Owned() { |
| + if envName == "" { |
| + continue |
| + } |
| + def = standaloneDefault |
| + } |
| + } |
| + // Blocked is decided before bundle resolution (spec §3.4): a route |
| + // the root pass will refuse is reported as blocked, not as healthy |
| + // and not as unresolved. |
| + if reason, bad := blocked[rt.Host]; bad { |
| + out.Blocked = append(out.Blocked, BlockedHost{Host: rt.Host, Reason: reason}) |
| + continue |
| + } |
| + if rt.Environment != "" { |
| if eb.err != nil { |
| out.Unresolved = append(out.Unresolved, rt.Host) |
| continue |
| @@ -1227,15 +1256,6 @@ func AwaitingRestart(ctx context.Context, s release.Store, routes []registry.Rou |
| out.Unresolved = append(out.Unresolved, rt.Host) |
| continue |
| } |
| - // An OWNED environment is standalone (team-scoped credentials |
| - // §3): a default-bundle write reaches none of its routes, and |
| - // its opt-in never inherits the default bundle's. |
| - if eb.m.Owned() { |
| - if envName == "" { |
| - continue |
| - } |
| - def = standaloneDefault |
| - } |
| } |
| v, err := resolveExecDelivery(eb.m, eb.found, def) |
| if err != nil { |
| @@ -1243,10 +1263,15 @@ func AwaitingRestart(ctx context.Context, s release.Store, routes []registry.Rou |
| continue |
| } |
| // A stamped route is delivered and restarted by the root pass within |
| - // seconds of this write; it has nothing to be told about unless its |
| - // bundle would not resolve, which the checks above have already |
| - // reported (spec §3.4, codex R1-8). |
| + // seconds of this write; it has nothing to be told about unless a |
| + // layer it is rendered from would not resolve. The bundles were |
| + // checked above; the instance overlay is checked here, because the |
| + // root pass loads it for a stamped route and refuses delivery when |
| + // it will not read (sync.go; review round 1 P2-6). |
| if stamped { |
| + if _, _, instErr := overlayFor(acct, app, rt.Host); instErr != nil { |
| + out.Unresolved = append(out.Unresolved, rt.Host) |
| + } |
| continue |
| } |
| // Not opted in — including the Unknown case, which decides "off" — |
| @@ -1291,6 +1316,7 @@ func AwaitingRestart(ctx context.Context, s release.Store, routes []registry.Rou |
| // across passes, where registry order is not. Same discipline as |
| // ExecConfigApps'. |
| sort.Slice(out.Hosts, func(i, j int) bool { return out.Hosts[i].Host < out.Hosts[j].Host }) |
| + sort.Slice(out.Blocked, func(i, j int) bool { return out.Blocked[i].Host < out.Blocked[j].Host }) |
| sort.Strings(out.Unresolved) |
| sort.Strings(out.Undelivered) |
| return out |