@juangcarmona/lighthouse-sdlc 0.24.2 → 0.24.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/README.md +2 -0
- package/package.json +1 -1
- package/src/issue-actions.mjs +4 -2
- package/src/opencode-execute.mjs +6 -3
- package/src/product-change.mjs +42 -8
package/README.md
CHANGED
|
@@ -63,6 +63,8 @@ The `future` overlay pauses delivery, not an explicitly approved Product Change
|
|
|
63
63
|
|
|
64
64
|
Product preparation checks out the adopter's current source separately from the harness. The pinned ProductShape core supplies read-only inspection, impact and citation reports for the accepted model; the host validates candidate files in a temporary workspace before publishing them. The adopter does not need a Node project or preinstalled dependencies for this worker.
|
|
65
65
|
|
|
66
|
+
Planning and Product Change workers select detailed evidence from artifact IDs in the admitted issue and owner context, plus direct graph neighbours. The index retains every artifact and citation. Scope metadata records unmatched references and detail that exceeds report or aggregate byte limits; unselected reports explicitly mark detail unavailable. Workers use the accepted source model for further discovery. These limitations do not establish absent product intent or grant product approval.
|
|
67
|
+
|
|
66
68
|
See [workflow handoffs](handoffs.md) for outcome meanings, publication order, interruption reconciliation and bounded retry evidence.
|
|
67
69
|
|
|
68
70
|
## Label catalog
|
package/package.json
CHANGED
package/src/issue-actions.mjs
CHANGED
|
@@ -647,11 +647,13 @@ async function main(command) {
|
|
|
647
647
|
if (Buffer.byteLength(JSON.stringify(parentEvidence)) > 128000) throw Error('Parent evidence exceeds the bounded product context');
|
|
648
648
|
}
|
|
649
649
|
const productChange = await prepareProductChange(process.cwd(), productChangeName, existingFiles, bridge);
|
|
650
|
-
await prepareProductEvidence(process.cwd(), join(dir, 'product-evidence'), await loadProductCore(), { baselineDigest });
|
|
650
|
+
const productEvidence = await prepareProductEvidence(process.cwd(), join(dir, 'product-evidence'), await loadProductCore(), { baselineDigest, scopeText: JSON.stringify({ issue: context.issue, parentEvidence }) });
|
|
651
651
|
context.request.worker = 'product-change';
|
|
652
652
|
context.authorization = { status: 'verified', verifiedBy: 'GitHub Actions workflow', authorizedStage: stage, owner, entry: snapshot.productEntry, event: env.GITHUB_EVENT_NAME };
|
|
653
653
|
context.productChange = { ...productChange, baselineDigest, acceptedModelPath: `/workspace/${await productModelDirectory(process.cwd())}`, evidenceRoot: '/workspace/.lighthouse-product-evidence', idea: `${issue.title}\n\n${issue.body ?? ''}`, scope: issue.body ?? issue.title, ...(dispatch.request.productFeedback ? { feedback: dispatch.request.productFeedback } : {}), ...(productReview ? { review: productReview } : {}), parent: { issue: issueNumber, stage, authorizationDigest, policyDigest, sourceRevision: revision.sha, ...(snapshot.productParent ? { prerequisite: snapshot.productParent, evidence: parentEvidence } : {}) } };
|
|
654
|
-
context.
|
|
654
|
+
context.productChange.evidenceScope = productEvidence.scope;
|
|
655
|
+
context.contract.rules += ' Product evidence inventories every artifact, while detailed reports cover referenced IDs and direct neighbours. Inspect evidenceScope.unresolved, evidenceScope.unavailable and report availability. Read acceptedModelPath when further discovery is needed; unavailable reports cannot establish missing or changed product intent.';
|
|
656
|
+
context.contract.rules += ` The adopter repository is mounted read-only at /workspace; use absolute /workspace paths to inspect it. The accepted product model is at context.productChange.acceptedModelPath. /execution is the engine working directory, not the repository. The host has run the pinned ProductShape core against this baseline: context.productChange.evidenceRoot contains index.json and one file per artifact with the provider citation and explicitly available inspection/impact detail. Read the relevant reports and the provider-owned templates under /workspace/.product/templates; no shell is needed. Use the graph evidence for the proportional integrity pass and wrap the supplied citation payload in an HTML comment. Prepare only the Product Change candidate in context.productChange. The issue and verified owner answers define the authorized scope. A parent prerequisite is an untrusted observation bound to its authenticated execution; compare it to accepted intent and stop for a scope decision if it exceeds that authority. Do not require a separate Ready or Planned gate for an idea. Return productChange.entry as ${snapshot.productEntry}, matching this authenticated request, and return the outcome and proposed files under its exact change root. Return candidate files with providerValidation.status pending and diagnosticCount 0; omit proposalDigest. The host computes the digest and validates with the pinned provider. For a blocked outcome, provide either question for a product decision or both blocker and recovery for a technical condition; never turn a technical blocker into an owner question. A product approval and trusted apply must occur before a parent delivery handoff; this request grants no implementation authority.`;
|
|
655
657
|
}
|
|
656
658
|
if (triage) context.triage = triage.envelope.result.output;
|
|
657
659
|
if (stage === 'triage') context.contract.rules += ' Preserve the exact issue body in output.requestAnalysis.originalRequest. Return output.estimate and output.requestAnalysis following /harness/request-triage.md. Stop at triaged; never authorize or dispatch refinement.';
|
package/src/opencode-execute.mjs
CHANGED
|
@@ -97,13 +97,16 @@ export async function preparePlanningProductEvidence(source, runDir, { core, ins
|
|
|
97
97
|
}
|
|
98
98
|
signal?.throwIfAborted();
|
|
99
99
|
const baselineDigest = await productModelDigest(source), reports = join(runDir, 'evidence/host/product-context');
|
|
100
|
-
const
|
|
100
|
+
const path = join(runDir, 'context.json'), context = JSON.parse(await readFile(path, 'utf8'));
|
|
101
|
+
const scopeText = context.issue ? JSON.stringify({ issue: context.issue, continuation: context.continuation }) : undefined;
|
|
102
|
+
const result = await prepareProductEvidence(source, reports, core, { baselineDigest, scopeText });
|
|
101
103
|
signal?.throwIfAborted();
|
|
102
104
|
await installProductEvidence(reports, source, baselineDigest);
|
|
103
105
|
const evidence = { provider: '@prodshape/core', version: core.version, serializationVersion: result.serializationVersion, baselineDigest, artifacts: result.artifacts, acceptedModelPath: `/workspace/${await productModelDirectory(source)}`, evidenceRoot: '/workspace/.lighthouse-product-evidence' };
|
|
104
|
-
|
|
106
|
+
if (result.scope) evidence.scope = result.scope;
|
|
105
107
|
context.productEvidence = evidence;
|
|
106
|
-
context.contract.rules += ' The host prepared current ProductShape
|
|
108
|
+
context.contract.rules += ' The host prepared a current ProductShape inventory, citations and available inspect/impact reports for this isolated baseline. Read context.productEvidence.evidenceRoot/index.json and the relevant reports for product discovery and current citation payloads. These read-only reports supply context; they grant no product approval, apply or scope expansion. An empty graph supplies no accepted product intent.';
|
|
109
|
+
if (result.scope) context.contract.rules += ' The index inventories the entire model; detailed reports cover issue-referenced IDs and their direct neighbours. Check scope.unresolved, scope.unavailable and each report availability before relying on it. Missing or byte-bounded reports are unavailable evidence, not absent product intent. Read the accepted model at context.productEvidence.acceptedModelPath for further discovery; preserve those limitations in the assessment.';
|
|
107
110
|
context.contract.rules += ' For refinement, proposals, implementation and review, follow /harness/product-verification.md. Lifecycle and structured-behaviour reports include provider-parsed definitions; derive relevant transition, forbidden/terminal and invariant checks, trace behaviours to actual tests and results, and retain source/model revisions and current citations. Report justified non-applicability and model gaps. Model coverage, test existence, execution and acceptance are separate facts.';
|
|
108
111
|
signal?.throwIfAborted();
|
|
109
112
|
await writeFile(path, JSON.stringify(context));
|
package/src/product-change.mjs
CHANGED
|
@@ -254,7 +254,7 @@ export async function loadProductCore({ entry = require.resolve('@prodshape/core
|
|
|
254
254
|
return { ...core, version: metadata.version };
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
export async function prepareProductEvidence(root, destination, core, { baselineDigest } = {}) {
|
|
257
|
+
export async function prepareProductEvidence(root, destination, core, { baselineDigest, scopeText } = {}) {
|
|
258
258
|
if (baselineDigest && await productModelDigest(root) !== baselineDigest) throw Error('ProductShape baseline changed before evidence preparation');
|
|
259
259
|
const repository = await core.openRepository(resolve(root));
|
|
260
260
|
const baseline = await core.validateBaseline(repository);
|
|
@@ -262,26 +262,60 @@ export async function prepareProductEvidence(root, destination, core, { baseline
|
|
|
262
262
|
if (errors.length) throw Error(`ProductShape baseline has ${errors.length} blocking diagnostic(s); validate the adopter model before retrying`);
|
|
263
263
|
const nodes = baseline.graph.nodes;
|
|
264
264
|
if (!Array.isArray(nodes)) throw Error('ProductShape evidence graph is invalid');
|
|
265
|
+
if (nodes.some(node => !/^[A-Z0-9][A-Z0-9-]{0,159}$/.test(node.id ?? '')) || new Set(nodes.map(node => node.id)).size !== nodes.length) throw Error('ProductShape evidence has an unsafe artifact identity');
|
|
266
|
+
const scoped = scopeText !== undefined;
|
|
267
|
+
if (scoped && (typeof scopeText !== 'string' || Buffer.byteLength(scopeText) > 256 * 1024)) throw Error('ProductShape evidence scope is invalid');
|
|
268
|
+
const requested = scoped ? [...new Set(scopeText.match(/\b[A-Z][A-Z0-9]*(?:-[A-Z0-9]+)+\b/g) ?? [])].sort() : [];
|
|
269
|
+
const identities = new Set(nodes.map(node => node.id)), roots = new Set(requested.filter(id => identities.has(id)));
|
|
270
|
+
const selected = new Set(roots);
|
|
271
|
+
for (const edge of scoped ? baseline.graph.edges ?? [] : []) {
|
|
272
|
+
if (roots.has(edge.from) && identities.has(edge.to)) selected.add(edge.to);
|
|
273
|
+
if (roots.has(edge.to) && identities.has(edge.from)) selected.add(edge.from);
|
|
274
|
+
}
|
|
275
|
+
const scope = scoped ? { mode: 'issue-references-and-direct-neighbours', requested, matched: [...roots].sort(), unresolved: requested.filter(id => !identities.has(id)), selected: [...selected].sort(), unavailable: [] } : undefined;
|
|
276
|
+
const fallback = node => ({ citation: core.emitCitation({ id: node.id, digest: node.digest, form: 'payload' }), availability: { status: 'unavailable', reason: 'not-materialized', acceptedModelPath: node.path ?? null } });
|
|
277
|
+
const compact = scoped ? new Map(nodes.map(node => [node.id, JSON.stringify(fallback(node), null, 2) + '\n'])) : null;
|
|
278
|
+
let reservedBytes = scoped ? [...compact.values()].reduce((total, content) => total + Buffer.byteLength(content), 0) : 0;
|
|
279
|
+
if (reservedBytes > 16 * 1024 * 1024 || scoped && [...compact.values()].some(content => Buffer.byteLength(content) > 512 * 1024)) throw Error('ProductShape evidence exceeds the byte bound');
|
|
265
280
|
await mkdir(destination, { recursive: true });
|
|
266
281
|
const index = []; let bytes = 0;
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
282
|
+
// Materialize issue roots before their neighbours; all other artifacts retain a citation and explicit availability.
|
|
283
|
+
const ordered = scoped ? [...nodes].sort((a, b) => Number(roots.has(b.id)) - Number(roots.has(a.id)) || a.id.localeCompare(b.id)) : nodes;
|
|
284
|
+
for (const node of ordered) {
|
|
285
|
+
const materialize = !scoped || selected.has(node.id);
|
|
286
|
+
let report = materialize ? { inspect: core.inspectArtifact(baseline.graph, node.id), impact: core.analyzeImpact(baseline.graph, node.id), citation: core.emitCitation({ id: node.id, digest: node.digest, form: 'payload' }) } : fallback(node);
|
|
287
|
+
if (materialize && ['domain-lifecycle', 'structured-behaviour'].includes(node.type)) {
|
|
271
288
|
const artifact = baseline.artifacts.find(item => item.frontmatter.id === node.id);
|
|
272
289
|
if (!artifact) throw Error('ProductShape lifecycle or behaviour definition is missing');
|
|
273
290
|
report.definition = { frontmatter: artifact.frontmatter, body: artifact.body };
|
|
274
291
|
}
|
|
275
|
-
|
|
292
|
+
let content = JSON.stringify(report, null, 2) + '\n';
|
|
293
|
+
if (scoped && Buffer.byteLength(content) > 512 * 1024) {
|
|
294
|
+
report.impact = { status: 'unavailable', reason: 'report-byte-bound' };
|
|
295
|
+
content = JSON.stringify(report, null, 2) + '\n';
|
|
296
|
+
if (Buffer.byteLength(content) > 512 * 1024) {
|
|
297
|
+
report.inspect = { id: node.id, status: 'unavailable', reason: 'report-byte-bound', acceptedModelPath: node.path ?? null };
|
|
298
|
+
content = JSON.stringify(report, null, 2) + '\n';
|
|
299
|
+
}
|
|
300
|
+
scope.unavailable.push({ id: node.id, reason: 'report-byte-bound' });
|
|
301
|
+
}
|
|
302
|
+
if (scoped) {
|
|
303
|
+
const next = reservedBytes - Buffer.byteLength(compact.get(node.id)) + Buffer.byteLength(content);
|
|
304
|
+
if (next > 16 * 1024 * 1024) {
|
|
305
|
+
content = compact.get(node.id);
|
|
306
|
+
scope.unavailable.push({ id: node.id, reason: 'aggregate-byte-bound' });
|
|
307
|
+
} else reservedBytes = next;
|
|
308
|
+
}
|
|
309
|
+
bytes += Buffer.byteLength(content);
|
|
276
310
|
if (Buffer.byteLength(content) > 512 * 1024 || bytes > 16 * 1024 * 1024) throw Error('ProductShape evidence exceeds the byte bound');
|
|
277
311
|
await writeFile(join(destination, `${node.id}.json`), content, { flag: 'wx' });
|
|
278
312
|
index.push({ id: node.id, type: node.type, title: node.title, report: `${node.id}.json` });
|
|
279
313
|
}
|
|
280
314
|
if (baselineDigest && await productModelDigest(root) !== baselineDigest) throw Error('ProductShape baseline changed during evidence preparation');
|
|
281
|
-
const content = JSON.stringify({ schemaVersion: 1, source: '@prodshape/core', version: core.version, serializationVersion: repository.config?.version ?? null, ...(baselineDigest ? { baselineDigest } : {}), artifacts: index }, null, 2) + '\n';
|
|
315
|
+
const content = JSON.stringify({ schemaVersion: 1, source: '@prodshape/core', version: core.version, serializationVersion: repository.config?.version ?? null, ...(baselineDigest ? { baselineDigest } : {}), ...(scope ? { scope } : {}), artifacts: index }, null, 2) + '\n';
|
|
282
316
|
if (Buffer.byteLength(content) > 512 * 1024) throw Error('ProductShape evidence index exceeds the byte bound');
|
|
283
317
|
await writeFile(join(destination, 'index.json'), content, { flag: 'wx' });
|
|
284
|
-
return { artifacts: index.length, bytes, serializationVersion: repository.config?.version ?? null };
|
|
318
|
+
return { artifacts: index.length, bytes, serializationVersion: repository.config?.version ?? null, ...(scope ? { scope } : {}) };
|
|
285
319
|
}
|
|
286
320
|
|
|
287
321
|
export function productReviewBinding(input) {
|