feat(resource-value-verification): add apiserver resval trace log (task 4.2)

One logger.Debug("resource-location stored", ...) call in
OnResourceLocationUpdated, immediately after store.ResourceLocations.Put,
logging resource/host/value as zap fields. Debug-level only, matches this
package's existing logging convention (reuses convert.go's field names).

Live-confirmed against a real deployment with logging.level: debug.

Also surfaced (but did not fix, out of boundary - pure Go change, no
possible causal link) a pre-existing xce_test segfault on string-typed
resupdate (type/model) - uninitialized stack memory, non-deterministic,
invisible to ASan. Logged as bug-1574; flagged in tasks.md as a risk for
task 7.1's default resource set and task 8.1's live e2e run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-08-18 02:51:34 +00:00
parent 04ecfa5cc1
commit 8b4fbffa51
Signed by: rshen
SSH key fingerprint: SHA256:8Vf2pZ3h6rJa7EhGK+WaAQ9Mta/apZvteW6g9U/WKKk
2 changed files with 24 additions and 1 deletions

View file

@ -92,6 +92,26 @@ func (h *DefaultHandler) OnResourceUpdated(res *models.ResourceDefinitionInfo) {
func (h *DefaultHandler) OnResourceLocationUpdated(res *models.ResourceDistributionInfo) {
key := res.ResourceName + ":" + res.Location
store.ResourceLocations.Put(key, *res)
// resource-value-verification task 4.2 (Requirements 5.1, 5.2, 5.4): trace
// the stored value at its point of application, mirroring the scheduler's
// sibling trace log added in task 4.1 (core_events.c). One typed "value"
// field carrying whichever of StringValue/NumericValue/BooleanValue is
// live for res.ValueType, so a downstream grep sees exactly what was
// stored, not every possibly-zero field on the struct.
var valueField zap.Field
switch res.ValueType {
case int(models.STRING):
valueField = zap.String("value", res.StringValue)
case int(models.BOOLEAN):
valueField = zap.Bool("value", res.BooleanValue)
default:
valueField = zap.Float64("value", res.NumericValue)
}
logger.Debug("resource-location stored",
zap.String("resource", res.ResourceName),
zap.String("host", res.Location),
valueField)
}
// dispatchJobArray delivers a locally-expanded compact array push to the