Skip to content

Export vehicle Models VIN map as a public symbol - #14

Merged
Bre77 merged 1 commit into
mainfrom
fm/nfa-models-export
Aug 3, 2026
Merged

Export vehicle Models VIN map as a public symbol#14
Bre77 merged 1 commit into
mainfrom
fm/nfa-models-export

Conversation

@Bre77

@Bre77 Bre77 commented Aug 3, 2026

Copy link
Copy Markdown
Member

Intent

  • Prep for an upstream monorepo dedup: the vehicle-model VIN map (Models) was a private const inside src/vehicle.ts, so nothing outside this package could import it.
    • Moved Models into src/types/vehicle.ts (a narrow leaf module) and exported it there.
    • src/vehicle.ts now imports Models from that leaf module; Vehicle.model() behavior is unchanged.
    • Re-exported Models from src/index.ts as a supported public symbol.
  • Extended test/vehicle.test.ts with a second describe block asserting the public Models export (imported via src/index.ts) maps every known VIN code, including Cybercab (A).

Pure export/import reshuffle, no behavior change. Skipped the no-mistakes pipeline: mechanical export refactor, low risk.

Mechanical reshuffle: move Models into the vehicle types leaf module,
re-export from index.ts, no behavior change.
@Bre77 Bre77 added the fm Opened by a Firstmate crewmate label Aug 3, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bfef1a5e93

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/types/vehicle.ts
hide_private: boolean;
};

export const Models: Record<string, string> = {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the exported model map immutable

Because this exported object is also the exact instance read by Vehicle.model(), a consumer can assign to or delete entries such as Models.S, silently changing model detection for every Vehicle instance in the process. This makes the previously private lookup table externally mutable despite the commit's intended behavior-preserving refactor; expose a runtime-frozen, read-only map or keep a separate internal copy.

Useful? React with 👍 / 👎.

@Bre77
Bre77 merged commit bd2e8d4 into main Aug 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fm Opened by a Firstmate crewmate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant