A document's format and version are read, not just written (#1520) #1575
Closed
jaylouisw
wants to merge 1 commit from
fix/1116-0054 into main
pull from: fix/1116-0054
merge into: jaylouisw:main
jaylouisw:main
jaylouisw:rev/1121-1812
jaylouisw:catalogue/1121-1822
jaylouisw:docs/1121-1817
jaylouisw:catalogue/1121-1752
jaylouisw:docs/1121-1747
jaylouisw:rev/1121-1742
jaylouisw:catalogue/1121-1722
jaylouisw:rev/1121-1712
jaylouisw:docs/1121-1717
jaylouisw:catalogue/1121-1652
jaylouisw:rev/1121-1642
jaylouisw:docs/1121-1647
jaylouisw:ci/1121-1646
jaylouisw:ci/1121-1427
jaylouisw:rev/1121-1412
jaylouisw:catalogue/1121-1422
jaylouisw:docs/1121-1417
jaylouisw:catalogue/1121-1352
jaylouisw:rev/1121-1342
jaylouisw:docs/1121-1347
jaylouisw:rev/1121-1212
jaylouisw:catalogue/1121-1222
jaylouisw:docs/1121-1217
jaylouisw:ci/1121-1027
jaylouisw:catalogue/1121-1022
jaylouisw:rev/1121-1013
jaylouisw:docs/1121-1017
jaylouisw:catalogue/1121-0852
jaylouisw:rev/1121-0842
jaylouisw:docs/1121-0847
jaylouisw:ci/1121-0827
jaylouisw:catalogue/1121-0822
jaylouisw:rev/1121-0812
jaylouisw:catalogue/1121-0752
jaylouisw:rev/1121-0742
jaylouisw:docs/1121-0747
jaylouisw:catalogue/1121-0722
jaylouisw:docs/1121-0717
jaylouisw:rev/1121-0712
jaylouisw:rev/1121-0642
jaylouisw:plan/1121-0637
jaylouisw:ci/1121-0627
jaylouisw:catalogue/1121-0622
jaylouisw:rev/1121-0612
jaylouisw:docs/1121-0617
jaylouisw:plan/1120-0337
jaylouisw:docs/1120-0347
jaylouisw:rev/1119-1942
jaylouisw:rev/1119-1912
jaylouisw:catalogue/1119-1752
jaylouisw:docs/1119-1347
jaylouisw:catalogue/1119-1352
jaylouisw:fix/1119-1232
jaylouisw:fix/1119-0602
jaylouisw:catalogue/1119-0452
jaylouisw:catalogue/1119-0422
jaylouisw:docs/1119-0417
jaylouisw:fix/1119-0202
jaylouisw:catalogue/1119-0222
jaylouisw:rev/1119-0042
jaylouisw:catalogue/1118-2252
jaylouisw:docs/1118-2047
jaylouisw:catalogue/1118-2152
jaylouisw:fix/1118-2037
jaylouisw:ci/1118-2027
jaylouisw:docs/1118-1416
jaylouisw:fix/1118-1006
jaylouisw:catalogue/1118-0326
jaylouisw:catalogue/1117-2326
jaylouisw:catalogue/1117-0025
jaylouisw:catalogue/1116-1730
jaylouisw:fix/1523-speed-downgrade-one-end
jaylouisw:fix/enable-required-and-empty-pipe-help
jaylouisw:land-all-v5
jaylouisw:land-all-v4
jaylouisw:land-all-v3
jaylouisw:land-all-v2
jaylouisw:land-all
jaylouisw:fix/board-id
jaylouisw:fix/stated-range
jaylouisw:fix/no-form-names-v2
jaylouisw:fix/voice-vlan
jaylouisw:devices/catalogue-batch
jaylouisw:devices/powerline-moca
jaylouisw:devices/firewalls-enterprise
jaylouisw:devices/pon-splitters
jaylouisw:devices/nvr-and-taps
jaylouisw:devices/four-nvr-models
jaylouisw:fix/contributing-exemption
jaylouisw:fix/stale-github-urls
jaylouisw:ci/cancel-superseded-runs
jaylouisw:gh/1438
jaylouisw:device/uisp-console-lbe-xr
jaylouisw:gh/1442
jaylouisw:docs/readme-current-counts
jaylouisw:feat/device-ubiquiti-wave-fiber-onu
jaylouisw:fix/address-ownership
jaylouisw:feat/vrrp-in-path
jaylouisw:fix/merge-research-duplicate
jaylouisw:docs/hybrid-patch-current
jaylouisw:fix/audit-port-template
jaylouisw:fix/2930f-jl256a-uplinks
jaylouisw:feat/dhcp-in-path
jaylouisw:feat/hackgpon-ubiquiti-uisp-fiber-xgs
jaylouisw:feat/hackgpon-adtran-sdx-621
jaylouisw:tool/issue-duplicate-sweep
jaylouisw:feat/device-mikrotik-rb433ah
jaylouisw:feat/hackgpon-ma5671a
jaylouisw:issues/categories-and-labels
jaylouisw:ci/run-every-suite-locally
jaylouisw:chore/http-smoke
No reviewers
Labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
jaylouisw/packetforge!1575
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/1116-0054"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #1520
formatandversionwere written by both the saver andserialize()and compared by nothing:{"format":"bogus"}and{"version":99}both loaded as empty boards, and a saved file stampedversion: 99loaded as if the number meant nothing.What changed
DOCUMENT_FORMAT/DOCUMENT_VERSIONand one rule,stampProblem(), live inengine/topology.js;serialize()writes the stamp from those constants.Topology.fromJSON()enforces the rule at the one door every loader goes through: anotherformatis refused, aversionabove this build's is refused rather than half-read, aversionthat is not a positive whole number is refused. An unstamped document still loads - every board saved before the rule is one.savedDocProblem,documentShapeProblem,saveTopologyNow) now call the same rule, the file header is written from the same constants, and a header that disagrees with the board it wraps is refused with both values named.docs/ARCHITECTURE.mdrecords the rule.Tests
test/document-version-stamp.test.js(13 assertions), written failing first: 8 of its 13 failed before the change.npm test: 258 suites, 9402 assertions, 1 failure -test/spec-vs-description.test.js("4 device(s) promise ports they do not have"), which fails identically onorigin/mainwith this change stashed, so it is pre-existing and unrelated.node scripts/syntax-check.js: 328 files, all OK.No new features: this hardens an existing guard and removes three copies of a string.
Duplicate of #1575 — needs Jay's decision.
#1570 and #1575 are two independent fixes for the same issue (#1520: read the board document's format/version stamp instead of only writing it). Both are clean against main on their own, but they cannot both land: they rewrite the same lines.
Conflicting hunks (identical regions, different designs):
engine/topology.js— the stamp constants and the reader function:DOC_FORMAT/DOC_VERSION/documentStampProblem(doc), plainError.DOCUMENT_FORMAT/DOCUMENT_VERSION/stampProblem(doc, who),err.code = 'E_BAD_DOCUMENT', also exposesTopology.DOCUMENT_FORMAT/Topology.DOCUMENT_VERSION/Topology.stampProblem.engine/topology.jsserialize()—format: DOC_FORMAT, version: DOC_VERSIONvsformat: DOCUMENT_FORMAT, version: DOCUMENT_VERSION.engine/topology.jsTopology.fromJSON()— both insert a stamp check at the same line beforeconst topo = new Topology().server/index.jssaveTopologyNow()— header takes the pair fromrequire('../engine')(#1570) vs fromTopology.*(#1575).server/index.jssavedDocProblem()— #1570 checks envelope then board; #1575 additionally refuses a file whose header version and board version disagree, and prefixes errors withthe file header:/its board:.server/index.jsdocumentShapeProblem()— same line, same replacement.docs/ARCHITECTURE.md— different wording for the same paragraph.test/document-stamp.test.js(200 lines, #1570) vstest/document-version-stamp.test.js(89 lines, #1575).Only #1570 also touches
CHANGELOG.md.Recommendation: land #1570 first (earlier, larger test file, has the CHANGELOG entry), then let #1575 rebase and keep only the part that #1570 lacks — the header/board version-mismatch refusal and the
E_BAD_DOCUMENTcode. The alternative (land #1575, close #1570) loses the CHANGELOG entry and the 200-line test file.Verified: neither was merged. Both rebase onto
0af8f64fwith only these overlapping regions; each PR's own suites were not re-run here because a rebase of either one invalidates the other's diff.needs Jay's decision — which stamp design ships, and whether the loser's tests are folded in.
Superseded — closing. #1570 landed on main as
abda4f0d("Read the board document's format/version stamp instead of only writing it (#1520)"), so #1520 is fixed on main and this branch would re-implement it on top of it: same three source files, same hunks (theserialize()stamp literal, the head ofTopology.fromJSON(), thesaveTopologyNow()header,savedDocProblem()anddocumentShapeProblem()inserver/index.js, and the samedocs/ARCHITECTURE.mdparagraph).What main now has (
abda4f0d):DOC_FORMAT/DOC_VERSION/documentStampProblem(doc)inengine/topology.js, re-exported throughengine/index.js, used byserialize(),fromJSON(),saveTopologyNow(),savedDocProblem()anddocumentShapeProblem(); legacy documents with no stamp still load;test/document-stamp.test.js(200 lines) covers it.What this branch has that main does not, and what is therefore worth a separate PR or issue if it is wanted:
err.code = 'E_BAD_DOCUMENT', on thefromJSON()refusal;the file header says version X but its board says version Y);Topology.DOCUMENT_FORMAT/Topology.DOCUMENT_VERSION.None of those change behaviour main already relies on, so folding them in later is additive. Closing rather than rebasing because the change is already on main and a rebase here would produce a 5-file diff that duplicates
abda4f0dline for line.This branch conflicts with
main, so it was not rebased:A conflict is a decision about behaviour rather than a mechanical fix, so this is left for a human. Rebasing by hand and force-pushing will let the automation pick it up again.
Pull request closed