• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nestjs / nest / 5701a038-06d9-4ede-b2c1-e14b62c40556

11 Aug 2025 09:12PM UTC coverage: 88.736% (+0.002%) from 88.734%
5701a038-06d9-4ede-b2c1-e14b62c40556

Pull #15526

circleci

web-flow
fix: prevent stack overflow with snapshot enabled

The most lazy fix I could think of to prevent the stack overflow during search for the next id. It will not help with the ever-increasing registry size and slowness with snapshot enabled in the application until you grab the next snapshot, but it will prevent the stack overflow if the search goes too deep.

Feel free to fix it another way if you're dissatisfied with this band-aid. Just wanted to highlight the issue.
Pull Request #15526: fix(core): prevent stack overflow with snapshot enabled

2725 of 3454 branches covered (78.89%)

3 of 4 new or added lines in 1 file covered. (75.0%)

7271 of 8194 relevant lines covered (88.74%)

16.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.31
/packages/core/inspector/deterministic-uuid-registry.ts
1
export class DeterministicUuidRegistry {
1✔
2
  private static readonly registry = new Map<string, boolean>();
1✔
3

4
  static get(str: string) {
5
    let id = this.hashCode(str);
7✔
6
    let inc = 0;
7✔
7
    while (this.registry.has(id)) {
7✔
NEW
8
      id = this.hashCode(`${str}_${++inc}`);
×
9
    }
10
    this.registry.set(id, true);
7✔
11
    return id;
7✔
12
  }
13

14
  static clear() {
15
    this.registry.clear();
31✔
16
  }
17

18
  private static hashCode(s: string) {
19
    let h = 0;
7✔
20
    for (let i = 0; i < s.length; i++)
7✔
21
      h = (Math.imul(31, h) + s.charCodeAt(i)) | 0;
2,171✔
22
    return h.toString();
7✔
23
  }
24
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc