Skip to content

feat(learning): group workloads by repository, operation and tool - #79

Merged
Dunky13 merged 2 commits into
mainfrom
dunky13/learning-groups-by-project-tool
Nov 5, 2026
Merged

Dunky13 merged 2 commits into
mainfrom
dunky13/learning-groups-by-project-tool

Conversation

@Dunky13

@Dunky13 Dunky13 commented Nov 5, 2026

Copy link
Copy Markdown
Owner

Summary

Workloads share learning within a verified repository, by operation and tool. Stacked on #78. No UI yet: the browse views come in the next PR.

 learning group key
-  directory scope + kind (only when a title named an operation)
+  repository + tool + operation (`other` is a valid operation)

 catalog
+  project and operation on every summary
+  filters: --project --operation --other-projects
+  --hierarchy: project -> operation, small projects collapse into one row

 controller, first run after upgrade
   tick
+  history pass (version 2, also on existing databases)
+    read each metadata file -> aggregate per family -> classify -> merge
+    bad record: skip
+    failure: log, retry in 10 minutes
-    failure: censor runs, hold admissions
internal/backend/
├── profiles_classification.go  # new table, vocabulary, inline scan, class and merge rules
├── profiles_regroup.go         # order-independent history pass
├── profiles_similarity.go      # classify on observation
├── profiles_learning.go        # filters, hierarchy
└── scheduler_controller.go     # non-holding pass, expiring identity cache

The classification has its own table because old clients share this database and reject unknown kinds in learning_similarity.

Evidence

Measured on a private copy of real history with the commit's binary. The live database was only read.

Before After
Profiles 1880 1433
Second preview 0 merges
Hierarchy rows 49 (48 projects + "Other projects" covering 72)
Client built from main previews and lists the regrouped database
  • Tests: core-1, core-2, ./internal/remote, test:web and lint all pass through the queue on 0b4cb02. The only commit after that adds the handoff doc.
  • Property tests: 30 seeded shuffles of the metadata give identical classes and merge plans. A pass over a corrupt file, a corrupt sidecar and a 0644 file still completes.
  • Mutations: order, alias fallback, registry-full skip, retry timing and failure holding each fail a test when broken, using go test -overlay.
  • Reviews: independent Opus reviews drove the repairs. The last small fixes (blank-field ordering, retry test, shutdown log, docs) had focused tests and mutations but no further full review.

Merge Danger

Door: one-way for grouping on an upgraded machine

The pass merges profiles in the operator's history once. An operator can split a family back out, but there is no bulk undo. Pinned profiles are untouched and the new table is additive, so older clients keep working.

Blast Radius: scheduling estimates

  • Over-budget predictions: 8 groups covering 424 families and 496 of 3,424 runs predict over the 13.6 GiB memory budget. Adaptive mode refuses these automatically until a variant has five successful runs of its own. Fixed and shadow modes are unaffected.
  • Limited reduction: about 1,291 of the 1,433 groups still hold one family, because 1,421 of 2,722 families have no verifiable repository.
  • Failure visibility: a permanently failing pass shows only in the resource controller log, because it no longer holds admissions.
  • Approximations: older env and fnm jobs count as shell and javascript. A reused path can assign a wrong repository through a stored scope.
  • Not diagnosed: "Cannot establish process identity" failed two tests once under load and passed on rerun. It comes from ownership.go, which this PR does not touch.

Full limits and next steps are in docs/handoffs/learning-grouping.md.

🤖 Generated with Claude Code

Base automatically changed from dunky13/fix-learning-measurement to main November 5, 2026 21:23
Dunky13 and others added 2 commits November 5, 2026 22:23
Learning was split across too many groups: most families had no operation,
and the group key included the relative directory. Every workload family
now has a stored classification of repository digest, tool and operation,
with `other` as the fallback, in the additive learning_classification
table. Families in one verified repository with the same operation and
recognized tool share a group, whatever subdirectory they ran in.

The classification lives in its own table because old clients share this
database and reject unknown kinds in learning_similarity. A one-time
backfill runs through the revision-checked regroup path and recovers
deleted worktrees from their stored scope. Pinned profiles stay untouched.

The pass reads each family's retained metadata as a whole, so its result does
not depend on file order. It skips bad records, and a failed pass is logged
and retried after ten minutes instead of holding admissions, because history
only improves grouping.

Inline sh -c and bash -c programs, *.sh scripts and env wrappers are
scanned for new jobs. Only the category is kept.

The catalog exposes project and operation, filters by them, and offers a
bounded project to operation hierarchy that collapses small projects into
one row, through the CLI and the authenticated HTTP route.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Marc Went <marc@went.io>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Marc Went <marc@went.io>
@Dunky13
Dunky13 force-pushed the dunky13/learning-groups-by-project-tool branch from c9f099e to 05171b9 Compare November 5, 2026 21:23
@Dunky13
Dunky13 merged commit 0f36470 into main Nov 5, 2026
38 of 40 checks passed
@Dunky13
Dunky13 deleted the dunky13/learning-groups-by-project-tool branch November 5, 2026 22:35
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