Skip to content

Map .asm files to Assembly language#1467

Open
SeradedStripes wants to merge 7 commits into
hackclub:mainfrom
SeradedStripes:main
Open

Map .asm files to Assembly language#1467
SeradedStripes wants to merge 7 commits into
hackclub:mainfrom
SeradedStripes:main

Conversation

@SeradedStripes

@SeradedStripes SeradedStripes commented Jul 4, 2026

Copy link
Copy Markdown

Summary of the problem

Currently coding in Assembly logs it as things like TASM, RGBDS Assembly and other derivatives, where it should rather be logged as Assembly.

Describe your changes

Stopped Motorola 68K from overriding Assembly logging and always use extension detection for .asm files regardless of what language the plugin sent

This PR also does a bit of architectural improvements that I added as it was easiest

Copilot AI review requested due to automatic review settings July 4, 2026 17:58
@greptile-apps

greptile-apps Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR updates language normalization so .asm files are logged as generic Assembly. The main changes are:

  • Centralizes missing-language fallback through LanguageUtils.fill_missing_language.
  • Forces .asm entities to use entity-based detection even when plugins send an Assembly variant.
  • Moves Motorola 68K Assembly to custom extension overrides without claiming .asm.
  • Adds tests for extension detection, .asm override behavior, display names, colors, and unknown-language handling.

Confidence Score: 5/5

Safe to merge with low risk.

The change is narrowly scoped to language normalization and includes targeted tests for the new .asm behavior and related extension mappings.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • The Rails-focused test was attempted but failed because Bundler 2.3.15 cannot parse the Gemfile's platforms entry.
  • The standalone normalization validation was executed and all requested runtime cases PASS against the updated LanguageUtils code/config.
  • A before-comparison baseline showed the previous policy failed to normalize raw TASM, RGBDS Assembly, ca65, and Motorola 68K Assembly for .asm, confirming the behavioral change.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
app/lib/language_utils.rb Adds fill_missing_language logic to prefer entity-based detection for blank/unknown languages and .asm files.
app/services/heartbeat_ingest.rb Routes direct and import heartbeat language normalization through LanguageUtils.fill_missing_language.
config/languages_custom.yml Overrides Motorola 68K extension mappings so .asm remains mapped to generic Assembly while specific extensions still map to Motorola 68K Assembly.
test/lib/language_utils_test.rb Adds coverage for extension detection, canonical display names, .asm override behavior, and Motorola-specific extensions.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Plugin
participant HeartbeatIngest
participant LanguageUtils
participant LanguageMaps

Plugin->>HeartbeatIngest: heartbeat(entity, language)
HeartbeatIngest->>LanguageUtils: fill_missing_language(language, entity)
alt language blank/Unknown or entity has .asm extension
    LanguageUtils->>LanguageMaps: detect_from_filename(entity)
    LanguageMaps-->>LanguageUtils: filename match or nil
    opt no filename match
        LanguageUtils->>LanguageMaps: detect_from_extension(entity)
        LanguageMaps-->>LanguageUtils: canonical language or nil
    end
    LanguageUtils-->>HeartbeatIngest: detected language or original raw value
else language already trusted
    LanguageUtils-->>HeartbeatIngest: original language
end
HeartbeatIngest->>HeartbeatIngest: persist normalized heartbeat
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Plugin
participant HeartbeatIngest
participant LanguageUtils
participant LanguageMaps

Plugin->>HeartbeatIngest: heartbeat(entity, language)
HeartbeatIngest->>LanguageUtils: fill_missing_language(language, entity)
alt language blank/Unknown or entity has .asm extension
    LanguageUtils->>LanguageMaps: detect_from_filename(entity)
    LanguageMaps-->>LanguageUtils: filename match or nil
    opt no filename match
        LanguageUtils->>LanguageMaps: detect_from_extension(entity)
        LanguageMaps-->>LanguageUtils: canonical language or nil
    end
    LanguageUtils-->>HeartbeatIngest: detected language or original raw value
else language already trusted
    LanguageUtils-->>HeartbeatIngest: original language
end
HeartbeatIngest->>HeartbeatIngest: persist normalized heartbeat
Loading

Reviews (6): Last reviewed commit: "Commit to rerun tests as they are flakey" | Re-trigger Greptile

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to ensure .asm files are classified as canonical Assembly instead of being attributed to a more specific/competing assembly dialect during extension-based language detection.

Changes:

  • Overrides the extension_map entry for .asm to always return "Assembly".

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/lib/language_utils.rb Outdated
Comment thread app/lib/language_utils.rb Outdated
Comment thread app/lib/language_utils.rb Outdated
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.

2 participants