Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 68 additions & 7 deletions BITCODE_SPEC_V45_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,23 +114,29 @@ production-grade:

## V45 gate sequencing rule

V45 proceeds in three ordered movements:
V45 proceeds in four ordered movements:

1. Specification atom gates. Each small protocol specification atom is its own
gate and pull request. Each atom must be correct alone before the next atom
begins, and every atom must be reconciled into the gestalt of Bitcode as the
knowledge commoditization system.
2. Specification parity matrix gate. After the specification atoms are accepted,
one gate builds the V45 parity matrix comparing every accepted specification
update against implementation, tests, proofs, generated artifacts,
workflows, documentation, and interface surfaces.
3. Grouped implementation gates. Only after the parity matrix is accepted do
2. Formal specification consolidation gate. After the notes-level
specification atoms are accepted, one gate updates the V45 specification
family from those accepted atoms before implementation auditing begins.
3. Specification parity matrix gate. After the V45 specification family is
updated, one gate audits implementation against the formalized
specification and builds the V45 parity matrix across source code, tests,
proofs, generated artifacts, workflows, documentation, and interface
surfaces.
4. Grouped implementation gates. Only after the parity matrix is accepted do
implementation gates begin, grouped by coherent protocol/product work rather
than by isolated prose atoms.

This ordering is itself V45 protocol-development law: do not start
implementation work, broad parity claims, or promotion planning while the
specification atoms remain unsettled.
specification atoms remain unsettled, while accepted notes have not yet been
consolidated into the V45 specification family, or while implementation parity
has not yet been audited from that formal specification.

## V45 protocol atom 1: knowledge commoditization system

Expand Down Expand Up @@ -419,6 +425,61 @@ confirmed finality as prerequisite to BTD rights transfer, source unlock only
after settlement readback, refund/escalation as fail-closed repair, and
contributor compensation as post-finality source-to-shares allocation.

## V45 protocol-development atom 5: notes-to-spec consolidation before parity

Audit classification: V45 is intentionally opening through small notes-level
specification atoms because the protocol law must be correct atom by atom
before it is expanded into a full canonical candidate. The missing process
precision was the boundary between notes and implementation parity: accepted
notes are not enough to audit implementations. V45 must first consolidate the
accepted notes into the formal V45 specification family, then audit source
against that formal specification.

Protocol-development law:

After the notes-level specification atoms are accepted, V45 must run a formal
specification consolidation gate before any implementation parity matrix gate.
That consolidation gate updates the V45 specification family from the accepted
notes, reconciles terminology across the full document set, preserves the V44
active canon pointer until promotion, and validates that the V45 formal
specification is internally coherent before implementation auditing begins.
The implementation parity matrix must audit against the formal V45
specification family, not against loose notes, branch discussion, PR bodies,
or operator memory.

The required sequence is:

| Movement | Output | Forbidden shortcut |
| --- | --- | --- |
| `notes-specification-atoms` | Accepted notes-level protocol atoms, each merged through its gate branch | combining unresolved atoms into a broad parity or implementation claim |
| `formal-specification-consolidation` | Updated V45 specification family with accepted atoms reconciled into protocol law | auditing implementation directly from notes or PR discussion |
| `implementation-parity-audit` | V45 parity matrix comparing formal specification to code, tests, proofs, workflows, docs, generated artifacts, and interfaces | claiming parity before the formal specification exists |
| `grouped-implementation-closure` | Grouped implementation gates derived from the accepted parity matrix | implementing speculative behavior before the parity matrix is accepted |

Consolidation law:

- The formal specification consolidation gate must update the V45 spec-family
documents before any implementation audit begins.
- The consolidation gate must preserve `BITCODE_SPEC.txt -> V44` while V45 is
still a draft target; promotion remains a later gate.
- The consolidation gate must reconcile accepted notes into one coherent V45
protocol law, including AssetPack lifecycle, BTD scalar-volume, BTC
settlement, source safety, interface authority, proof roots, and operational
boundaries.
- The parity matrix gate must cite the formal V45 specification family as its
source of truth. It may cite notes only as historical provenance for why the
formal specification changed.
- Implementation gates must be grouped from parity gaps found against the
formal specification, not from isolated notes, UI desire, or ad hoc code
inspection.

Acceptance for this atom: later V45 sequencing may add more notes atoms or
split formal specification documents further, but it must preserve
notes-specification atoms before formal spec consolidation, formal spec
consolidation before implementation parity auditing, parity auditing before
grouped implementation closure, and V44 as the active canon pointer until V45
promotion.

## Non-goals during V45 opening

- Do not implement V45 gate behavior before the V45 intent discussion is
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@
"check:v45-gate3": "node scripts/check-v45-gate3-assetpack-lifecycle-state-machine.mjs",
"check:v45-gate4": "node scripts/check-v45-gate4-btd-scalar-volume-state-machine.mjs",
"check:v45-gate5": "node scripts/check-v45-gate5-btc-settlement-state-machine.mjs",
"check:v45-gate6": "node scripts/check-v45-gate6-spec-consolidation-sequencing.mjs",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Wire Gate 6 into required gate quality

This adds the V45 Gate 6 checker as a package script, but it is not invoked by the maintained workflows: with BITCODE_SPEC.txt still V44, .github/workflows/bitcode-gate-quality.yml only runs the V44 spec/promoted checks and check-v44-gate10 in its V44 branch (I inspected the workflow around lines 524-528, and the canon-quality workflow has the same V44-only block). As a result a V45 Gate 6 PR can merge green even if this new sequencing checker fails or the notes drift, which defeats the gate-closure validation this script is meant to enforce.

Useful? React with 👍 / 👎.

"generate:v38-inference-surface-inventory": "node scripts/generate-v38-inference-surface-inventory.mjs",
"check:v38-inference-surface-inventory": "node scripts/generate-v38-inference-surface-inventory.mjs --check",
"check:v38-gate2": "node scripts/check-v38-gate2-inference-surface-inventory.mjs",
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-v45-gate2-knowledge-commoditization-law.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function main() {
'Specification atom gates',
'Each small protocol specification atom is its own gate and pull request',
'Specification parity matrix gate',
'comparing every accepted specification update against implementation, tests, proofs, generated artifacts, workflows, documentation, and interface surfaces',
'builds the V45 parity matrix across source code, tests, proofs, generated artifacts, workflows, documentation, and interface surfaces',
'Grouped implementation gates',
'Only after the parity matrix is accepted do implementation gates begin',
'do not start implementation work, broad parity claims, or promotion planning while the specification atoms remain unsettled',
Expand Down
141 changes: 141 additions & 0 deletions scripts/check-v45-gate6-spec-consolidation-sequencing.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!/usr/bin/env node

import { execFileSync } from 'node:child_process';
import { existsSync, readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const defaultRepoRoot = path.resolve(__dirname, '..');

function read(root, relativePath) {
return readFileSync(path.join(root, relativePath), 'utf8');
}

function exists(root, relativePath) {
return existsSync(path.join(root, relativePath));
}

function git(root, args) {
return execFileSync('git', args, { cwd: root, encoding: 'utf8' }).trim();
}

function assertCheck(failures, condition, message) {
if (!condition) failures.push(message);
}

function normalize(content) {
return content.replace(/\s+/gu, ' ').trim();
}

function parseArgs(argv) {
const args = { repoRoot: defaultRepoRoot, skipBranchCheck: false };
for (let index = 0; index < argv.length; index += 1) {
const arg = argv[index];
if (arg === '--repo-root') args.repoRoot = path.resolve(argv[++index]);
else if (arg === '--skip-branch-check') args.skipBranchCheck = true;
else if (arg === '--help' || arg === '-h') args.help = true;
else throw new Error(`Unknown argument ${arg}`);
}
return args;
}

function printHelp() {
process.stdout.write(
[
'Usage: node scripts/check-v45-gate6-spec-consolidation-sequencing.mjs [--skip-branch-check] [--repo-root <path>]',
'',
'Checks the V45 notes-to-spec consolidation sequencing atom.',
].join('\n'),
);
process.stdout.write('\n');
}

function main() {
const args = parseArgs(process.argv.slice(2));
if (args.help) {
printHelp();
return;
}

const root = args.repoRoot;
const failures = [];
const pointer = read(root, 'BITCODE_SPEC.txt').trim();

assertCheck(failures, pointer === 'V44', `BITCODE_SPEC.txt must remain V44 during V45 atom work. Observed ${pointer || 'empty'}.`);

if (!args.skipBranchCheck) {
const branch = git(root, ['branch', '--show-current']);
assertCheck(
failures,
branch === 'version/v45' || /^v45\/gate-\d+-[a-z0-9][a-z0-9-]*$/u.test(branch),
`V45 work must occur on version/v45 or v45/gate-N-* branches. Observed ${branch || 'detached HEAD'}.`,
);
}

for (const relativePath of [
'BITCODE_SPEC_V45_NOTES.md',
'BITCODE_SPEC_V44.md',
'BITCODE_SPEC.txt',
'package.json',
'scripts/check-v45-gate5-btc-settlement-state-machine.mjs',
]) {
assertCheck(failures, exists(root, relativePath), `Missing required V45 Gate 6 file: ${relativePath}`);
}

const notes = read(root, 'BITCODE_SPEC_V45_NOTES.md');
const normalizedNotes = normalize(notes);
const packageJson = read(root, 'package.json');

for (const phrase of [
'V45 proceeds in four ordered movements',
'Formal specification consolidation gate',
'After the notes-level specification atoms are accepted, one gate updates the V45 specification family',
'After the V45 specification family is updated, one gate audits implementation',
'specification atoms remain unsettled',
'accepted notes have not yet been consolidated into the V45 specification family',
'implementation parity has not yet been audited from that formal specification',
'V45 protocol-development atom 5: notes-to-spec consolidation before parity',
'accepted notes are not enough to audit implementations',
'consolidate the accepted notes into the formal V45 specification family',
'The implementation parity matrix must audit against the formal V45 specification family',
'not against loose notes, branch discussion, PR bodies, or operator memory',
'notes-specification-atoms',
'formal-specification-consolidation',
'implementation-parity-audit',
'grouped-implementation-closure',
'formal specification consolidation gate must update the V45 spec-family documents before any implementation audit begins',
'preserve `BITCODE_SPEC.txt -> V44`',
'parity matrix gate must cite the formal V45 specification family',
'Implementation gates must be grouped from parity gaps found against the formal specification',
'notes-specification atoms before formal spec consolidation',
'formal spec consolidation before implementation parity auditing',
'parity auditing before grouped implementation closure',
]) {
assertCheck(failures, normalizedNotes.includes(phrase), `V45 Gate 6 notes must include phrase: ${phrase}`);
}

assertCheck(
failures,
packageJson.includes('"check:v45-gate6": "node scripts/check-v45-gate6-spec-consolidation-sequencing.mjs"'),
'package.json must expose check:v45-gate6.',
);

if (failures.length > 0) {
process.stderr.write('V45 Gate 6 spec consolidation sequencing check failed:\n');
for (const failure of failures) process.stderr.write(`- ${failure}\n`);
process.exitCode = 1;
return;
}

process.stdout.write('V45 Gate 6 spec consolidation sequencing check passed.\n');
}

try {
main();
} catch (error) {
const detail = error instanceof Error ? error.message : String(error);
process.stderr.write(`${detail}\n`);
process.exitCode = 1;
}
Loading