Skip to content

Populate group properties - #176

Merged
grahamc merged 6 commits into
mainfrom
push-sqvzmxuokwlk
Apr 29, 2026
Merged

grahamc merged 6 commits into
mainfrom
push-sqvzmxuokwlk

Conversation

@grahamc

@grahamc grahamc commented Apr 29, 2026 •

Copy link
Copy Markdown
Member
Description
Checklist
  • Tested changes against a test repository
  • Added or updated relevant documentation (leave unchecked if not applicable)
  • (If this PR is for a release) Updated README to point to the new tag (leave unchecked if not applicable)

Summary by CodeRabbit

  • New Features

    • Emits group-identification events for GitHub organizations to surface organization-level diagnostics.
  • Bug Fixes

    • Event recording accepts nested context objects.
    • Certain diagnostic events are excluded from event-name prefixing for consistent handling.
  • Refactor

    • Internal correlation identity representation renamed and standardized; no behavioral changes for consumers.

@netlify

netlify Bot commented Apr 29, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for detsys-ts-docs ready!

Name Link
🔨 Latest commit 27b169d
🔍 Latest deploy log https://app.netlify.com/projects/detsys-ts-docs/deploys/69f28bee1b7f7500085f3802
😎 Deploy Preview https://deploy-preview-176--detsys-ts-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai

coderabbitai Bot commented Apr 29, 2026 •

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Renames exported type AnonymizedCorrelationHashes → CorrelationProperties. Updates identify() return type and replaces public exports/usages. Adds recordGroup() and calls it before main() to emit "$groupidentify" when group hash and GITHUB_REPOSITORY_OWNER exist. Broadens recordEvent() context typing to allow nested objects; adjusts event prefixing to exclude "$groupidentify".

Changes

Cohort / File(s) Summary
Type Rename
src/correlation.ts
Exported type renamed from AnonymizedCorrelationHashes → CorrelationProperties; identify() return type and constructed object updated accordingly.
Action & Event Recording
src/index.ts
Replaced usages and public export of AnonymizedCorrelationHashes with CorrelationProperties. Added recordGroup() and invoked it before main() in executeAsync() to conditionally emit a "$groupidentify" event using this.identity.$groups["github_organization"] and process.env["GITHUB_REPOSITORY_OWNER"]. Expanded recordEvent() context typing to accept nested Record<string, ...> objects and updated event-name prefixing logic to exclude "$groupidentify" (same treatment as "$feature_flag_called").

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A name hopped from hash to props today,
I call the group before we run away,
Owner and group meet — a soft hello,
I send "$groupidentify" where shadows go,
Tiny hop, telemetry on display.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Populate group properties' directly matches the main changes: migrating correlation types and adding group property recording functionality with the new recordGroup() helper.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch push-sqvzmxuokwlk

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/correlation.ts (1)

10-23: ⚠️ Potential issue | 🟠 Major

Add a compatibility alias for the renamed public type.

CorrelationProperties is exported from the package root (line 1234 of src/index.ts), making this a breaking change for downstream imports. Without a deprecated alias, consumers importing AnonymizedCorrelationHashes will experience failures. If this is not a semver-major release, add a compatibility alias:

Compatibility alias
 export type CorrelationProperties = {
   ...
 };
+export type AnonymizedCorrelationHashes = CorrelationProperties;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/correlation.ts` around lines 10 - 23, Add a deprecated compatibility
alias for the renamed type so existing consumers keep working: declare and
export a new type alias named AnonymizedCorrelationHashes =
CorrelationProperties in the same module where CorrelationProperties is defined
(src/correlation.ts) and ensure it is exported from the package root (re-export
from src/index.ts if needed); mark it as deprecated in a comment so maintainers
know to remove it in a major version.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/index.ts`:
- Around line 662-675: recordGroup currently only emits a $groupidentify for
github_organization, leaving the github_repository entry in identity.$groups
unused; update recordGroup to also check identity.$groups["github_repository"]
and the appropriate env var (process.env["GITHUB_REPOSITORY"] or repo name), and
emit a second recordEvent("$groupidentify", { $group_type: "github_repository",
$group_key: <repo_hash>, $group_set: { name: <repo_name> } }) when both values
exist, preserving the existing org emission logic (refer to recordGroup,
identity.$groups, github_organization, github_repository, and recordEvent to
locate where to add this).

---

Outside diff comments:
In `@src/correlation.ts`:
- Around line 10-23: Add a deprecated compatibility alias for the renamed type
so existing consumers keep working: declare and export a new type alias named
AnonymizedCorrelationHashes = CorrelationProperties in the same module where
CorrelationProperties is defined (src/correlation.ts) and ensure it is exported
from the package root (re-export from src/index.ts if needed); mark it as
deprecated in a comment so maintainers know to remove it in a major version.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a25ae09a-ea34-4380-82d1-9b8aeb2aa440

📥 Commits

Reviewing files that changed from the base of the PR and between 726a3af and ee36f3f.

