Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions apps/backend/tests/fixtures/golden/phase1_default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
{
"coreValues": {
"bpm": 135.4,
"crestFactor": 7.7,
"durationSeconds": 6.0,
"key": "A Minor",
"keyConfidence": 0.89,
"lufsIntegrated": -5.6,
"lufsMomentaryMax": -4.8,
"lufsRange": 0.8,
"lufsShortTermMax": -5.2,
"monoCompatible": true,
"plr": 6.6,
"sampleRate": 44100,
"spectralBalance.brilliance": -64.7,
"spectralBalance.highs": -62.2,
"spectralBalance.lowBass": -4.9,
"spectralBalance.lowMids": -6.1,
"spectralBalance.mids": -41.0,
"spectralBalance.subBass": -41.6,
"spectralBalance.upperMids": -53.4,
"stereoDetail.stereoCorrelation": 1.0,
"stereoDetail.stereoWidth": 0.0,
"stereoDetail.subBassCorrelation": 1.0,
"stereoDetail.subBassMono": true,
"timeSignature": "4/4",
"timeSignatureSource": "assumed_four_four",
"truePeak": 1.0
},
"topLevelKeys": [
"acidDetail",
"arrangementDetail",
"bassDetail",
"beatsLoudness",
"bpm",
"bpmAgreement",
"bpmConfidence",
"bpmDoubletime",
"bpmPercival",
"bpmRawOriginal",
"bpmSource",
"chordDetail",
"crestFactor",
"danceability",
"durationSeconds",
"dynamicCharacter",
"dynamicSpread",
"effectsDetail",
"essentiaFeatures",
"genreDetail",
"grooveDetail",
"hihatDetail",
"key",
"keyConfidence",
"keyProfile",
"kickDetail",
"lufsCurve",
"lufsIntegrated",
"lufsMomentaryMax",
"lufsRange",
"lufsShortTermMax",
"melodyDetail",
"monoCompatible",
"perceptual",
"pitchDetail",
"plr",
"reverbDetail",
"rhythmDetail",
"rhythmTimeline",
"sampleRate",
"saturationDetail",
"segmentKey",
"segmentLoudness",
"segmentSpectral",
"segmentStereo",
"sidechainDetail",
"snareDetail",
"spectralBalance",
"spectralBalanceTimeSeries",
"spectralDetail",
"stemAnalysis",
"stereoDetail",
"structure",
"supersawDetail",
"synthesisCharacter",
"textureCharacter",
"timeSignature",
"timeSignatureConfidence",
"timeSignatureSource",
"transcriptionDetail",
"transientDensityDetail",
"truePeak",
"tuningCents",
"tuningFrequency",
"vocalDetail"
],
"topLevelTypes": {
"acidDetail": "dict",
"arrangementDetail": "dict",
"bassDetail": "dict",
"beatsLoudness": "dict",
"bpm": "number",
"bpmAgreement": "bool",
"bpmConfidence": "number",
"bpmDoubletime": "bool",
"bpmPercival": "number",
"bpmRawOriginal": "number",
"bpmSource": "str",
"chordDetail": "dict",
"crestFactor": "number",
"danceability": "dict",
"durationSeconds": "number",
"dynamicCharacter": "dict",
"dynamicSpread": "number",
"effectsDetail": "dict",
"essentiaFeatures": "dict",
"genreDetail": "dict",
"grooveDetail": "dict",
"hihatDetail": "null",
"key": "str",
"keyConfidence": "number",
"keyProfile": "str",
"kickDetail": "dict",
"lufsCurve": "dict",
"lufsIntegrated": "number",
"lufsMomentaryMax": "number",
"lufsRange": "number",
"lufsShortTermMax": "number",
"melodyDetail": "dict",
"monoCompatible": "bool",
"perceptual": "dict",
"pitchDetail": "null",
"plr": "number",
"reverbDetail": "dict",
"rhythmDetail": "dict",
"rhythmTimeline": "dict",
"sampleRate": "number",
"saturationDetail": "dict",
"segmentKey": "list",
"segmentLoudness": "list",
"segmentSpectral": "list",
"segmentStereo": "list",
"sidechainDetail": "dict",
"snareDetail": "dict",
"spectralBalance": "dict",
"spectralBalanceTimeSeries": "list",
"spectralDetail": "dict",
"stemAnalysis": "null",
"stereoDetail": "dict",
"structure": "dict",
"supersawDetail": "dict",
"synthesisCharacter": "dict",
"textureCharacter": "dict",
"timeSignature": "str",
"timeSignatureConfidence": "number",
"timeSignatureSource": "str",
"transcriptionDetail": "null",
"transientDensityDetail": "dict",
"truePeak": "number",
"tuningCents": "number",
"tuningFrequency": "number",
"vocalDetail": "dict"
}
}
11 changes: 8 additions & 3 deletions apps/backend/tests/test_analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,12 +340,17 @@ def tearDownClass(cls) -> None:
cls.temp_dir.cleanup()

def test_output_schema_matches_full_mode(self) -> None:
"""Fast mode must emit the same top-level key set as full mode."""
"""Fast mode must emit exactly the shared top-level key set (EXPECTED_TOP_LEVEL_KEYS).

Full mode emits these keys *plus* a few detail-only fields (keyProfile,
tuningFrequency, tuningCents, lufsMomentaryMax, lufsShortTermMax, pitchDetail), so
this asserts the shared contract — not a byte-for-byte match with full mode.
"""
self.assertEqual(
set(self.payload.keys()),
EXPECTED_TOP_LEVEL_KEYS,
"Fast mode output schema diverged from full mode. Update EXPECTED_TOP_LEVEL_KEYS "
"if the output contract changed intentionally.",
"Fast mode output schema diverged from the shared key set. Update "
"EXPECTED_TOP_LEVEL_KEYS if the output contract changed intentionally.",
)

def test_core_fields_are_populated(self) -> None:
Expand Down
Loading