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 and .asm override handling in LanguageUtils.fill_missing_language.
  • Uses the shared normalization helper for both direct and imported heartbeat ingestion.
  • Moves Motorola 68K Assembly extension overrides into languages_custom.yml while leaving .asm mapped to Assembly.
  • Adds tests for extension lookup, alias resolution, display/color helpers, and .asm override behavior.

Confidence Score: 5/5

Safe to merge with minimal risk.

The change is narrowly scoped, covered by targeted tests, and preserves existing non-.asm language values while sharing the same normalization path for direct and imported heartbeats.

No files require special attention.

T-Rex T-Rex Logs

What T-Rex did

  • Generated the standalone validation harness that loads the real changed code and language config.
  • Recorded the attempted Rails test run and its dependency blocker in a log.
  • Ran the standalone validation and confirmed all eight LanguageUtils checks passed with exit code 0.
  • Captured input/output evidence from the executed commands in the evidence note log.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
app/lib/language_utils.rb Adds centralized fill_missing_language behavior that overrides .asm entities via filename/extension detection while preserving supplied languages otherwise.
app/services/heartbeat_ingest.rb Switches direct and imported heartbeat normalization to use the shared language fill/override helper.
config/languages_custom.yml Overrides Motorola 68K Assembly extensions so generic .asm resolves to Assembly while keeping Motorola-specific extensions mapped.
test/lib/language_utils_test.rb Adds coverage for extension detection, alias/display/color helpers, and .asm override behavior.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Client as Heartbeat client/import
participant Ingest as HeartbeatIngest
participant Lang as LanguageUtils
participant Config as languages.yml + languages_custom.yml
participant DB as Heartbeats table

Client->>Ingest: heartbeat(entity, language)
Ingest->>Lang: fill_missing_language(language, entity)
Lang->>Lang: blank/Unknown or .asm?
alt needs detection
    Lang->>Config: detect_from_filename(entity)
    Lang->>Config: detect_from_extension(entity)
    Config-->>Lang: canonical language
else keep supplied language
    Lang-->>Ingest: original language
end
Lang-->>Ingest: normalized language
Ingest->>DB: insert 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 Client as Heartbeat client/import
participant Ingest as HeartbeatIngest
participant Lang as LanguageUtils
participant Config as languages.yml + languages_custom.yml
participant DB as Heartbeats table

Client->>Ingest: heartbeat(entity, language)
Ingest->>Lang: fill_missing_language(language, entity)
Lang->>Lang: blank/Unknown or .asm?
alt needs detection
    Lang->>Config: detect_from_filename(entity)
    Lang->>Config: detect_from_extension(entity)
    Config-->>Lang: canonical language
else keep supplied language
    Lang-->>Ingest: original language
end
Lang-->>Ingest: normalized language
Ingest->>DB: insert normalized heartbeat
Loading

Reviews (5): Last reviewed commit: "Merge branch 'main' into main" | 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