Skip to content

refactor(model): extract id generator into pkg/model/id and use uint32 for log ID - #937

Merged
kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-rurnkmruxukq
Sep 2, 2026
Merged

kyasbal merged 2 commits into
GoogleCloudPlatform:mainfrom
kyasbal:push-rurnkmruxukq

Conversation

@kyasbal

@kyasbal kyasbal commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

  • Extract ID generator and namespaces from pkg/model/khifile/v6/ids.go into dedicated pkg/model/id package.
  • Change Log.ID from string to uint32 using id.TemporaryLog (during parsing/staging) and id.Log (when serialized).
  • Require *id.Generator in khifilev6.NewBuilder.
  • Centralize context-based ID generator storage using inspectioncore_contract.IDGenerator.
  • Prioritize inspectiontest.WithDefaultTestInspectionTaskContext across tests and cookbook documentation, removing manual ID generator and builder initialization from individual test cases.
  • Update all affected tasks, parsers, and tests across backend to match the new interfaces.

Verification

  • make build-go: OK
  • make test-go: OK
  • make lint-go: OK
  • make format-go: OK
  • make pre-commit: OK

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request introduces a centralized id.Generator to replace string-based IDs with uint32 IDs, enhancing memory and disk efficiency for the KHI model. It updates the Log model, LogAccumulator, and various test suites to support this change. The reviewer suggested an optimization in LogAccumulator to use slices.Grow for more efficient slice growth.

Comment thread pkg/model/khifile/v6/log_accumulator.go Resolved
@kyasbal kyasbal added the area:backend-core Core backend frameworks, DAG task runner, and server API label Sep 2, 2026
…2 for log ID

- Extract ID generator and namespaces from pkg/model/khifile/v6 to pkg/model/id.
- Change Log.ID from string to uint32 with id.Generator.
- Require *id.Generator in khifilev6.NewBuilder.
- Use inspectioncore_contract.IDGenerator and WithDefaultTestInspectionTaskContext for context-based ID generation.
- Update all affected tasks, parsers, and unit tests across the backend.
@kyasbal
kyasbal merged commit 80d06da into GoogleCloudPlatform:main Sep 2, 2026
16 checks passed
@kyasbal
kyasbal deleted the push-rurnkmruxukq branch September 2, 2026 03:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:backend-core Core backend frameworks, DAG task runner, and server API

1 participant