Skip to content

refactor(processor): nest spectral metrics under shared model#85

Merged
flexiondotorg merged 2 commits intomainfrom
flat-measurement
May 4, 2026
Merged

refactor(processor): nest spectral metrics under shared model#85
flexiondotorg merged 2 commits intomainfrom
flat-measurement

Conversation

@flexiondotorg
Copy link
Copy Markdown
Contributor

  • Move interval and measurement spectral values into nested SpectralMetrics
  • Preserve flat spectral JSON fields for backward compatibility
  • Update adaptive, logging, and candidate consumers to read nested values
  • Add shared spectral report descriptors and stale-field guard tests

- Move interval and measurement spectral values into nested
  SpectralMetrics
- Preserve flat spectral JSON fields for backward compatibility
- Update adaptive, logging, and candidate consumers to read nested
  values
- Add shared spectral report descriptors and stale-field guard tests

Signed-off-by: Martin Wimpress <code@wimpress.io>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 23 files

Confidence score: 2/5

  • There is a high-confidence, high-severity serialization bug in internal/processor/analyzer_metrics.go: promoted MarshalJSON/UnmarshalJSON methods on embedded BaseMeasurements can cause outer measurement structs to read/write only base fields.
  • This creates concrete regression risk for metrics payloads, since non-base fields may be silently dropped during JSON marshal/unmarshal and lead to incorrect processing downstream.
  • Given the 8/10 severity and 9/10 confidence, this is likely merge-blocking until serialization behavior is corrected.
  • Pay close attention to internal/processor/analyzer_metrics.go - embedded-method promotion is likely overriding expected outer struct JSON handling.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="internal/processor/analyzer_metrics.go">

<violation number="1" location="internal/processor/analyzer_metrics.go:196">
P1: Defining MarshalJSON/UnmarshalJSON on embedded BaseMeasurements causes outer measurement structs to serialize/deserialize only base fields due to method promotion.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread internal/processor/analyzer_metrics.go
- Add explicit JSON marshal and unmarshal methods for AudioMeasurements
  and OutputMeasurements so outer fields survive serialisation.
- Keep the flat spectral_* contract intact through BaseMeasurements.
- Add regression tests for input and output field round trips.

Signed-off-by: Martin Wimpress <code@wimpress.io>
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

0 issues found across 2 files (changes from recent commits).

Requires human review: Large-scale refactor of core data models and adaptive logic across many files. Custom JSON marshaling/unmarshaling logic warrants human review to ensure API compatibility and no regressions.

@flexiondotorg flexiondotorg merged commit 37d41d6 into main May 4, 2026
16 checks passed
@flexiondotorg flexiondotorg deleted the flat-measurement branch May 4, 2026 22:46
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.

1 participant