⛔ Files ignored due to path filters (3)
  • dist/index.d.mts is excluded by !**/dist/**
  • dist/index.mjs is excluded by !**/dist/**
  • dist/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (2)
  • src/correlation.ts
  • src/index.ts

Comment thread src/index.ts Resolved
@grahamc
grahamc force-pushed the push-sqvzmxuokwlk branch from ee36f3f to c986e4f Compare April 29, 2026 22:31

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/index.ts`:
- Line 531: The recordGroup method is declared async returning
Promise<undefined> but has no await or explicit return, causing a TS mismatch;
make recordGroup synchronous by removing the async keyword and changing its
signature from async recordGroup(): Promise<undefined> to recordGroup(): void,
and update any related type annotations or callers if they expect a Promise
(adjust call sites to handle a void return instead of awaiting it).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c078bd63-58f7-4e98-926d-48cec73d0c7a

📥 Commits

Reviewing files that changed from the base of the PR and between ee36f3f and c986e4f.

⛔ Files ignored due to path filters (3)
  • dist/index.d.mts is excluded by !**/dist/**
  • dist/index.mjs is excluded by !**/dist/**
  • dist/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (1)
  • src/index.ts

Comment thread src/index.ts Resolved

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/index.ts`:
- Around line 446-450: The declared type for the context used by recordEvent is
invalid because Record only accepts two type parameters; update the context type
(the variable named context used/declared around recordEvent) so the third
Record is merged into the value union — i.e. make the value type a union that
includes primitive types and a nested Record<string, boolean | string | number |
undefined> — so the declaration becomes a single Record<string, (boolean |
string | number | undefined | Record<string, boolean | string | number |
undefined>)> and leave the initializer as {}.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 206f1cc2-1ae5-455e-8021-a31adf0e7822

📥 Commits

Reviewing files that changed from the base of the PR and between c986e4f and 7933b71.

⛔ Files ignored due to path filters (2)
  • dist/index.d.mts is excluded by !**/dist/**
  • dist/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (1)
  • src/index.ts

Comment thread src/index.ts Resolved

@coderabbitai coderabbitai 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.

♻️ Duplicate comments (1)
src/index.ts (1)

669-684: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Emit $groupidentify for github_repository as well.

At Line 670 and Line 673, this method only reports github_organization. identify() also populates identity.$groups["github_repository"], so repository group properties are still left unpopulated.

Suggested patch
   private async recordGroup(): Promise<undefined> {
     const ghorg_hash = this.identity.$groups["github_organization"];
     const ghorg_name = process.env["GITHUB_REPOSITORY_OWNER"];

     if (ghorg_hash !== undefined && ghorg_name !== undefined) {
       this.recordEvent("$groupidentify", {
         $group_type: "github_organization",
         $group_key: ghorg_hash,
         $group_set: {
           name: ghorg_name,
         },
       });
     }

+    const ghrepo_hash = this.identity.$groups["github_repository"];
+    const ghrepo_name = process.env["GITHUB_REPOSITORY"];
+
+    if (ghrepo_hash !== undefined && ghrepo_name !== undefined) {
+      this.recordEvent("$groupidentify", {
+        $group_type: "github_repository",
+        $group_key: ghrepo_hash,
+        $group_set: {
+          name: ghrepo_name,
+        },
+      });
+    }
+
     return undefined;
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/index.ts` around lines 669 - 684, recordGroup() currently only emits a
$groupidentify for github_organization; also check
identity.$groups["github_repository"] and emit a second $groupidentify for that
group: retrieve the repo group key from identity.$groups["github_repository"],
get the repository name from process.env["GITHUB_REPOSITORY"] (or extract the
repo segment if you prefer owner/repo), and call
this.recordEvent("$groupidentify", { $group_type: "github_repository",
$group_key: repo_hash, $group_set: { name: repoName } }); ensure this runs
alongside the existing github_organization logic in the same recordGroup()
method.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/index.ts`:
- Around line 669-684: recordGroup() currently only emits a $groupidentify for
github_organization; also check identity.$groups["github_repository"] and emit a
second $groupidentify for that group: retrieve the repo group key from
identity.$groups["github_repository"], get the repository name from
process.env["GITHUB_REPOSITORY"] (or extract the repo segment if you prefer
owner/repo), and call this.recordEvent("$groupidentify", { $group_type:
"github_repository", $group_key: repo_hash, $group_set: { name: repoName } });
ensure this runs alongside the existing github_organization logic in the same
recordGroup() method.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5811b45f-a555-46c4-a05f-efb0e69f7d97

📥 Commits

Reviewing files that changed from the base of the PR and between 7933b71 and 6424146.

⛔ Files ignored due to path filters (2)
  • dist/index.d.mts is excluded by !**/dist/**
  • dist/index.mjs.map is excluded by !**/dist/**, !**/*.map
📒 Files selected for processing (1)
  • src/index.ts

Comment thread src/index.ts Resolved
@grahamc
grahamc force-pushed the push-sqvzmxuokwlk branch from 151b754 to 27b169d Compare April 29, 2026 22:53

This branch was previously deployed

1 inactive deployment
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