Repair Void movement coverage tracking

This commit is contained in:
Meta Vens 2026-07-08 21:44:02 +01:00
commit a2755cd025
5 changed files with 193 additions and 6 deletions

View file

@ -386,13 +386,15 @@ function enrichCommit(repoPath, commit) {
.map((line) => line.trim())
.filter(Boolean);
const summaryLine = statLines.find((line) => /files? changed|insertions?|deletions?/.test(line));
const changedPaths = statLines.filter((line) => !/files? changed|insertions?|deletions?/.test(line)).slice(0, 8);
const allChangedPaths = statLines.filter((line) => !/files? changed|insertions?|deletions?/.test(line));
const changedPaths = allChangedPaths.slice(0, 12);
return {
...commit,
diffstat: parseDiffstat(summaryLine),
changedPaths,
contentHints: buildCommitContentHints(repoPath, commit.hash, changedPaths),
doctrineDocuments: buildDoctrineDocuments(repoPath, commit.hash, allChangedPaths, commit.subject),
};
} catch {
return {
@ -412,10 +414,65 @@ function buildCommitContentHints(repoPath, commitHash, changedPaths) {
.filter(Boolean);
}
function buildDoctrineDocuments(repoPath, commitHash, changedPaths, subject) {
const doctrinePaths = changedPaths
.filter((path) => isDoctrineDocumentPath(path, subject))
.slice(0, 4);
return doctrinePaths
.map((path) => buildDoctrineDocument(repoPath, commitHash, path))
.filter(Boolean);
}
function isHintableTextPath(path) {
return /\.(md|mdx|txt|json|jsonc|ya?ml|toml|ts|tsx|js|jsx|mjs|cjs|rs|cs|ps1|py|html|css|scss)$/i.test(path);
}
function isDoctrineDocumentPath(path, subject) {
if (!/\.(md|mdx|txt)$/i.test(path)) {
return false;
}
const normalized = path.replace(/\\/g, "/");
const pathLooksDoctrinal =
/(^|\/)(readme|docs?|notes|architecture|design|worldbuilding|lore|reference)\b/i.test(normalized) ||
/(architecture|doctrine|authority|policy|contract|conformance|ownership|lowering|renderless|runtime|daemon|cultmesh|eve|verse|client|surface|custody)/i.test(normalized);
const subjectLooksDoctrinal =
/(architecture|doctrine|authority|policy|contract|conformance|ownership|lowering|renderless|runtime|daemon|cultmesh|eve|verse|client|surface|custody)/i.test(subject ?? "");
return pathLooksDoctrinal || subjectLooksDoctrinal;
}
function buildDoctrineDocument(repoPath, commitHash, path) {
const currentText = readCommittedFile(repoPath, commitHash, path);
if (!currentText.trim()) {
return undefined;
}
const addedLines = readAddedLines(repoPath, commitHash, path);
const headings = readMarkdownHeadings(currentText).slice(0, 8);
const committedExcerpt = compactDoctrineExcerpt(currentText);
return {
path,
headings,
addedExcerpts: addedLines
.filter((line) => line.trim().length > 0 && !line.trim().startsWith("---"))
.slice(0, 16),
committedExcerpt,
};
}
function compactDoctrineExcerpt(text) {
const lines = text
.split(/\r?\n/)
.map((line) => line.trimEnd())
.filter((line) => line.trim().length > 0)
.slice(0, 160);
const excerpt = lines.join("\n");
return excerpt.length > 6000 ? `${excerpt.slice(0, 6000).trimEnd()}\n[...]` : excerpt;
}
function buildFileContentHint(repoPath, commitHash, path) {
const currentText = readCommittedFile(repoPath, commitHash, path);
const addedLines = readAddedLines(repoPath, commitHash, path);

View file

@ -602,6 +602,7 @@ function Project-RepoCommitForRumination {
$hash = Get-ObjectPropertyString -Value $Commit -Name "hash"
$contentHints = @(Convert-ToValueArray -Value (Get-ObjectPropertyValue -Value $Commit -Name "contentHints"))
$doctrineDocuments = @(Convert-ToValueArray -Value (Get-ObjectPropertyValue -Value $Commit -Name "doctrineDocuments"))
$authoredPublicArtifacts = @(Get-VoidAuthoredArtifactsFromContentHints -ContentHints $contentHints)
return @{
hash = if ($hash -and $hash.Length -gt 12) { $hash.Substring(0, 12) } else { $hash }
@ -611,10 +612,42 @@ function Project-RepoCommitForRumination {
diffstat = Get-ObjectPropertyValue -Value $Commit -Name "diffstat"
changedPaths = @(Convert-ToValueArray -Value (Get-ObjectPropertyValue -Value $Commit -Name "changedPaths"))
contentHints = $contentHints
doctrineDocuments = $doctrineDocuments
authoredPublicArtifacts = $authoredPublicArtifacts
}
}
function Test-RepoHasDoctrineDocument {
param($Repo)
$commits = @(Convert-ToValueArray -Value (Get-ObjectPropertyValue -Value $Repo -Name "commits"))
foreach ($commit in $commits) {
$doctrineDocuments = @(Convert-ToValueArray -Value (Get-ObjectPropertyValue -Value $commit -Name "doctrineDocuments"))
if ($doctrineDocuments.Count -gt 0) {
return $true
}
}
return $false
}
function Test-RepoIsMovementCoverageLeader {
param($Repo)
$recent = Get-ObjectPropertyValue -Value $Repo -Name "recentCommitCount"
$windowRecent = Get-ObjectPropertyValue -Value $Repo -Name "windowRecentCommitCount"
if ((Test-RepoHasDoctrineDocument -Repo $Repo) -or (Test-RepoHasVoidAuthoredArtifact -Repo $Repo)) {
return $true
}
return (
$null -ne $recent -and [int]$recent -ge 3
) -or (
$null -ne $windowRecent -and [int]$windowRecent -ge 6
)
}
function Test-RepoHasVoidAuthoredArtifact {
param($Repo)
@ -654,8 +687,14 @@ function Select-RuminationRepoActivity {
} |
Sort-Object -Property @{
Expression = { if (Test-RepoHasVoidAuthoredArtifact -Repo $_) { 0 } else { 1 } }
}, @{
Expression = { if (Test-RepoIsMovementCoverageLeader -Repo $_) { 0 } else { 1 } }
}, @{
Expression = { if (Test-RepoHasDoctrineDocument -Repo $_) { 0 } else { 1 } }
}, @{
Expression = { -[int](Get-ObjectPropertyValue -Value $_ -Name "recentCommitCount") }
} |
Select-Object -First 8
Select-Object -First 12
)
$projectedRepos = @(
$freshRepos | ForEach-Object {
@ -680,6 +719,26 @@ function Select-RuminationRepoActivity {
generated = Project-RelativeTimestamp -Value $RepoActivity -Name "generatedAt" -Now $Now
cursorMode = Get-ObjectPropertyString -Value $RepoActivity -Name "cursorMode"
summary = if ($projectedRepos.Count -gt 0) { "New tracked repo commits crossed the saved repo-activity cursor." } else { "No new tracked repo commits crossed the saved repo-activity cursor." }
movementCoverage = @{
job = "Keep people apace of meaningful movement, not merely the latest commit. Coverage priority follows where the current movement is: heavy fresh commit volume, doctrine-bearing documents, authored public artifacts, or operator-named active lanes."
freshMovementLeaders = @(
$projectedRepos |
Where-Object {
Test-RepoIsMovementCoverageLeader -Repo $_
} |
ForEach-Object {
@{
repoName = Get-ObjectPropertyString -Value $_ -Name "repoName"
recentCommitCount = Get-ObjectPropertyValue -Value $_ -Name "recentCommitCount"
windowRecentCommitCount = Get-ObjectPropertyValue -Value $_ -Name "windowRecentCommitCount"
hasDoctrineDocuments = Test-RepoHasDoctrineDocument -Repo $_
latestSubject = Get-ObjectPropertyString -Value (Get-ObjectPropertyValue -Value $_ -Name "latestCommit") -Name "subject"
}
}
)
currentExamples = @("Aetheria", "AetheriaLore", "CultLib", "Eve", "Odin")
coverageRule = "If a fresh movement leader has doctrine, authority, runtime, client, CultMesh, or public-artifact work, read the doctrineDocuments/contentHints and either queue a coverage candidate or preserve a short-term memory explaining the new direction. If tomorrow's movement is Fensalir, Mimir, or another lane, it earns the same treatment. Do not let a repo cursor advance for movement the pass did not actually handle."
}
freshRepos = $projectedRepos
}
}

View file

@ -269,21 +269,35 @@ function Invoke-CodexExec {
function Get-RepoActivityCursorOperations {
param(
$RepoActivity,
[DateTime] $ObservedAt
[DateTime] $ObservedAt,
[string[]] $HandledRepoIds = @()
)
if ($null -eq $RepoActivity) {
return @()
}
$handledLookup = @{}
foreach ($repoId in @($HandledRepoIds)) {
if (-not [string]::IsNullOrWhiteSpace($repoId)) {
$handledLookup[$repoId.Trim().ToLowerInvariant()] = $true
}
}
if ($handledLookup.Count -eq 0) {
return @()
}
$repos = @(Convert-ToValueArray -Value (Get-ObjectPropertyValue -Value $RepoActivity -Name "repos"))
return @(
$repos |
Where-Object {
$repoName = Get-ObjectPropertyString -Value $_ -Name "repoName"
$repoStatus = Get-ObjectPropertyString -Value $_ -Name "status"
$recentCount = Get-ObjectPropertyValue -Value $_ -Name "recentCommitCount"
$latestCommit = Get-ObjectPropertyValue -Value $_ -Name "latestCommit"
$repoStatus -eq "ok" -and
-not [string]::IsNullOrWhiteSpace($repoName) -and
$handledLookup.ContainsKey($repoName.Trim().ToLowerInvariant()) -and
$repoStatus -eq "ok" -and
$null -ne $recentCount -and
[int]$recentCount -gt 0 -and
$null -ne $latestCommit -and
@ -304,6 +318,43 @@ function Get-RepoActivityCursorOperations {
)
}
function Get-HandledRepoIdsFromOperations {
param($Operations)
$repoIds = New-Object System.Collections.Generic.HashSet[string]
foreach ($operation in @(Convert-ToValueArray -Value $Operations)) {
if ($null -eq $operation) {
continue
}
foreach ($propertyName in @("memory", "intervention", "pressure", "need", "bond", "statusRead")) {
$payload = Get-ObjectPropertyValue -Value $operation -Name $propertyName
if ($null -eq $payload) {
continue
}
$target = Get-ObjectPropertyValue -Value $payload -Name "target"
$targetKind = Get-ObjectPropertyString -Value $target -Name "kind"
$targetId = Get-ObjectPropertyString -Value $target -Name "id"
if ($targetKind -eq "repo" -and -not [string]::IsNullOrWhiteSpace($targetId)) {
[void]$repoIds.Add($targetId.Trim())
}
foreach ($tag in @(Convert-ToValueArray -Value (Get-ObjectPropertyValue -Value $payload -Name "tags"))) {
$tagText = ([string]$tag).Trim()
if ($tagText.StartsWith("repo:", [System.StringComparison]::OrdinalIgnoreCase)) {
$repoTag = $tagText.Substring("repo:".Length).Trim()
if (-not [string]::IsNullOrWhiteSpace($repoTag)) {
[void]$repoIds.Add($repoTag)
}
}
}
}
}
return @($repoIds)
}
function Invoke-NodeJson {
param(
[Parameter(Mandatory = $true)]
@ -1407,7 +1458,7 @@ if ($ModerationHeartbeatOnly) {
$repoActivity = Invoke-NodeJson -Arguments @(
$repoActivityScriptPath,
"--hours", "96",
"--max-commits", "3",
"--max-commits", "8",
"--read-only",
"--state-path", $stateFilePath
)
@ -1623,7 +1674,13 @@ if (
$repoCursorOperations = @()
$disableRepoCursorAdvance = -not [string]::IsNullOrWhiteSpace($env:VOID_RUMINATION_DISABLE_REPO_CURSOR_ADVANCE)
if (-not $ModerationHeartbeatOnly -and -not $NoPost -and -not $SkipModel -and -not $disableRepoCursorAdvance) {
$repoCursorOperations = @(Get-RepoActivityCursorOperations -RepoActivity $repoActivity -ObservedAt ([DateTime]::UtcNow))
$handledRepoIds = @(Get-HandledRepoIdsFromOperations -Operations $proposedOperations)
if ($handledRepoIds.Count -gt 0) {
Append-RunLog ("repo activity handled by operations: {0}" -f ($handledRepoIds -join ", "))
} else {
Append-RunLog "repo activity cursor advance skipped: no proposed operation handled a repo target."
}
$repoCursorOperations = @(Get-RepoActivityCursorOperations -RepoActivity $repoActivity -ObservedAt ([DateTime]::UtcNow) -HandledRepoIds $handledRepoIds)
if ($repoCursorOperations.Count -gt 0) {
Append-RunLog ("recording repo activity cursors: {0}" -f $repoCursorOperations.Count)
foreach ($operation in $repoCursorOperations) {