@codyswann/lisa 4.100.1 → 4.100.3
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/all/copy-overwrite/scripts/check-third-party-review-evidence.mjs +172 -30
- package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
- package/dist/core/lisa-owned-hash-ledger.js +6 -0
- package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
- package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
- package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
- package/dist/core/upstream-evidence-manifest.js +16 -8
- package/dist/core/upstream-evidence-manifest.js.map +1 -1
- package/package.json +4 -4
- package/plugins/lisa/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-drive-pr-to-merge/SKILL.md +8 -3
- package/plugins/lisa/.codex-plugin/skills/lisa-github-build-intake/SKILL.md +1 -1
- package/plugins/lisa/.codex-plugin/skills/lisa-secrets-access/scripts/validate-config.mjs +60 -9
- package/plugins/lisa/.codex-plugin/skills/lisa-track/SKILL.md +1 -1
- package/plugins/lisa/rules/reference/rejection-detection.md +2 -2
- package/plugins/lisa/skills/lisa-drive-pr-to-merge/SKILL.md +8 -3
- package/plugins/lisa/skills/lisa-github-build-intake/SKILL.md +1 -1
- package/plugins/lisa/skills/lisa-secrets-access/scripts/validate-config.mjs +60 -9
- package/plugins/lisa/skills/lisa-track/SKILL.md +1 -1
- package/plugins/lisa-agy/plugin.json +1 -1
- package/plugins/lisa-agy/skills/lisa-drive-pr-to-merge/SKILL.md +8 -3
- package/plugins/lisa-agy/skills/lisa-github-build-intake/SKILL.md +1 -1
- package/plugins/lisa-agy/skills/lisa-secrets-access/scripts/validate-config.mjs +60 -9
- package/plugins/lisa-agy/skills/lisa-track/SKILL.md +1 -1
- package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-agy/plugin.json +1 -1
- package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-copilot/rules/reference/rejection-detection.md +2 -2
- package/plugins/lisa-copilot/skills/lisa-drive-pr-to-merge/SKILL.md +8 -3
- package/plugins/lisa-copilot/skills/lisa-github-build-intake/SKILL.md +1 -1
- package/plugins/lisa-copilot/skills/lisa-secrets-access/scripts/validate-config.mjs +60 -9
- package/plugins/lisa-copilot/skills/lisa-track/SKILL.md +1 -1
- package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-cursor/rules/rejection-detection-reference.mdc +2 -2
- package/plugins/lisa-cursor/skills/lisa-drive-pr-to-merge/SKILL.md +8 -3
- package/plugins/lisa-cursor/skills/lisa-github-build-intake/SKILL.md +1 -1
- package/plugins/lisa-cursor/skills/lisa-secrets-access/scripts/validate-config.mjs +60 -9
- package/plugins/lisa-cursor/skills/lisa-track/SKILL.md +1 -1
- package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-devin/rules/reference/rejection-detection.md +2 -2
- package/plugins/lisa-devin/skills/lisa-drive-pr-to-merge/SKILL.md +8 -3
- package/plugins/lisa-devin/skills/lisa-github-build-intake/SKILL.md +1 -1
- package/plugins/lisa-devin/skills/lisa-secrets-access/scripts/validate-config.mjs +60 -9
- package/plugins/lisa-devin/skills/lisa-track/SKILL.md +1 -1
- package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-agy/plugin.json +1 -1
- package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-agy/plugin.json +1 -1
- package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-agy/plugin.json +1 -1
- package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-agy/plugin.json +1 -1
- package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-agy/plugin.json +1 -1
- package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-agy/plugin.json +1 -1
- package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-agy/plugin.json +1 -1
- package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
- package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
- package/plugins/src/base/rules/reference/rejection-detection.md +2 -2
- package/plugins/src/base/skills/lisa-drive-pr-to-merge/SKILL.md +8 -3
- package/plugins/src/base/skills/lisa-github-build-intake/SKILL.md +1 -1
- package/plugins/src/base/skills/lisa-secrets-access/scripts/validate-config.mjs +60 -9
- package/plugins/src/base/skills/lisa-track/SKILL.md +1 -1
- package/scripts/lisa-ci-failure-redispatch.mjs +216 -18
- package/scripts/lisa-ci-rework-route.mjs +24 -49
|
@@ -497,7 +497,7 @@ A blocker is active if it is open and has no cleared status label. Treat `status
|
|
|
497
497
|
|
|
498
498
|
Before the claim mutation, apply `claim-time-guards` — **Value before claim**, or **Worth doing** in `lisa-track` on runtimes without the rule tree (Antigravity). A ready label establishes neither value nor permission to expand scope. Respect the preceding human-hold gate; a declined incidental item consumes this cycle's one processed disposition.
|
|
499
499
|
|
|
500
|
-
**CI rework is read before everything else in 3b — before rejection detection, and before this phase posts its own claim comment.** When a required check fails on an agent's PR, the `lisa-ci-failure-redispatch` workflow moves the item from `$CLAIMED` back to `$READY` and comments a visible line plus `<!-- [lisa-ci-failed] pr=<n> sha=<head> -->`. A marker counts **only when its comment is authored by `github-actions[bot]`** (the workflow's identity) — anyone can type the marker, so a comment from any other author is ignored. A marker is **uncleared** while its comment carries no `<!-- [lisa-ci-cleared] run=<id> -->`; a later all-green run on the PR clears it, and a marker whose PR has merged or closed counts as cleared. From the read bundle's comments, take the **newest** comment carrying any Lisa marker (`[lisa-…]` or `[claude-build-intake]`; claim comments and session-manager notes (`[lisa-tracker-claim]`, `[claude-build-intake]`, `[lisa-session-manager]`)
|
|
500
|
+
**CI rework is read before everything else in 3b — before rejection detection, and before this phase posts its own claim comment.** When a required check fails on an agent's PR, the `lisa-ci-failure-redispatch` workflow moves the item from `$CLAIMED` back to `$READY` and comments a visible line plus `<!-- [lisa-ci-failed] pr=<n> sha=<head> -->`. A marker counts **only when its comment is authored by `github-actions[bot]`** (the workflow's identity) — anyone can type the marker, so a comment from any other author is ignored. A marker is **uncleared** while its comment carries no `<!-- [lisa-ci-cleared] run=<id> -->`; a later all-green run on the PR clears it, and a marker whose PR has merged or closed counts as cleared. From the read bundle's comments, take the **newest** comment carrying any Lisa marker (`[lisa-…]` or `[claude-build-intake]`; claim comments and session-manager notes (`[lisa-tracker-claim]`, `[claude-build-intake]`, `[lisa-session-manager]`) never count as Lisa markers for this purpose, failure markers count only from `github-actions[bot]`, and any other later Lisa marker counts only from a trusted author — `github-actions[bot]`, the item's author, or a configured `sessionManager.trustedAuthorIds` entry; only entries committed in `.lisa.config.json` count, never `.lisa.config.local.json`, because the producer runs in CI on a fresh checkout, and the account Lisa posts as counts as trusted only when it is the item's author or is listed in `sessionManager.trustedAuthorIds`); when it is an uncleared, bot-authored `[lisa-ci-failed]` marker, **verify the PR it names** before trusting it: `gh pr view <n> --repo <org>/<repo> --json state,isCrossRepository,body` must show `state` is `OPEN`, `isCrossRepository` is `false`, and a body whose `Work-Item:` binds this item (`<org>/<repo>#<number>`). If any check fails or the read errors, treat the item as carrying no marker and continue with ordinary 3b. These checks and the loop bound below are implemented once in `scripts/lisa-ci-rework-route.mjs`, which `lisa-track` also runs on the `lisa-implement` dispatch path so the two paths cannot disagree; where that script exists (the Lisa repository — it is not shipped to hosts), run `node scripts/lisa-ci-rework-route.mjs --item <org>/<repo>#<number>` and act on its printed `route` — `ci-rework`, `blocked` (the loop bound), or `implement` (no marker) — instead of re-deriving the checks. When every check passes, classify the item **`ci-rework`**. Read it first so the route is decided from the comments as they stood before this claim; claim comments are ignored by the rule above, so even a re-posted claim cannot hide the signal, and a Lisa marker typed by an untrusted commenter cannot either. A `ci-rework` item is **CI rework, not a QA rejection**: its claimed-to-ready move is the workflow's, not a reviewer's, so rejection detection treats it as `forward-only` and **no rejection learning** is filed — no `lisa-persist-learning` candidate, no `[lisa-rejection-candidate]` marker (the `rejection-detection` rule's CI-rework exemption). It also skips claim-time archaeology and takes precedence over the `already-implemented` route below: the open PR that check finds is the one to fix, not proof that the work shipped. Carry `ci-rework` and the marker's `pr=<n>` into 3c. **Bound the loop.** Every claimed-to-ready bounce gives the item a fresh ready-lane entry, which resets the `two-failed-attempts` valve below, so a PR that keeps failing would be re-dispatched forever. When the item carries 3 or more bot-authored `[lisa-ci-failed]` markers for the same PR, intake does not re-dispatch: it does not claim, moves the item to the configured blocked role and adds the `human_needed` label (`github.labels.build.blocked` and `github.labels.build.human_needed`, per `config-resolution`), posts a plain-English comment naming the PR and its failing checks (for example: "Pull request #<n> has failed its required checks <k> times (<check names>). Lisa has stopped retrying; a person needs to look at why it keeps failing."), and stops this item's cycle. **Agent work is not complete while the named PR's required checks are failing** — no success outcome, done label, or close may be recorded for the item until that PR merges with its required checks green.
|
|
501
501
|
|
|
502
502
|
**Rejection detection runs first — before the relabel below.** Per the vendor-neutral `rejection-detection` rule (cite the slug; do not restate its classification table), classify this item at the **top of 3b, BEFORE** the `$READY → $CLAIMED` relabel — after the relabel the current-lane signal is gone. Read the item's Label-Event History from `lisa-github-read-issue` (chronological `LabeledEvent` / `UnlabeledEvent` on the configured `$READY` label) and classify it `rejection-reclaim | forward-only | never-left-ready | unknown`. Lane names come from `.lisa.config.json` (`github.labels.build.*`), never hardcoded. A failing/absent history yields `unknown` and the claim proceeds — detection never blocks the build. Items carrying a learning marker (`[lisa-learning-drop]` / `[lisa-learning-pr]` / `[lisa-learning-upstream-handoff]`) or the `learning:needs-triage` or `learning:low-confidence` label are never rejection triggers (no learning-about-learning). Carry the classification into the relabel and lifecycle below.
|
|
503
503
|
|
|
@@ -516,6 +516,20 @@ const INTERVAL_UNITS = { s: 1, m: 60, h: 3600, d: 86_400 };
|
|
|
516
516
|
*/
|
|
517
517
|
const TOKEN_VALUE = /^\d{5,}:[A-Za-z0-9_-]{30,}$/;
|
|
518
518
|
|
|
519
|
+
/**
|
|
520
|
+
* A legacy Jira Cloud accountId (`557058:<uuid>`), which `TOKEN_VALUE` also
|
|
521
|
+
* matches (CodySwannGT/lisa#4719).
|
|
522
|
+
*
|
|
523
|
+
* Exempted only for `operatorIds` / `trustedAuthorIds` entries, where a Jira
|
|
524
|
+
* project puts exactly this id. A Telegram token's secret half is never in
|
|
525
|
+
* canonical UUID form, so the exemption lets no token through.
|
|
526
|
+
*/
|
|
527
|
+
const JIRA_LEGACY_ACCOUNT_ID =
|
|
528
|
+
/^\d+:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
529
|
+
|
|
530
|
+
/** The block's id lists, whose entries the credential scan reads by kind. */
|
|
531
|
+
const ID_LIST_KEYS = new Set(["operatorIds", "trustedAuthorIds"]);
|
|
532
|
+
|
|
519
533
|
/** Key names that only ever hold a credential. */
|
|
520
534
|
const CREDENTIAL_KEY = /token|secret|password|passwd|api[-_]?key|credential/i;
|
|
521
535
|
|
|
@@ -745,6 +759,10 @@ function isNameKeyedMap(segments) {
|
|
|
745
759
|
* (#4555; the state dir's 0600 dotenv file only when no provider is
|
|
746
760
|
* configured), so a token here is both leaked and unused. The value is never
|
|
747
761
|
* echoed.
|
|
762
|
+
*
|
|
763
|
+
* An `operatorIds` / `trustedAuthorIds` entry is scanned by kind instead
|
|
764
|
+
* (`idEntryCredentials`), so a token behind `id:` / `login:` is still caught
|
|
765
|
+
* and a legacy Jira accountId is not mistaken for one (CodySwannGT/lisa#4719).
|
|
748
766
|
* @param {unknown} value Subtree.
|
|
749
767
|
* @param {string} path Dotted path so far, for messages.
|
|
750
768
|
* @param {readonly string[] | null} [segments] Object keys from the block root;
|
|
@@ -753,18 +771,14 @@ function isNameKeyedMap(segments) {
|
|
|
753
771
|
*/
|
|
754
772
|
function findCredentials(value, path, segments = []) {
|
|
755
773
|
if (typeof value === "string") {
|
|
756
|
-
return TOKEN_VALUE.test(value.trim())
|
|
757
|
-
? [
|
|
758
|
-
`${path} looks like a bot token. Tokens never go in config: ` +
|
|
759
|
-
`remove it, and store the token in the project's secrets ` +
|
|
760
|
-
`provider with session-manager.mjs store-token ` +
|
|
761
|
-
`(/lisa:setup:session-manager runs it).`,
|
|
762
|
-
]
|
|
763
|
-
: [];
|
|
774
|
+
return TOKEN_VALUE.test(value.trim()) ? botTokenProblem(path) : [];
|
|
764
775
|
}
|
|
765
776
|
if (Array.isArray(value)) {
|
|
777
|
+
const isIdList = segments?.length === 1 && ID_LIST_KEYS.has(segments[0]);
|
|
766
778
|
return value.flatMap((item, i) =>
|
|
767
|
-
|
|
779
|
+
isIdList && typeof item === "string"
|
|
780
|
+
? idEntryCredentials(item, `${path}[${i}]`)
|
|
781
|
+
: findCredentials(item, `${path}[${i}]`, null)
|
|
768
782
|
);
|
|
769
783
|
}
|
|
770
784
|
if (!isPlainObject(value)) return [];
|
|
@@ -815,6 +829,43 @@ export function classifyIdEntry(entry) {
|
|
|
815
829
|
return entry.slice(prefix.length + 1).trim() === "" ? "empty-value" : prefix;
|
|
816
830
|
}
|
|
817
831
|
|
|
832
|
+
/**
|
|
833
|
+
* The refusal for a token-shaped value, naming only its path.
|
|
834
|
+
* @param {string} path Where the value sits.
|
|
835
|
+
* @returns {string[]} The one problem.
|
|
836
|
+
*/
|
|
837
|
+
function botTokenProblem(path) {
|
|
838
|
+
return [
|
|
839
|
+
`${path} looks like a bot token. Tokens never go in config: ` +
|
|
840
|
+
`remove it, and store the token in the project's secrets ` +
|
|
841
|
+
`provider with session-manager.mjs store-token ` +
|
|
842
|
+
`(/lisa:setup:session-manager runs it).`,
|
|
843
|
+
];
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* Scan one `operatorIds` / `trustedAuthorIds` entry for a bot token
|
|
848
|
+
* (CodySwannGT/lisa#4719).
|
|
849
|
+
*
|
|
850
|
+
* The value after a `login:` / `id:` prefix is what gets tested, since a
|
|
851
|
+
* token pasted behind a prefix is as leaked as a bare one. A legacy Jira
|
|
852
|
+
* accountId (`557058:<uuid>`) is token-shaped but is a real id, so it passes.
|
|
853
|
+
* @param {string} entry One entry.
|
|
854
|
+
* @param {string} path Where the entry sits.
|
|
855
|
+
* @returns {string[]} Problems found.
|
|
856
|
+
*/
|
|
857
|
+
function idEntryCredentials(entry, path) {
|
|
858
|
+
const trimmed = entry.trim();
|
|
859
|
+
const prefix = ID_ENTRY_PREFIX.exec(trimmed)?.[1];
|
|
860
|
+
const value =
|
|
861
|
+
prefix !== undefined && ID_ENTRY_KINDS.has(prefix)
|
|
862
|
+
? trimmed.slice(prefix.length + 1).trim()
|
|
863
|
+
: trimmed;
|
|
864
|
+
return TOKEN_VALUE.test(value) && !JIRA_LEGACY_ACCOUNT_ID.test(value)
|
|
865
|
+
? botTokenProblem(path)
|
|
866
|
+
: [];
|
|
867
|
+
}
|
|
868
|
+
|
|
818
869
|
/**
|
|
819
870
|
* Refuse each malformed kind-keyed entry, naming it. A reader matches such an
|
|
820
871
|
* entry against nobody, so accepting it would silently drop a person.
|
|
@@ -84,7 +84,7 @@ Decide the dispatch route from the item's comments as they stand **before** this
|
|
|
84
84
|
node scripts/lisa-ci-rework-route.mjs --item <canonical-ref>
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
It only reads, and prints one JSON object. It is the one place the trust rules live, shared with `lisa-github-build-intake` 3b so the two dispatch paths cannot disagree: the newest counted Lisa marker must be an uncleared `[lisa-ci-failed]` marker authored by `github-actions[bot]` — claim comments and session-manager notes (`[lisa-tracker-claim]`, `[claude-build-intake]`, `[lisa-session-manager]`)
|
|
87
|
+
It only reads, and prints one JSON object. It is the one place the trust rules live, shared with `lisa-github-build-intake` 3b so the two dispatch paths cannot disagree: the newest counted Lisa marker must be an uncleared `[lisa-ci-failed]` marker authored by `github-actions[bot]` — claim comments and session-manager notes (`[lisa-tracker-claim]`, `[claude-build-intake]`, `[lisa-session-manager]`) never count as Lisa markers for this purpose, failure markers count only from `github-actions[bot]`, and any other later Lisa marker counts only from a trusted author — `github-actions[bot]`, the item's author, or a configured `sessionManager.trustedAuthorIds` entry; only entries committed in `.lisa.config.json` count, never `.lisa.config.local.json`, because the producer runs in CI on a fresh checkout, and the account Lisa posts as counts as trusted only when it is the item's author or is listed in `sessionManager.trustedAuthorIds` — and the pull request it names must be open, from this repository rather than a fork, and bound to this item by its `Work-Item:` line. Act on its `route`:
|
|
88
88
|
|
|
89
89
|
- When `route` is `implement` (any `reason`): resolve and claim the item the normal way below, and return `route: implement`.
|
|
90
90
|
- When `route` is `ci-rework`: return `route: ci-rework pr=<n>`, `failing_checks` and `head_ref` (the JSON's `pr`, `failingChecks` and `headRefName`). Continue through the hold check and the claim below unchanged: the claim is what moves the item from the ready lane back to the claimed lane, the same re-claim build intake 3b performs, and the binding names the same item. A ci-rework item is CI rework, not a rejection: it takes no rejection detection and records no rejection learning (the `rejection-detection` rule's CI-rework exemption).
|
|
@@ -43,10 +43,19 @@
|
|
|
43
43
|
*
|
|
44
44
|
* Repo-only: this is the Lisa monorepo's own automation and is deliberately
|
|
45
45
|
* NOT shipped to host projects (CodySwannGT/lisa#4607, Out of Scope).
|
|
46
|
+
*
|
|
47
|
+
* What supersedes a marker (CodySwannGT/lisa#4707): a later comment carrying
|
|
48
|
+
* a Lisa marker that is not a claim, posted by a trusted author — the
|
|
49
|
+
* workflow's identity, the item's author, or a configured
|
|
50
|
+
* `sessionManager.trustedAuthorIds` entry. Supersession by trusted author was
|
|
51
|
+
* chosen over explicit-only supersession (a `[lisa-ci-cleared]` edit or a
|
|
52
|
+
* newer `[lisa-ci-failed]` marker) because a trusted human-gate hold posted
|
|
53
|
+
* after the marker must still stop CI rework.
|
|
46
54
|
* @module scripts/lisa-ci-failure-redispatch
|
|
47
55
|
*/
|
|
48
56
|
import { spawnSync } from "node:child_process";
|
|
49
57
|
import { readFileSync } from "node:fs";
|
|
58
|
+
import { join } from "node:path";
|
|
50
59
|
import process from "node:process";
|
|
51
60
|
|
|
52
61
|
import { invokedAsScript } from "../all/copy-overwrite/scripts/lib/invoked-as-script.mjs";
|
|
@@ -54,6 +63,7 @@ import {
|
|
|
54
63
|
soleWorkItem,
|
|
55
64
|
trackerContract,
|
|
56
65
|
} from "../all/copy-overwrite/scripts/lisa-work-item.mjs";
|
|
66
|
+
import { parseIdEntries } from "../plugins/src/base/scripts/operator-id-kinds.mjs";
|
|
57
67
|
|
|
58
68
|
const SHA = /^[0-9a-f]{40}$/u;
|
|
59
69
|
/**
|
|
@@ -68,6 +78,13 @@ export const FAILURE_MARKER =
|
|
|
68
78
|
export const CLEARED_MARKER = /<!-- \[lisa-ci-cleared\] run=\d+ -->/u;
|
|
69
79
|
/** Any Lisa lifecycle marker — the claim, attempt, and CI markers alike. */
|
|
70
80
|
export const LISA_MARKER = /\[(?:lisa-[a-z0-9-]+|claude-build-intake)\]/u;
|
|
81
|
+
/**
|
|
82
|
+
* Dispatch-bookkeeping markers: the lifecycle claim, build intake's legacy
|
|
83
|
+
* claim, and the session manager's own notes (stop, release, worker failed,
|
|
84
|
+
* answer delivered). None of them says anything about the PR's checks.
|
|
85
|
+
*/
|
|
86
|
+
const CLAIM_MARKERS =
|
|
87
|
+
/\[(?:lisa-tracker-claim|claude-build-intake|lisa-session-manager)\]/gu;
|
|
71
88
|
const NO_REQUIRED = /no (?:required )?checks reported/iu;
|
|
72
89
|
/** Read every page of a REST list as one array of pages. */
|
|
73
90
|
const PAGINATE = Object.freeze(["--paginate", "--slurp"]);
|
|
@@ -392,6 +409,158 @@ export function trustedAuthor(comment) {
|
|
|
392
409
|
return MARKER_AUTHORS.includes(comment.user?.login ?? "");
|
|
393
410
|
}
|
|
394
411
|
|
|
412
|
+
/**
|
|
413
|
+
* True when every Lisa marker the comment carries is a claim marker. A claim
|
|
414
|
+
* is dispatch bookkeeping: the session manager claims an item before its
|
|
415
|
+
* worker reads the markers, and a re-claim can post another claim comment,
|
|
416
|
+
* so a claim says nothing about the PR's checks and never supersedes.
|
|
417
|
+
* @param {object} comment - Item comment.
|
|
418
|
+
* @returns {boolean} Whether it is a claim-only comment.
|
|
419
|
+
*/
|
|
420
|
+
export function claimOnly(comment) {
|
|
421
|
+
const body = String(comment.body ?? "");
|
|
422
|
+
return (
|
|
423
|
+
LISA_MARKER.test(body) &&
|
|
424
|
+
!LISA_MARKER.test(body.replaceAll(CLAIM_MARKERS, ""))
|
|
425
|
+
);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* True when a comment posted after an uncleared failure marker means the
|
|
430
|
+
* marker no longer describes the item (CodySwannGT/lisa#4707). It must carry
|
|
431
|
+
* a Lisa marker and not be claim-only; a failure marker counts only from
|
|
432
|
+
* {@link MARKER_AUTHORS}, any other marker only from a `trust`ed author.
|
|
433
|
+
* Anyone can comment on a public repository, so an outsider's `[lisa-x] hi`
|
|
434
|
+
* must not turn CI rework off.
|
|
435
|
+
* @param {object} comment - A later item comment.
|
|
436
|
+
* @param {(comment: object) => boolean} trust - Whose markers count.
|
|
437
|
+
* @returns {boolean} Whether it supersedes the marker.
|
|
438
|
+
*/
|
|
439
|
+
export function supersedes(comment, trust) {
|
|
440
|
+
const body = String(comment.body ?? "");
|
|
441
|
+
if (!LISA_MARKER.test(body) || claimOnly(comment)) return false;
|
|
442
|
+
return FAILURE_MARKER.test(body) ? trustedAuthor(comment) : trust(comment);
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Whether a configured `sessionManager.trustedAuthorIds` entry names a GitHub
|
|
447
|
+
* comment author. Only a `login:` entry matches a login; a plain entry, like
|
|
448
|
+
* an `id:` entry, matches the numeric account id only — the same reading
|
|
449
|
+
* `isTrustedAuthor` in ready-queue-order gives it — because a freed login can
|
|
450
|
+
* be re-registered by someone else, and nobody picks their own numeric id
|
|
451
|
+
* (#4571, #4623).
|
|
452
|
+
* @param {{kind: string, value?: string}} entry - Parsed entry.
|
|
453
|
+
* @param {{login?: string, id?: number|string}|undefined} user - Comment author.
|
|
454
|
+
* @returns {boolean} Whether it matches.
|
|
455
|
+
*/
|
|
456
|
+
function entryNames(entry, user) {
|
|
457
|
+
const kind = entry.kind === "plain" ? "id" : entry.kind;
|
|
458
|
+
if (kind === "login")
|
|
459
|
+
return typeof user?.login === "string" && user.login === entry.value;
|
|
460
|
+
if (kind === "id") return user?.id != null && String(user.id) === entry.value;
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* True when two GitHub users are the same account, by numeric id. A side with
|
|
466
|
+
* no id is never a match: a login can be freed and re-registered by someone
|
|
467
|
+
* else, so a login alone does not prove the item's author wrote a comment.
|
|
468
|
+
* @param {object|null|undefined} a - A user.
|
|
469
|
+
* @param {object|null|undefined} b - Another user.
|
|
470
|
+
* @returns {boolean} Whether they match.
|
|
471
|
+
*/
|
|
472
|
+
function sameUser(a, b) {
|
|
473
|
+
if (a?.id == null || b?.id == null) return false;
|
|
474
|
+
return String(a.id) === String(b.id);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Build the trusted-author predicate for later non-failure markers: the
|
|
479
|
+
* workflow's identity ({@link MARKER_AUTHORS}), a configured
|
|
480
|
+
* `sessionManager.trustedAuthorIds` entry, or the item's author. The item's
|
|
481
|
+
* author is read lazily — only when a later marker from someone else needs
|
|
482
|
+
* judging — and at most once.
|
|
483
|
+
* @param {{trustedAuthorIds?: unknown, itemAuthor: () => object|null}} input - Configured entries and the author reader.
|
|
484
|
+
* @returns {(comment: object) => boolean} The predicate.
|
|
485
|
+
*/
|
|
486
|
+
export function markerTrust({ trustedAuthorIds, itemAuthor }) {
|
|
487
|
+
const entries = parseIdEntries(trustedAuthorIds);
|
|
488
|
+
const author = { read: false, user: null };
|
|
489
|
+
return comment => {
|
|
490
|
+
if (trustedAuthor(comment)) return true;
|
|
491
|
+
if (entries.some(entry => entryNames(entry, comment.user))) return true;
|
|
492
|
+
if (!author.read) Object.assign(author, { read: true, user: itemAuthor() });
|
|
493
|
+
return sameUser(comment.user, author.user);
|
|
494
|
+
};
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Read the work item's author (the REST issue's `user`). Throws naming the
|
|
499
|
+
* call when the read fails, so a caller falls back the way it does for any
|
|
500
|
+
* failed read.
|
|
501
|
+
* @param {string} number - Issue number.
|
|
502
|
+
* @param {string} repo - Repository.
|
|
503
|
+
* @param {Function} gh - Runner.
|
|
504
|
+
* @returns {object|null} The author, or null when the issue names none.
|
|
505
|
+
*/
|
|
506
|
+
export function readItemAuthor(number, repo, gh) {
|
|
507
|
+
return readJson(gh, ["api", `repos/${repo}/issues/${number}`]).user ?? null;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* The producer's item-author read: like {@link readItemAuthor}, but a failed
|
|
512
|
+
* read is no author rather than a failed run. The author only ever decides
|
|
513
|
+
* whether a later marker is trusted, so failing closed — "not trusted" —
|
|
514
|
+
* keeps the run deciding on the evidence it has. The route helper keeps the
|
|
515
|
+
* throwing read, because its failed reads route to the normal path.
|
|
516
|
+
* @param {string} number - Issue number.
|
|
517
|
+
* @param {string} repo - Repository.
|
|
518
|
+
* @param {Function} gh - Runner.
|
|
519
|
+
* @returns {object|null} The author, or null when it cannot be read.
|
|
520
|
+
*/
|
|
521
|
+
function readItemAuthorOrNull(number, repo, gh) {
|
|
522
|
+
try {
|
|
523
|
+
return readItemAuthor(number, repo, gh);
|
|
524
|
+
} catch {
|
|
525
|
+
return null;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* The `sessionManager.trustedAuthorIds` committed in `.lisa.config.json`.
|
|
531
|
+
* `.lisa.config.local.json` is deliberately NOT read: the producer runs in
|
|
532
|
+
* CI on a fresh checkout, where no local override exists, so a helper that
|
|
533
|
+
* read one would trust people the producer does not and the two dispatch
|
|
534
|
+
* paths would disagree. Fails safe: a missing or malformed config, or a list
|
|
535
|
+
* that is not an array, trusts nobody beyond the bot and the item's author.
|
|
536
|
+
* @param {string} [root] - Project root.
|
|
537
|
+
* @returns {unknown[]} Configured entries.
|
|
538
|
+
*/
|
|
539
|
+
export function readTrustedAuthorIds(root = process.cwd()) {
|
|
540
|
+
try {
|
|
541
|
+
const config = JSON.parse(
|
|
542
|
+
readFileSync(join(root, ".lisa.config.json"), "utf8")
|
|
543
|
+
);
|
|
544
|
+
const declared = config?.sessionManager?.trustedAuthorIds;
|
|
545
|
+
return Array.isArray(declared) ? declared : [];
|
|
546
|
+
} catch {
|
|
547
|
+
return [];
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* The tracker contract with the configured trusted authors attached, unless
|
|
553
|
+
* the caller already supplied them. Both CLIs read through this so the two
|
|
554
|
+
* dispatch paths trust the same people.
|
|
555
|
+
* @param {object} contract - Tracker contract.
|
|
556
|
+
* @param {string} [root] - Project root.
|
|
557
|
+
* @returns {object} Contract carrying `trustedAuthorIds`.
|
|
558
|
+
*/
|
|
559
|
+
export function withTrustedAuthors(contract, root) {
|
|
560
|
+
if (contract.trustedAuthorIds !== undefined) return contract;
|
|
561
|
+
return { ...contract, trustedAuthorIds: readTrustedAuthorIds(root) };
|
|
562
|
+
}
|
|
563
|
+
|
|
395
564
|
/**
|
|
396
565
|
* True when the item gained `lane` after `comment` was posted. Comments alone
|
|
397
566
|
* cannot say a claim happened: a claim path that posts its claim comment once
|
|
@@ -427,20 +596,46 @@ function readEvents(number, repo, gh) {
|
|
|
427
596
|
}
|
|
428
597
|
|
|
429
598
|
/**
|
|
430
|
-
* True when `comment` is the newest
|
|
431
|
-
*
|
|
599
|
+
* True when `comment` is the newest counted Lisa marker on the item: no later
|
|
600
|
+
* comment supersedes it (see {@link supersedes}). This is the one predicate
|
|
601
|
+
* both dispatch paths use — the producer here and the route helper
|
|
602
|
+
* `scripts/lisa-ci-rework-route.mjs` — so they cannot disagree
|
|
603
|
+
* (CodySwannGT/lisa#4707).
|
|
432
604
|
* @param {object[]} comments - Item comments, oldest first.
|
|
433
605
|
* @param {object} comment - The marker comment.
|
|
606
|
+
* @param {(comment: object) => boolean} [trust] - Whose non-failure markers
|
|
607
|
+
* count; build it with {@link markerTrust}. Defaults to the bot only.
|
|
434
608
|
* @returns {boolean} Whether it is the newest.
|
|
435
609
|
*/
|
|
436
|
-
export function isNewestLisaMarker(comments, comment) {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
c =>
|
|
440
|
-
|
|
441
|
-
|
|
610
|
+
export function isNewestLisaMarker(comments, comment, trust = trustedAuthor) {
|
|
611
|
+
const index = comments.findIndex(c => c.id === comment.id);
|
|
612
|
+
return (
|
|
613
|
+
index !== -1 && !comments.slice(index + 1).some(c => supersedes(c, trust))
|
|
614
|
+
);
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* True when nothing has happened to the item since `marker`, so a lane write
|
|
619
|
+
* on its behalf is still safe: it is the newest counted marker (the shared
|
|
620
|
+
* predicate the route helper uses), no claim-only comment follows it, and
|
|
621
|
+
* the label history shows no claim since. A claim never makes the marker
|
|
622
|
+
* stale for routing, but it may mean the lane has moved, so the lane paths
|
|
623
|
+
* veto on it where the route helper does not — on ANY claim-only comment,
|
|
624
|
+
* whoever posted it: skipping a lane write is the safe direction, and routing
|
|
625
|
+
* is unaffected.
|
|
626
|
+
* @param {object} ctx - Resolved context.
|
|
627
|
+
* @param {object} marker - The marker comment.
|
|
628
|
+
* @returns {boolean} Whether the item is untouched since.
|
|
629
|
+
*/
|
|
630
|
+
function untouchedSince(ctx, marker) {
|
|
631
|
+
const { view, lanes, trust } = ctx;
|
|
632
|
+
const index = view.comments.findIndex(c => c.id === marker.id);
|
|
633
|
+
const claimedSince = view.comments.slice(index + 1).some(claimOnly);
|
|
634
|
+
return (
|
|
635
|
+
isNewestLisaMarker(view.comments, marker, trust) &&
|
|
636
|
+
!claimedSince &&
|
|
637
|
+
!laneGainedSince(ctx.events(), marker, lanes.claimed)
|
|
442
638
|
);
|
|
443
|
-
return marked.at(-1)?.id === comment.id;
|
|
444
639
|
}
|
|
445
640
|
|
|
446
641
|
/**
|
|
@@ -463,8 +658,7 @@ function planFailure(ctx) {
|
|
|
463
658
|
if (
|
|
464
659
|
claimed &&
|
|
465
660
|
!CLEARED_MARKER.test(existing.body) &&
|
|
466
|
-
|
|
467
|
-
!laneGainedSince(ctx.events(), existing, lanes.claimed)
|
|
661
|
+
untouchedSince(ctx, existing)
|
|
468
662
|
)
|
|
469
663
|
return {
|
|
470
664
|
...known,
|
|
@@ -534,12 +728,10 @@ function planClear(ctx) {
|
|
|
534
728
|
}));
|
|
535
729
|
const unclaimed =
|
|
536
730
|
view.labels.includes(lanes.ready) && !view.labels.includes(lanes.claimed);
|
|
537
|
-
const newest = open.find(c =>
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
!laneGainedSince(ctx.events(), newest, lanes.claimed)
|
|
542
|
-
) {
|
|
731
|
+
const newest = open.find(c =>
|
|
732
|
+
isNewestLisaMarker(view.comments, c, ctx.trust)
|
|
733
|
+
);
|
|
734
|
+
if (unclaimed && newest !== undefined && untouchedSince(ctx, newest)) {
|
|
543
735
|
actions.push({
|
|
544
736
|
kind: ACTION.relabel,
|
|
545
737
|
item,
|
|
@@ -635,6 +827,12 @@ export function planRedispatch({ run, repository, contract, gh }) {
|
|
|
635
827
|
lanes: contract.lifecycle,
|
|
636
828
|
// Read lazily: only a lane repair or restore needs the label history.
|
|
637
829
|
events: () => readEvents(view.number, contract.repository, gh),
|
|
830
|
+
// The same supersession rule the route helper applies (#4707).
|
|
831
|
+
trust: markerTrust({
|
|
832
|
+
trustedAuthorIds: contract.trustedAuthorIds,
|
|
833
|
+
itemAuthor: () =>
|
|
834
|
+
readItemAuthorOrNull(view.number, contract.repository, gh),
|
|
835
|
+
}),
|
|
638
836
|
};
|
|
639
837
|
if (verdict === "fail") return planFailure(ctx);
|
|
640
838
|
if (verdict === "pass")
|
|
@@ -947,7 +1145,7 @@ export function main(argv, deps = {}) {
|
|
|
947
1145
|
let source;
|
|
948
1146
|
try {
|
|
949
1147
|
options = parseArgs(argv);
|
|
950
|
-
const contract = deps.contract ?? trackerContract();
|
|
1148
|
+
const contract = withTrustedAuthors(deps.contract ?? trackerContract());
|
|
951
1149
|
source = {
|
|
952
1150
|
contract,
|
|
953
1151
|
...loadEvent(options, contract, deps.gh ?? liveGh, env),
|
|
@@ -15,9 +15,12 @@
|
|
|
15
15
|
* answer. It reads the item's comments — which the caller must do BEFORE it
|
|
16
16
|
* posts its own claim comment, a newer Lisa marker that would hide the signal —
|
|
17
17
|
* and, when the newest counted marker is an uncleared failure marker, verifies
|
|
18
|
-
* the PR it names. The marker patterns, the trusted-author
|
|
19
|
-
* newest-marker predicate
|
|
20
|
-
*
|
|
18
|
+
* the PR it names. The marker patterns, the trusted-author predicates, the
|
|
19
|
+
* newest-marker predicate (claim comments never count; any other later Lisa
|
|
20
|
+
* marker counts only from `github-actions[bot]`, the item's author, or a
|
|
21
|
+
* configured `sessionManager.trustedAuthorIds` entry — #4707) and the
|
|
22
|
+
* comment and author readers are imported from the producer script so the
|
|
23
|
+
* two cannot drift.
|
|
21
24
|
*
|
|
22
25
|
* Read-only: it never writes to the tracker. Every failed read routes to the
|
|
23
26
|
* normal path, because building again is recoverable and a wrong route is not.
|
|
@@ -39,12 +42,14 @@ import {
|
|
|
39
42
|
CLEARED_MARKER,
|
|
40
43
|
FAILURE_MARKER,
|
|
41
44
|
MARKER_AUTHORS,
|
|
42
|
-
LISA_MARKER,
|
|
43
45
|
isNewestLisaMarker,
|
|
44
46
|
liveGh,
|
|
47
|
+
markerTrust,
|
|
48
|
+
readItemAuthor,
|
|
45
49
|
readItemComments,
|
|
46
50
|
recordedGh,
|
|
47
51
|
trustedAuthor,
|
|
52
|
+
withTrustedAuthors,
|
|
48
53
|
} from "./lisa-ci-failure-redispatch.mjs";
|
|
49
54
|
|
|
50
55
|
/**
|
|
@@ -76,14 +81,6 @@ const FAILURE_LINE =
|
|
|
76
81
|
const ITEM_NUMBER = /^[1-9]\d*$/u;
|
|
77
82
|
const ITEM_REF = /^([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+)#([1-9]\d*)$/u;
|
|
78
83
|
const REPO = /^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/u;
|
|
79
|
-
/**
|
|
80
|
-
* Dispatch-bookkeeping markers: the lifecycle claim, build intake's legacy
|
|
81
|
-
* claim, and the session manager's own notes (stop, release, worker failed,
|
|
82
|
-
* answer delivered). None of them says anything about the PR's checks.
|
|
83
|
-
*/
|
|
84
|
-
const CLAIM_MARKERS =
|
|
85
|
-
/\[(?:lisa-tracker-claim|claude-build-intake|lisa-session-manager)\]/gu;
|
|
86
|
-
|
|
87
84
|
/**
|
|
88
85
|
* A decision to resolve and implement the item the normal way.
|
|
89
86
|
* @param {string} reason - Short reason code.
|
|
@@ -114,42 +111,16 @@ function carriesFailure(comment) {
|
|
|
114
111
|
}
|
|
115
112
|
|
|
116
113
|
/**
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
const body = String(comment.body ?? "");
|
|
123
|
-
return (
|
|
124
|
-
LISA_MARKER.test(body) &&
|
|
125
|
-
!LISA_MARKER.test(body.replaceAll(CLAIM_MARKERS, ""))
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* The producer's newest-marker test with claim comments left out. The
|
|
131
|
-
* session manager claims an item before its worker runs this helper, and a
|
|
132
|
-
* re-claim can post another claim comment, so a claim posted after the
|
|
133
|
-
* failure marker must not hide it: an uncleared marker on an open, bound PR
|
|
134
|
-
* still means the PR is red, whoever claimed the item since. Forged failure
|
|
135
|
-
* markers are already left out by the producer's predicate.
|
|
136
|
-
* @param {object[]} comments - Item comments, oldest first.
|
|
137
|
-
* @param {object} marker - The failure marker comment.
|
|
138
|
-
* @returns {boolean} Whether it is the newest counted marker.
|
|
139
|
-
*/
|
|
140
|
-
function isNewestCountedMarker(comments, marker) {
|
|
141
|
-
return isNewestLisaMarker(
|
|
142
|
-
comments.filter(c => c === marker || !claimOnly(c)),
|
|
143
|
-
marker
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
* Pick the failure marker that could count, or say why none does.
|
|
114
|
+
* Pick the failure marker that could count, or say why none does. Whether a
|
|
115
|
+
* later comment supersedes it is the producer's one predicate
|
|
116
|
+
* (`isNewestLisaMarker` with `markerTrust`): claim comments never count, and
|
|
117
|
+
* any other later Lisa marker counts only from a trusted author
|
|
118
|
+
* (CodySwannGT/lisa#4707).
|
|
149
119
|
* @param {object[]} comments - Item comments, oldest first.
|
|
120
|
+
* @param {(comment: object) => boolean} trust - Whose later markers count.
|
|
150
121
|
* @returns {{marker?: object, decision?: object}} The marker or a decision.
|
|
151
122
|
*/
|
|
152
|
-
function judgeMarker(comments) {
|
|
123
|
+
function judgeMarker(comments, trust) {
|
|
153
124
|
const marker = comments
|
|
154
125
|
.filter(c => carriesFailure(c) && trustedAuthor(c))
|
|
155
126
|
.at(-1);
|
|
@@ -169,11 +140,11 @@ function judgeMarker(comments) {
|
|
|
169
140
|
),
|
|
170
141
|
};
|
|
171
142
|
}
|
|
172
|
-
if (!
|
|
143
|
+
if (!isNewestLisaMarker(comments, marker, trust))
|
|
173
144
|
return {
|
|
174
145
|
decision: implement(
|
|
175
146
|
"not-newest",
|
|
176
|
-
"a newer Lisa marker (not a claim)
|
|
147
|
+
"a trusted author posted a newer Lisa marker (not a claim) after the [lisa-ci-failed] marker, so it no longer describes the item"
|
|
177
148
|
),
|
|
178
149
|
};
|
|
179
150
|
if (CLEARED_MARKER.test(marker.body))
|
|
@@ -297,7 +268,11 @@ export function decideRoute({ item, contract, gh, repository }) {
|
|
|
297
268
|
const ref = `${repo}#${item}`;
|
|
298
269
|
try {
|
|
299
270
|
const comments = readItemComments(String(item), repo, gh);
|
|
300
|
-
const
|
|
271
|
+
const trust = markerTrust({
|
|
272
|
+
trustedAuthorIds: contract.trustedAuthorIds,
|
|
273
|
+
itemAuthor: () => readItemAuthor(String(item), repo, gh),
|
|
274
|
+
});
|
|
275
|
+
const { marker, decision } = judgeMarker(comments, trust);
|
|
301
276
|
if (decision) return decision;
|
|
302
277
|
return routeMarker({
|
|
303
278
|
marker,
|
|
@@ -364,7 +339,7 @@ export function main(argv, deps = {}) {
|
|
|
364
339
|
const write = deps.write ?? (line => process.stdout.write(`${line}\n`));
|
|
365
340
|
try {
|
|
366
341
|
const options = parseArgs(argv);
|
|
367
|
-
const contract = deps.contract ?? trackerContract();
|
|
342
|
+
const contract = withTrustedAuthors(deps.contract ?? trackerContract());
|
|
368
343
|
const gh = options.payload
|
|
369
344
|
? recordedGh(JSON.parse(readFileSync(options.payload, "utf8")).gh)
|
|
370
345
|
: (deps.gh ?? liveGh);
|