Skip to content

fix(theory): render half-diminished colour romans as viiø7 (refs #52) - #68

Open
wiradifit wants to merge 1 commit into
sp80808:mainfrom
wiradifit:fix/52-half-diminished-roman-glyph
Open

wiradifit wants to merge 1 commit into
sp80808:mainfrom
wiradifit:fix/52-half-diminished-roman-glyph

Conversation

@wiradifit

@wiradifit wiradifit commented Aug 25, 2026 •

Copy link
Copy Markdown

Summary

Completes the remaining acceptance criterion of #52.

The out-of-range crash itself (unconditional pcs[5] indexing in the tension layer) is already resolved on main — that layer now looks sectors up by heptatonic degree with optional bindings, and I confirmed there are no unguarded pcs[N] subscripts left in HarmonicWheel.swift. This PR fixes the issue's second checklist item:

Colour-layer roman numeral for vii renders vii°7 — should be viiø7

WheelDegreeBuilder.colourQuality correctly maps the diminished degree to .halfDiminished7, but the roman-numeral builder appended a plain "7" to every non-.major7 quality, producing vii°7 — the glyph for a fully diminished seventh.

Changes

  • Sources/XPadTheory/HarmonicWheel.swift — the colour-layer roman closure now switches on chord quality:
    • .major7 → <roman>maj7 (unchanged)
    • .halfDiminished7 → strips the trailing ° from the degree roman and appends ø7 → viiø7
    • everything else → <roman>7 (unchanged)
  • Tests/XPadTheoryTests/HarmonicWheelPentatonicTests.swift (new) — regression coverage for both halves of HarmonicWheel tension layer indexes pcs[5] unconditionally — crash on pentatonic scales #52:
    • pentatonicMajor, pentatonicMinor, and blues construct through ordinary public API without trapping
    • heptatonic scales still construct
    • the C-major colour layer contains a half-diminished vii whose roman numeral equals viiø7
    • dominant-seventh romans remain V7

Verification

Focused suite executed on Linux (Swift 6.2 toolchain, pure-Swift theory modules only):

Test Suite 'HarmonicWheelPentatonicTests' passed
   Executed 4 tests, with 0 failures (0 unexpected)

The UI/MIDI/audio modules require Apple frameworks, so the full-package swift test run belongs to this repo's macOS CI workflow per CONTRIBUTING.md.

Refs #52

Summary by Sourcery

Correct half-diminished colour roman-numeral notation and protect harmonic-wheel construction and rendering with regression tests.

Bug Fixes:

  • Render half-diminished colour-layer vii chords as viiø7 instead of the fully diminished vii°7 notation.

Tests:

  • Add regression coverage for constructing pentatonic, blues, and heptatonic harmonic wheels, along with half-diminished and dominant-seventh roman numeral rendering.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@sourcery-ai

sourcery-ai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

The PR updates colour-layer roman numeral generation to render half-diminished vii as viiø7 while preserving existing major-seventh and dominant-seventh output, and adds regression coverage for the glyph fix and construction of wheels from scales with fewer than seven pitch classes.

Sequence diagram for half-diminished vii roman generation

sequenceDiagram
    participant Wheel as HarmonicWheel
    participant Builder as WheelDegreeBuilder
    participant Roman as Colour roman closure
    Wheel->>Roman: build(spec)
    Roman->>Builder: colourQuality(for: spec, isMinor: isMinor)
    Builder-->>Roman: halfDiminished7
    Roman->>Roman: String(spec.roman.dropLast())
    Roman-->>Wheel: viiø7
Loading

Flow diagram for colour-layer roman numeral rendering

flowchart TD
    S[Colour layer spec] --> Q[WheelDegreeBuilder.colourQuality]
    Q --> M{Chord quality}
    M -->|major7| A[Return roman + maj7]
    M -->|halfDiminished7| B[Remove trailing degree symbol]
    B --> C[Return base + ø7]
    M -->|other| D[Return roman + 7]
Loading

File-Level Changes

Change Details Files
Corrected colour-layer roman numeral rendering for half-diminished seventh chords.
  • Added quality-specific rendering for major seventh, half-diminished seventh, and other seventh chords.
  • Replaced the trailing fully diminished glyph with ø before appending 7 for half-diminished chords.
Sources/XPadTheory/HarmonicWheel.swift
Added regression tests covering sub-heptatonic construction and seventh-chord roman numeral output.
  • Verified pentatonic and blues wheels construct without trapping, alongside heptatonic wheels.
  • Asserted C-major colour vii renders as viiø7.
  • Asserted dominant seventh remains V7.
Tests/XPadTheoryTests/HarmonicWheelPentatonicTests.swift

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@wiradifit
wiradifit force-pushed the fix/52-half-diminished-roman-glyph branch from d2e8c5d to f8dc574 Compare August 25, 2026 12:34
Colour-layer roman numerals appended a plain '7' to every non-major7
quality, so the leading-tone sector rendered 'vii°7' — the fully-
diminished glyph — despite mapping to .halfDiminished7. The builder now
switches on chord quality and emits 'viiø7' for half-diminished chords,
leaving maj7 and plain-7 romans untouched.

Adds regression coverage for issue sp80808#52: sub-heptatonic scales
(pentatonic major/minor, blues) construct through public API without
trapping now that the tension layer is degree-keyed, heptatonics still
construct, and the ø glyph is asserted.
@wiradifit
wiradifit force-pushed the fix/52-half-diminished-roman-glyph branch from f8dc574 to 4979453 Compare August 25, 2026 12:39
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