-
Notifications
You must be signed in to change notification settings - Fork 0
V45 Gate 6: Spec Consolidation Sequencing #209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
geraldarthurdavis
merged 1 commit into
version/v45
from
v45/gate-6-spec-consolidation-sequencing
May 31, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
scripts/check-v45-gate6-spec-consolidation-sequencing.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds the V45 Gate 6 checker as a package script, but it is not invoked by the maintained workflows: with
BITCODE_SPEC.txtstillV44,.github/workflows/bitcode-gate-quality.ymlonly runs the V44 spec/promoted checks andcheck-v44-gate10in 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 👍 / 👎.