@ngockhoale/ukit 3.4.38 → 3.4.39
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
|
@@ -9,6 +9,14 @@ All notable changes to UKit are documented here.
|
|
|
9
9
|
- New `/ukit:ci-check` command + `ci-check.mjs` helper (core pack): prechecks, fail-closed budget guard, local preflight, at most one dispatch per invocation, write-ahead run-id state, `status` (never dispatches), `--ref`, `--dry-run`, per-OS report. Never pushes, merges or publishes.
|
|
10
10
|
- Default-branch bootstrap stub documented in `docs/design/CI-CROSS-PLATFORM-MATRIX.md` (requires separate approval).
|
|
11
11
|
|
|
12
|
+
## 3.4.39 - 2026-10-12
|
|
13
|
+
|
|
14
|
+
**Completion Gate: unrelated compound commands no longer erase authoritative git evidence; seals honour operation freshness.**
|
|
15
|
+
- Root cause: a compound command such as `git rev-parse HEAD && git status --porcelain && npm view …` was parsed as a whole-tree `git status`, its mixed stdout read as a dirty tree, and that failed state record replaced the earlier valid `git ls-remote` proof (`missing operation-verification`).
|
|
16
|
+
- Fix: a git state observation is only minted from ONE unmasked, transport-successful command; compound/masked/failed ones mint nothing and cannot overwrite proof. A standalone dirty status or a diverged remote still invalidates earlier success.
|
|
17
|
+
- Seals now record the operation sequence: a later git mutation, failed state observation, or remote sha != HEAD voids the seal (previously only content fingerprint did).
|
|
18
|
+
- Regressions: `completionClosure.test.js` (full 7-step sequence through the real hook chain), `gitSyncPostcondition.test.js`. No real Windows run.
|
|
19
|
+
|
|
12
20
|
## 3.4.38 - 2026-10-12
|
|
13
21
|
|
|
14
22
|
**Completion Gate safety closure: mutation orders always get a contract; git sync needs authoritative remote proof.**
|
package/package.json
CHANGED
|
@@ -115,6 +115,11 @@ export function bashOperationReceipt(command, response, transportSuccess, goal,
|
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
if (!role) return null;
|
|
118
|
+
// A git STATE observation is attributable only when it is one unmasked, transport-successful command: in a
|
|
119
|
+
// compound/masked chain the stdout of its parts is mixed, so it can neither prove nor refute the state and
|
|
120
|
+
// must not overwrite earlier authoritative evidence. (A standalone dirty status still records as failed.)
|
|
121
|
+
if (domain === 'git-integrity' && role === 'state'
|
|
122
|
+
&& (masked || transportSuccess !== true || real.filter((seg) => seg && !/^cd\s+\S+$/.test(seg)).length !== 1)) return null;
|
|
118
123
|
const ok = transportSuccess === true && !masked && Boolean(scope) && (role === 'mutation' || proven);
|
|
119
124
|
return { kind: 'operation', success: ok, transportSuccess: transportSuccess === true, harness,
|
|
120
125
|
...(masked ? { exitStatusUnproven: true } : {}),
|
|
@@ -3793,14 +3793,39 @@ async function readSeal(projectRoot, payload, taskInstanceId) {
|
|
|
3793
3793
|
return seal && typeof seal === 'object' ? seal : null;
|
|
3794
3794
|
}
|
|
3795
3795
|
|
|
3796
|
-
|
|
3796
|
+
// Operation freshness of a seal: the newest operation-proof sequence at seal time. After it, any NEW mutation
|
|
3797
|
+
// attempt, any failed state observation, or a remote observation whose sha is no longer HEAD voids the seal
|
|
3798
|
+
// (successful unrelated observations do not). Content fingerprint alone cannot see remote/mutation changes.
|
|
3799
|
+
function operationSeq(ledger) {
|
|
3800
|
+
let max = 0;
|
|
3801
|
+
for (const [key, entry] of Object.entries(ledger?.operationBank || {})) {
|
|
3802
|
+
if (key === 'seenToolUseIds' || key === 'overflow') continue;
|
|
3803
|
+
for (const proof of [entry?.mutation, entry?.state]) if (Number.isSafeInteger(proof?.sequence)) max = Math.max(max, proof.sequence);
|
|
3804
|
+
}
|
|
3805
|
+
return max;
|
|
3806
|
+
}
|
|
3807
|
+
function sealOperationsFresh(seal, ledger, projectRoot) {
|
|
3808
|
+
const since = Number.isSafeInteger(seal?.opSeq) ? seal.opSeq : 0;
|
|
3809
|
+
const head = gitOutput(['rev-parse', 'HEAD'], projectRoot);
|
|
3810
|
+
for (const [key, entry] of Object.entries(ledger?.operationBank || {})) {
|
|
3811
|
+
if (key === 'seenToolUseIds' || key === 'overflow') continue;
|
|
3812
|
+
if (entry?.mutation?.sequence > since) return false;
|
|
3813
|
+
const st = entry?.state;
|
|
3814
|
+
if (!st) continue;
|
|
3815
|
+
if (st.sequence > since && st.success !== true) return false;
|
|
3816
|
+
if (st.operation?.remoteSync && st.operation.remoteSync.sha !== head) return false;
|
|
3817
|
+
}
|
|
3818
|
+
return !ledger?.operationBank?.overflow;
|
|
3819
|
+
}
|
|
3820
|
+
|
|
3821
|
+
async function writeSeal(projectRoot, payload, state, result, ledger) {
|
|
3797
3822
|
const taskInstanceId = state?.taskInstanceId;
|
|
3798
3823
|
const contentFp = contentFingerprint(projectRoot);
|
|
3799
3824
|
if (!taskInstanceId || !contentFp || result.complete !== true) return;
|
|
3800
3825
|
if (!(requiredEvidence(state).length > 0)) return;
|
|
3801
3826
|
const file = sealPath(projectRoot, payload);
|
|
3802
3827
|
const seals = await readJson(file, {}) || {};
|
|
3803
|
-
seals[taskInstanceId] = { contentFp, headSha: gitOutput(['rev-parse', 'HEAD'], projectRoot), ts: Date.now() };
|
|
3828
|
+
seals[taskInstanceId] = { contentFp, headSha: gitOutput(['rev-parse', 'HEAD'], projectRoot), opSeq: operationSeq(ledger), ts: Date.now() };
|
|
3804
3829
|
const keep = Object.entries(seals).sort((a, b) => (b[1]?.ts || 0) - (a[1]?.ts || 0)).slice(0, SEAL_MAX);
|
|
3805
3830
|
await fs.mkdir(path.dirname(file), { recursive: true });
|
|
3806
3831
|
await writeJsonAtomic(file, Object.fromEntries(keep));
|
|
@@ -3843,12 +3868,12 @@ async function runEvaluateStop() {
|
|
|
3843
3868
|
if (result.continue === true && !result.finalNotice) {
|
|
3844
3869
|
try {
|
|
3845
3870
|
const seal = await readSeal(projectRoot, payload, state?.taskInstanceId);
|
|
3846
|
-
if (seal?.contentFp && contentFingerprint(projectRoot) === seal.contentFp) {
|
|
3871
|
+
if (seal?.contentFp && contentFingerprint(projectRoot) === seal.contentFp && sealOperationsFresh(seal, ledger, projectRoot)) {
|
|
3847
3872
|
result = { continue: false, notify: false, complete: true, missingEvidence: [], gateRelease: 'sealed-complete' };
|
|
3848
3873
|
}
|
|
3849
3874
|
} catch { /* a seal read failure keeps the strict gate */ }
|
|
3850
3875
|
} else if (result.complete === true && (!result.gateRelease || result.gateRelease === 'native-operation-verified')) {
|
|
3851
|
-
try { await writeSeal(projectRoot, payload, state, result); } catch { /* advisory */ }
|
|
3876
|
+
try { await writeSeal(projectRoot, payload, state, result, ledger); } catch { /* advisory */ }
|
|
3852
3877
|
}
|
|
3853
3878
|
|
|
3854
3879
|
// TASK-C85-019 fix C: a mutating-mode route released by a no-mutation valve
|