Skip to content

feat(speculation): add speculation tree builder with power set path generation#87

Closed
behinddwalls wants to merge 1 commit into
mainfrom
preetam/speculation
Closed

feat(speculation): add speculation tree builder with power set path generation#87
behinddwalls wants to merge 1 commit into
mainfrom
preetam/speculation

Conversation

@behinddwalls
Copy link
Copy Markdown
Collaborator

@behinddwalls behinddwalls commented Feb 25, 2026

Summary

  • Introduce SpeculationPath entity with explicit Base/Head fields, replacing SpeculationPathInfo in Build and the flat []string in SpeculationInfo
  • Add SpeculationPathAction enum values: schedule, cancel, land
  • Implement GenerateTree in core/speculation that produces 2^N speculation paths via bitmask power set enumeration, sorted most-optimistic first
  • Wire GenerateTree into the speculate controller (empty deps for now, to be extended when batch controller provides dependencies)

Test plan

  • Table-driven tests covering 0, 1, 2, 3 dependencies (power set correctness)
  • Ordering test: most-optimistic (most predecessors) first
  • All paths initialized with action=schedule, score=0
  • Input immutability test (caller's slice not mutated)
  • Head always equals currentID test
  • Existing speculate controller tests still pass
  • make gazelle && make test — all 20 tests pass

@behinddwalls behinddwalls requested review from a team and sbalabanov as code owners February 25, 2026 23:56
…eneration

Why:
The speculate controller had a TODO stub with no speculation logic.
We need the core algorithm that generates all possible futures for a
batch based on its predecessors to enable speculative builds.

What:
- Add SpeculationPath entity with explicit Base/Head fields, replacing
  the flat []string path and removing SpeculationPathInfo from Build
- Add SpeculationPathAction enum values: schedule, cancel, land
- Implement GenerateTree in core/speculation that produces 2^N paths
  via bitmask power set enumeration, sorted most-optimistic first
- Wire GenerateTree into the speculate controller (empty deps for now)
@behinddwalls behinddwalls deleted the preetam/speculation branch February 26, 2026 01:44
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