p-backlog 0.14.4 → 0.14.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.14.5
6
+
7
+ - Concurrent rechecks record one candidate and count it once in Quality.
8
+
5
9
  ## 0.14.4
6
10
 
7
11
  - Positive costs below one cent are shown as less than one cent.
package/dist/cli.js CHANGED
@@ -2197,6 +2197,22 @@ async function appendJournal(projectDir, events, onError) {
2197
2197
  }
2198
2198
  }
2199
2199
  var JOURNAL_LOCK_WAIT_MS = 4 * BLOCKED_RETRIES_TOTAL_MS + 10 * SECOND_MS;
2200
+ async function appendDerivedJournalEvents(projectDir, derive, onError) {
2201
+ const path = join8(projectDir, JOURNAL_FILE);
2202
+ try {
2203
+ await withWriteLock(
2204
+ path,
2205
+ async (afterPublish) => {
2206
+ const { values } = await readJsonLines(path, journalEventSchema);
2207
+ const events = derive(values);
2208
+ if (events.length > 0) await appendJsonLines(path, events, afterPublish);
2209
+ },
2210
+ { onErrorAfterPublish: onError }
2211
+ );
2212
+ } catch (error) {
2213
+ onError(path, error);
2214
+ }
2215
+ }
2200
2216
  async function appendWaitingForLock(path, events, afterPublish) {
2201
2217
  try {
2202
2218
  await withWriteLock(path, (underLock) => appendJsonLines(path, events, underLock), { ...afterPublish, waitLimitMs: JOURNAL_LOCK_WAIT_MS });
@@ -6171,23 +6187,21 @@ function candidateOutcome(reviews) {
6171
6187
  }
6172
6188
  async function recordCandidates(root, tasks, { candidates, filtered, unchecked, unjudged }, { mode, now, projectIds, messages, warn: warn2, model }) {
6173
6189
  const projectOf2 = new Map(tasks.map((task) => [task.id, task.projectId]));
6190
+ const endsGone = mode === "full";
6174
6191
  for (const projectId of projectIds) {
6175
- const dir = join19(root, projectId);
6176
- const found = candidates.filter((candidate) => projectOf2.get(candidate.task.id) === projectId);
6192
+ const sightings = candidates.filter((candidate) => projectOf2.get(candidate.task.id) === projectId).map(sightingOf);
6177
6193
  const filteredHere = filtered.filter((sighting) => projectOf2.get(sighting.task) === projectId);
6178
6194
  const reviewed = tasks.filter((task) => task.projectId === projectId && isReviewable(task) && !unjudged.has(task.id)).map((task) => task.id);
6179
- const endsGone = mode === "full";
6180
- if (found.length === 0 && filteredHere.length === 0 && (!endsGone || reviewed.length === 0)) continue;
6181
- const reportFailure2 = (error) => warn2(messages.candidatesRecordFailed(projectId, errorText(error)));
6182
- try {
6183
- const journal = await readJournal(dir, projectId);
6184
- const states = episodeStates(journal.events);
6185
- const sightings = found.map(sightingOf);
6186
- const gone = endsGone ? candidateGoneEvents({ sightings, reviewed, unchecked: unchecked.get(projectId) ?? [] }, states, now) : [];
6187
- await appendJournal(dir, [...candidateEvents(sightings, states, now, mode, model), ...gone, ...filteredEvents(filteredHere, states, now)], (_path, error) => reportFailure2(error));
6188
- } catch (error) {
6189
- reportFailure2(error);
6190
- }
6195
+ if (sightings.length === 0 && filteredHere.length === 0 && (!endsGone || reviewed.length === 0)) continue;
6196
+ await appendDerivedJournalEvents(
6197
+ join19(root, projectId),
6198
+ (events) => {
6199
+ const states = episodeStates(events);
6200
+ const gone = endsGone ? candidateGoneEvents({ sightings, reviewed, unchecked: unchecked.get(projectId) ?? [] }, states, now) : [];
6201
+ return [...candidateEvents(sightings, states, now, mode, model), ...gone, ...filteredEvents(filteredHere, states, now)];
6202
+ },
6203
+ (_path, error) => warn2(messages.candidatesRecordFailed(projectId, errorText(error)))
6204
+ );
6191
6205
  }
6192
6206
  }
6193
6207
  function sightingOf(candidate) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "p-backlog",
3
- "version": "0.14.4",
3
+ "version": "0.14.5",
4
4
  "description": "Keep pull requests clean and audit findings safe: a local, autonomous backlog for Claude Code. The agent files out-of-scope issues as Markdown tasks with context and re-checks them as code changes. Optional web UI with metrics.",
5
5
  "keywords": [
6
6
  "claude-code",