Skip to content

fix(function): type memory as breakdown, not a single number#5

Merged
Kikobeats merged 1 commit into
masterfrom
feat/function-memory-breakdown
Jul 23, 2026
Merged

fix(function): type memory as breakdown, not a single number#5
Kikobeats merged 1 commit into
masterfrom
feat/function-memory-breakdown

Conversation

@Kikobeats

@Kikobeats Kikobeats commented Jul 23, 2026

Copy link
Copy Markdown
Member

Why

The API now returns profiling.memory as a {total,used,heap,external} breakdown (bytes), from isolated-function >=0.2 via @browserless/function 13.6.8. The @microlink/function client still typed it as memory?: number and documented it as "Peak memory usage in MB" — both wrong now.

What

  • FunctionProfiling.memory{ total?, used?, heap?, external? } (bytes).
  • README example + field table updated to the breakdown; dropped the wrong "MB" unit.
  • Added a tsd assertion for the four fields.

Tests

tsd green, ava 17 passed.

Not touched

  • packages/core types profiling as Record<string, unknown> — already generic, no change.
  • packages/mcp describes profiling in prose only.

🤖 Generated with Claude Code


Note

Low Risk
Documentation and TypeScript declarations only; no runtime client logic changed, though consumers treating memory as a number will need to update.

Overview
Aligns @microlink/function with the API: profiling.memory is now typed and documented as a byte-level object (total, used, heap, external) instead of a single MB number.

The README profiling example and field table were updated accordingly, and tsd now asserts the four optional numeric fields on data.profiling.memory.

Reviewed by Cursor Bugbot for commit 6cba0d9. Bugbot is set up for automated code reviews on this repo. Configure here.

Summary by CodeRabbit

  • New Features

    • Function profiling now provides a detailed memory breakdown, including total, used, heap, and external memory metrics.
  • Documentation

    • Updated profiling documentation and examples to explain the new memory metrics and their units.
  • TypeScript Improvements

    • Updated type definitions to accurately represent the expanded memory profiling data.

The API now returns profiling.memory as {total,used,heap,external}
in bytes (isolated-function >=0.2 via @browserless/function 13.6.8),
not a single MB number.

Update FunctionProfiling.memory, the README table/example, and add
a tsd assertion for the four fields.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CTJQQb6p1UWdkireDjCVri
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The function profiling memory field now uses an object with optional total, used, heap, and external metrics. README examples and TypeScript compile-time assertions document and validate the updated shape.

Changes

Function profiling memory

Layer / File(s) Summary
Memory contract and validation
packages/function/src/index.d.ts, packages/function/README.md, packages/function/test/index.test-d.ts
FunctionProfiling.memory now exposes optional breakdown metrics, the README response example documents them, and type tests assert each field as number | undefined.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: FunctionProfiling.memory is now a breakdown object instead of a single number.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/function-memory-breakdown

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Kikobeats
Kikobeats merged commit 38fdb12 into master Jul 23, 2026
12 of 14 checks passed
@Kikobeats
Kikobeats deleted the feat/function-memory-breakdown branch July 23, 2026 09:07
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