Skip to content

Commit 072baac

Browse files
authored
fix: protect customer boundaries and record continuity (5.1.19)
Protect ingest metadata and explicit MCP customer selection; preserve risks, bindings and owned-lock cleanup; retain existing adapters and verify exact npm releases. Regression checks and independent review completed.
1 parent 7ff1c1e commit 072baac

16 files changed

Lines changed: 371 additions & 28 deletions

‎.claude-plugin/plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "fdeops",
33
"description": "Skills for forward deployed engineers across strategy, architecture and engineering. Use individual tasks or @fde coordination; local customer memory supports continuity.",
4-
"version": "5.1.18",
4+
"version": "5.1.19",
55
"category": "productivity",
66
"tags": [
77
"community-managed"

‎.github/scripts/verify-release.cjs‎

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Release-only network verification; never imported by the local fde CLI.
2+
const { randomUUID } = require('node:crypto')
3+
const { setTimeout: sleep } = require('node:timers/promises')
4+
5+
async function verifyRelease({ name, version }, {
6+
fetch = globalThis.fetch,
7+
wait = sleep,
8+
log = console.log,
9+
} = {}) {
10+
// At most 30 ten-second requests and 29 ten-second sleeps (under 10 minutes).
11+
const attempts = 30
12+
const nonce = randomUUID()
13+
let last = 'no response'
14+
log(`npm publish succeeded for ${name}@${version}; checking registry visibility.`)
15+
for (let attempt = 1; attempt <= attempts; attempt++) {
16+
// Exact version avoids a stale or subsequently moved latest tag. Bypass both
17+
// npm's local cache and intermediary caches on every request.
18+
const url = new URL(`https://registry.npmjs.org/${encodeURIComponent(name)}/${encodeURIComponent(version)}`)
19+
url.searchParams.set('release-check', `${nonce}-${attempt}`)
20+
try {
21+
const response = await fetch(url, {
22+
headers: { accept: 'application/json', 'cache-control': 'no-cache', pragma: 'no-cache' },
23+
signal: AbortSignal.timeout(10000),
24+
})
25+
if (response.ok) {
26+
const metadata = await response.json()
27+
if (metadata?.name === name && metadata?.version === version) {
28+
log(`Registry serves ${name}@${version} (attempt ${attempt}/${attempts}).`)
29+
return true
30+
}
31+
last = 'registry metadata did not match the exact package and version'
32+
} else {
33+
last = `HTTP ${response.status}`
34+
await response.body?.cancel()
35+
}
36+
} catch (error) {
37+
last = error.name === 'TimeoutError' ? 'request timed out' : 'request or JSON response failed'
38+
}
39+
log(`Visibility attempt ${attempt}/${attempts}: ${last}.`)
40+
if (attempt < attempts) await wait(10000)
41+
}
42+
log(`::error::npm publish succeeded for ${name}@${version}, but registry visibility remains unconfirmed after ${attempts} attempts (${last}). Do not republish; rerun only node .github/scripts/verify-release.cjs from this release commit.`)
43+
return false
44+
}
45+
46+
if (require.main === module) {
47+
verifyRelease(require('../../package.json')).then(visible => { process.exitCode = visible ? 0 : 1 })
48+
}
49+
50+
module.exports = { verifyRelease }

‎.github/workflows/release.yml‎

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,5 @@ jobs:
5050
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5151

5252
- name: Confirm the registry serves it
53-
run: |
54-
pkg=$(node -p "require('./package.json').version")
55-
for i in $(seq 1 10); do
56-
got=$(npm view fdeops version 2>/dev/null || true)
57-
[ "$got" = "$pkg" ] && { echo "registry serves $got"; exit 0; }
58-
sleep 6
59-
done
60-
echo "published, but the registry still serves ${got:-unknown}"; exit 1
53+
timeout-minutes: 12
54+
run: node .github/scripts/verify-release.cjs

‎CHANGELOG.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# Changelog
22

3+
## 5.1.19 - 2026-09-22
4+
5+
- Redact private and masked ingest metadata before creating filenames, keeping protected values out of inbox listings and review provenance.
6+
- Reject empty or invalid explicit MCP customer selections instead of falling back to the current workspace's customer.
7+
- Install agent pointers when an existing instruction file only mentions FDEOps; preserve existing text and keep repeat installs unchanged.
8+
- Keep new logged and debriefed risks active after earlier risks have been retired.
9+
- Preserve other workspace bindings during concurrent customer setup, and leave another writer's registry lock intact when binding fails.
10+
- Release owned file locks when a record write is refused, so repairing the file permits a retry.
11+
- Verify the exact npm release with fresh, bounded retries so registry propagation does not falsely report a failed publication.
12+
313
## 5.1.18 - 2026-09-22
414

515
- Preserve distinct staged notes when source and title match within the same second, including concurrent staging.

‎bin/fde.js‎

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,11 @@ function formatFsError(err, action, target) {
527527
}
528528

529529
let debriefTransactionActive = false
530+
let activeFileLocks = 0
530531
const ownedDebriefLocks = new Set()
531532

532533
function failFs(err, action, target) {
533-
if (debriefTransactionActive || ownedDebriefLocks.size) throw new Error(formatFsError(err, action, target))
534+
if (activeFileLocks || debriefTransactionActive || ownedDebriefLocks.size) throw new Error(formatFsError(err, action, target))
534535
console.error(formatFsError(err, action, target))
535536
process.exit(1)
536537
}
@@ -546,7 +547,7 @@ function refuseSymlinkWrite(p, opts = {}) {
546547
const msg = st.isSymbolicLink()
547548
? `refused: ${path.basename(p)} is a symlink - write would leave the engagement tree. Replace it with a real file.`
548549
: `refused: ${path.basename(p)} is not a regular file - remove it and re-run; every write is refused while it is there.`
549-
if ((debriefTransactionActive || ownedDebriefLocks.size) && !opts.soft) throw new Error(msg)
550+
if ((activeFileLocks || debriefTransactionActive || ownedDebriefLocks.size) && !opts.soft) throw new Error(msg)
550551
if (opts.soft) return msg
551552
console.error(msg)
552553
process.exit(1)
@@ -563,7 +564,7 @@ function refuseSymlinkWrite(p, opts = {}) {
563564
// appending the same .fde file otherwise interleave/corrupt under load.
564565
function withFileLock(targetPath, fn, opts = {}) {
565566
if (ownedDebriefLocks.has(targetPath)) return fn()
566-
if (debriefTransactionActive || ownedDebriefLocks.size) opts = { ...opts, soft: true }
567+
if (activeFileLocks || debriefTransactionActive || ownedDebriefLocks.size) opts = { ...opts, soft: true }
567568
const lockPath = targetPath + '.lock'
568569
const deadline = Date.now() + 5000
569570
while (true) {
@@ -585,9 +586,12 @@ function withFileLock(targetPath, fn, opts = {}) {
585586
if (opts.soft) throw e
586587
failFs(e, 'lock', targetPath)
587588
}
589+
// Filesystem failures must unwind this lock instead of exiting in place.
590+
activeFileLocks++
588591
try {
589592
return fn()
590593
} finally {
594+
activeFileLocks--
591595
try { fs.closeSync(fd) } catch (_) {}
592596
try { fs.unlinkSync(lockPath) } catch (_) {}
593597
}
@@ -794,6 +798,13 @@ function appendLogEntry(eng, type, entry, opts = {}) {
794798
})
795799
// Durable CLI ledger - not rewritten by agent artifact passes.
796800
lockedAppendFile(path.join(eng, SIGNAL_LEDGER), `${entry}\n`)
801+
} else if (type === 'risk') {
802+
withFileLock(p, () => {
803+
const md = readEng(eng, LOG_FILES[type])
804+
const retired = md.search(/^#{1,6}\s+Retired\b/im)
805+
const end = retired < 0 ? md.length : retired
806+
atomicWriteFile(p, `${md.slice(0, end).trimEnd()}\n\n${entry}\n${retired < 0 ? '' : '\n' + md.slice(end)}`, { soft: true })
807+
})
797808
} else {
798809
lockedAppendFile(p, `\n${entry}\n`)
799810
}
@@ -1406,14 +1417,18 @@ function cmdResume(args) {
14061417
// line - resolution is first-match-wins, so appending a second line would
14071418
// leave the stale binding winning and silently write to the wrong client.
14081419
const cwd = process.cwd()
1409-
const prev = readRegistry().find(r => r.workspace === cwd)
1410-
const kept = readRegistry().filter(r => r.workspace !== cwd).map(r => `${r.workspace} ${r.slug}`)
1411-
kept.push(`${cwd} ${slug}`)
1420+
let prev
14121421
let bindErr = null
14131422
// soft: an unwritable registry must not process.exit() from inside the lock -
14141423
// that skipped the finally and left a stale .registry.lock behind.
14151424
try {
1416-
withFileLock(REGISTRY, () => { atomicWriteFile(REGISTRY, kept.join('\n') + '\n', { soft: true }) }, { soft: true })
1425+
withFileLock(REGISTRY, () => {
1426+
const registry = readRegistry()
1427+
prev = registry.find(r => r.workspace === cwd)
1428+
const kept = registry.filter(r => r.workspace !== cwd).map(r => `${r.workspace} ${r.slug}`)
1429+
kept.push(`${cwd} ${slug}`)
1430+
atomicWriteFile(REGISTRY, kept.join('\n') + '\n', { soft: true })
1431+
}, { soft: true })
14171432
} catch (e) { bindErr = e }
14181433
if (bindErr || !readRegistry().some(r => r.workspace === cwd && r.slug === slug)) {
14191434
// Silently unbound is the worst outcome: the memory exists, every later
@@ -1423,7 +1438,6 @@ function cmdResume(args) {
14231438
`could not bind this workspace - ${REGISTRY} is not writable${bindErr ? ` (${bindErr.code || bindErr.message})` : ''}.\n` +
14241439
` fix the file (it must be a regular file), or work with: export FDEOPS_ENGAGEMENT=${fdeDir}\n`
14251440
)
1426-
try { fs.unlinkSync(REGISTRY + '.lock') } catch (_) {}
14271441
process.exit(1)
14281442
}
14291443
console.log(`ENGAGEMENT READY: ${fdeDir}\nbound to workspace: ${cwd}`)
@@ -2540,7 +2554,10 @@ function cmdIngest(args) {
25402554
if (args[i] === '--force') { force = true; continue }
25412555
rest.push(args[i])
25422556
}
2543-
source = sanitizeIngestToken(source, 'manual')
2557+
// Redact before slugification: filenames no longer retain privacy markers.
2558+
const cleanMetadata = value => masking.mask(splitPrivate(value, { sealDangling: true }).clean).replace(/[\r\n]+/g, ' ')
2559+
source = sanitizeIngestToken(cleanMetadata(source), 'manual')
2560+
title = cleanMetadata(title)
25442561
const titleSlug = sanitizeIngestToken(title || 'notes', 'notes')
25452562
if (!title) title = titleSlug
25462563

‎bin/install.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,10 @@ function placePointer(destPath, content, label, appendable) {
294294
mkdir(path.dirname(destPath))
295295
if (fs.existsSync(destPath)) {
296296
const existing = fs.readFileSync(destPath, 'utf8')
297-
if (/FDEOS|fdeops/i.test(existing)) {
297+
// Templates can change wording; a branded pointer remains installed.
298+
const hasIdentity = existing.includes(FDE_MARKER) || /^#\s+fde(?:ops|os)\b/im.test(existing)
299+
const hasSkillPointer = /\bskills\/fde\/SKILL\.md\b/.test(existing)
300+
if (hasIdentity && hasSkillPointer) {
298301
console.log(` skip ${label} (already wired)`)
299302
return
300303
}

‎mcp/fdeops-ingest/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fdeops-ingest-mcp",
3-
"version": "5.1.18",
3+
"version": "5.1.19",
44
"private": true,
55
"description": "Thin stdio MCP sink for FDEOps ingest (stage \u2192 propose \u2192 apply). Zero runtime dependencies.",
66
"bin": {

‎mcp/fdeops-ingest/server.js‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,11 @@ function runFde(args, stdin, extraEnv) {
164164
}
165165

166166
function engagementEnv(args) {
167-
const p = args && typeof args.engagement === 'string' ? args.engagement.trim() : ''
168-
return p ? { FDEOPS_ENGAGEMENT: p } : {}
167+
if (!Object.prototype.hasOwnProperty.call(args, 'engagement')) return {}
168+
if (typeof args.engagement !== 'string' || !args.engagement.trim()) {
169+
throw new Error('engagement must be a non-empty string when supplied; no customer was selected')
170+
}
171+
return { FDEOPS_ENGAGEMENT: args.engagement.trim() }
169172
}
170173

171174
function cliPayload(out) {

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fdeops",
3-
"version": "5.1.18",
3+
"version": "5.1.19",
44
"description": "Skills for forward deployed engineers across strategy, architecture and engineering. Use individual tasks or @fde coordination; local customer memory supports continuity.",
55
"bin": {
66
"fdeops": "bin/install.js",

‎plugin.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
33
"name": "fdeops",
4-
"version": "5.1.18",
4+
"version": "5.1.19",
55
"description": "Skills for forward deployed engineers across strategy, architecture and engineering. Use individual tasks or @fde coordination; local customer memory supports continuity.",
66
"author": {
77
"name": "Subash Natarajan",

0 commit comments

Comments
 (0)