Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
d5d1aa4
T050: the plain-documents fixture, spread across the six stations (pl…
brettheap Sep 27, 2026
834f8ea
T052: 5.4, declare the generator seam, and register openDox's own gen…
brettheap Sep 27, 2026
4ca45d2
T052: each declared input optional; a default's generation recorded o…
brettheap Sep 27, 2026
09560ee
Merge remote-tracking branch 'origin/main' into feat/plain-documents-…
brettheap Sep 27, 2026
f52b111
T051: the malformed fixture, one title-and-summary-are-text violation…
brettheap Sep 27, 2026
ac553e4
Merge main (T036 #52, T037 #55 -> 2d116415) into T054's branch
brettheap Sep 27, 2026
5538086
Merge T050's fixture (openDox-code#53, feat/plain-documents-fixture 0…
brettheap Sep 27, 2026
b1946db
Merge T051's fixture (openDox-code#56, feat/malformed-fixture f52b111…
brettheap Sep 27, 2026
25fe752
T054 (work in progress): openDox's small neutral projection over Corp…
brettheap Sep 27, 2026
0f42f67
T054: the projection's tests, the holder's two rulings, and the displ…
brettheap Sep 27, 2026
b2f9222
T054: compare the commit date as a time, as git spells it either way …
brettheap Sep 27, 2026
c0747e9
T054: an empty topics header is a declaration; T050's docstring says …
brettheap Sep 27, 2026
5a6fe63
T054: a word is a run of letters beside digits too; a pin labels the …
brettheap Sep 27, 2026
21dfdb7
Merge main (T036 #52, T037 #55 -> 2d116415) into T052's branch
brettheap Sep 27, 2026
bce09c5
T052: each registration keeps its own records at the generator seam
brettheap Sep 27, 2026
97b5b01
T052: leave point 6 of the seam test's docstring as T054 edits it
brettheap Sep 27, 2026
8d507c5
T052: current() reads the registration once
brettheap Sep 27, 2026
e8a733d
Merge T052's head (openDox-code#54, build/034-p2g-t052-generator-seam…
brettheap Sep 28, 2026
d89f252
T057: openDox's own validator, over its spec leg's four schemas (plan…
brettheap Sep 28, 2026
97b314a
T057: each 7.1b assertion says which way a schema entered the set (pl…
brettheap Sep 28, 2026
69f2040
T057: hold the workbench kind over the manifests openDox writes (plan…
brettheap Sep 28, 2026
ca52182
T057: ship the validator's copies as package data (plan 034)
brettheap Sep 28, 2026
bc3470b
T057: refuse a malformed copy as unavailable, never crash on it (plan…
brettheap Sep 28, 2026
c27eac3
T055: serve and generate standalone (5.5, 4.3 part) (plan 034)
brettheap Sep 28, 2026
ea49c42
T055: the canonical path meets the hidden-name rule; a token variable…
brettheap Sep 28, 2026
2b32cbf
T057: refuse a reference cycle that never moves into the instance (pl…
brettheap Sep 28, 2026
bfb9c47
T055: serve.main hands each data-source option over as given; droppin…
brettheap Sep 28, 2026
9d2cda1
T057: hold the record to the four, and read pointers as RFC 6901 does…
brettheap Sep 28, 2026
244d7b7
T055: the unavailable-validator warning says which of its two cases h…
brettheap Sep 28, 2026
4474514
T057: order unlike keys by repr, and refuse YAML nested past the limi…
brettheap Sep 28, 2026
19c2678
T055: the writer refuses what JSON cannot carry; one request serves t…
brettheap Sep 28, 2026
8c09d74
T055: the source arm resolves its entry once, and asks for the path b…
brettheap Sep 28, 2026
80b5f9e
T057: judge values of any size or depth without crashing (plan 034)
brettheap Sep 28, 2026
f4ef63d
T055: the default writer replaces the snapshot atomically
brettheap Sep 28, 2026
8defc37
Merge main 2d116415 (T037, #55) into T050's branch
brettheap Sep 29, 2026
521de95
T050: the docstring says the required check collects this suite
brettheap Sep 29, 2026
7028f61
T050: the unrelated source shares no topic with the pair, not just no…
brettheap Sep 29, 2026
4ba410f
T050: compare each source's whole derived topic set; pin the fixture'…
brettheap Sep 29, 2026
44dcc3a
Merge main 2d116415 (T037, #55) into T051's branch
brettheap Sep 29, 2026
fd55f9f
Merge T052's head (openDox-code#54, build/034-p2g-t052-generator-seam…
brettheap Sep 29, 2026
ba6adf5
Merge T050's head (openDox-code#53, feat/plain-documents-fixture 4ba4…
brettheap Sep 29, 2026
07d2b1b
Merge T051's head (openDox-code#56, feat/malformed-fixture 44dcc3a1) …
brettheap Sep 29, 2026
d97a4aa
Merge main dc3765dd (T050 landed, #53) into T054's branch
brettheap Sep 29, 2026
2f515c5
Merge main dc3765dd (T050 landed, #53) into T052's branch
brettheap Sep 29, 2026
32bd4fa
Merge T052's head (openDox-code#54 2f515c57) into T054's branch
brettheap Sep 29, 2026
8e7da4a
T054: openDox's own scaffold carries the small neutral field set
brettheap Sep 29, 2026
27bcefc
Merge T054's head (openDox-code#57, build/034-p2p-t054-neutral-projec…
brettheap Sep 29, 2026
8cbb1ea
Merge T054's head (openDox-code#57, build/034-p2p-t054-neutral-projec…
brettheap Sep 29, 2026
d7aa9d8
T055: an empty --project-register or --possibles is refused, fail closed
brettheap Sep 29, 2026
bf51a30
T057: an instance deeper than the walk is judged, not crashed on
brettheap Sep 29, 2026
687d37b
T055: a refresh keeps the snapshot's permissions
brettheap Sep 29, 2026
6b68e32
T057: a violation's detail shows a bound of any size
brettheap Sep 29, 2026
96f18c4
T055: the source arm's two lookups are made under the registry's lock
brettheap Sep 29, 2026
e3ef506
T055: the arm confines its entry in hand, reads take the lock, the re…
brettheap Sep 29, 2026
1a60367
Merge main fa8862cc (T051 and T052 landed, #56 and #54) into T054's b…
brettheap Sep 29, 2026
e94ab32
T057: the record and SPEC_COMMIT move to the spec commit the root pin…
brettheap Sep 29, 2026
03e06cc
T054: a scaffold's leading title and summary are one header line each
brettheap Sep 29, 2026
65c943f
T056: the standalone generate path, end to end, and the served URL is…
brettheap Sep 29, 2026
e71aeb9
Merge T057's head (openDox-code#58 e94ab323) into T058's branch
brettheap Sep 30, 2026
1597511
T056: the lone-openDox child process becomes a test helper, for T058'…
brettheap Sep 30, 2026
50b0d42
T054: one emptiness rule in both vocabularies; the commit date uses t…
brettheap Sep 30, 2026
3b13f14
Merge T056's head (openDox-code#66 1597511d) into T058's branch
brettheap Sep 30, 2026
d7954fc
T054: the projection reads keys as paths only where the adapter decla…
brettheap Sep 30, 2026
3d0b6d6
T058: the post-render validator in the generate verbs is openDox's own
brettheap Sep 30, 2026
1433234
Merge T054's final head (openDox-code#57, d7954fc6) into T057's branch
brettheap Sep 30, 2026
cb40b97
Merge main a691e4e4 (T054 landed, #57) into T057's branch
brettheap Sep 30, 2026
42a08a3
T056: an interrupted child that will not stop is killed before its pi…
brettheap Sep 30, 2026
92a9167
Merge T054's final head (openDox-code#57, d7954fc6) into T055's branch
brettheap Sep 30, 2026
814516b
Merge main a691e4e4 (T054 landed, #57) into T055's branch
brettheap Sep 30, 2026
09cd1e8
Merge T056's head (openDox-code#66 42a08a3a) into T058's branch
brettheap Sep 30, 2026
28241a4
T058: an unreadable packaged file is unavailable, and the rules read …
brettheap Sep 30, 2026
3351f6a
T057: a const or enum that holds a value JSON has not is refused at b…
brettheap Sep 30, 2026
5a26532
Merge T055's head (openDox-code#59 814516b7) into T056's branch
brettheap Sep 30, 2026
729f9e6
Merge T056's head (openDox-code#66 5a26532e) into T058's branch
brettheap Sep 30, 2026
21e4723
Merge T057's head (openDox-code#58 3351f6af) into T058's branch
brettheap Sep 30, 2026
2b8ad24
T057: a packaged file that is present but unreadable is refused, not …
brettheap Sep 30, 2026
753ffa1
T057: an instance key of any size is named in a pointer and a report,…
brettheap Sep 30, 2026
e939c31
T056: the undeclared stage: value is looked for inside every string, …
brettheap Sep 30, 2026
ac4d9b5
Merge T056's head (openDox-code#66 e939c315) into T058's branch
brettheap Sep 30, 2026
69ca0e2
T058: a kind given twice chooses no validator, 1e999 is not JSON, and…
brettheap Sep 30, 2026
1ec7d2c
T058: a number that cannot be read as written is refused, in the snap…
brettheap Sep 30, 2026
8015375
Merge T057's head (openDox-code#58 753ffa19) into T058's branch
brettheap Sep 30, 2026
c2a8ad9
Merge main 8ec08e91 (T057 landed, #58) into T055's branch
brettheap Sep 30, 2026
e357477
Merge T055's head (openDox-code#59 c2a8ad9f) into T056's branch
brettheap Sep 30, 2026
03825eb
Merge T056's head (openDox-code#66 e3574774) into T058's branch
brettheap Sep 30, 2026
c7768ed
T058: a number spelling that cannot be proved as written is refused
brettheap Sep 30, 2026
183b40f
T055: a regenerate passes the project register only when one is set
brettheap Sep 30, 2026
caa01ca
T056: the "serving until interrupted" line is read while the server runs
brettheap Sep 30, 2026
38761c7
Merge T055's head (openDox-code#59 183b40fc) into T056's branch
brettheap Sep 30, 2026
5bfbb46
Merge T056's head (openDox-code#66 38761c76) into T058's branch
brettheap Sep 30, 2026
cd6b33c
T058: a readable document holding an unreadable number breaks documen…
brettheap Sep 30, 2026
a6e953c
Merge main (fa140875, T055 landed as openDox-code#59) into T056's branch
brettheap Sep 30, 2026
149d729
T056: the harness gives the child Ctrl-C as at a terminal, whatever t…
brettheap Sep 30, 2026
a7bda06
T056: the stage notice's six keys are checked as one rendered list
brettheap Sep 30, 2026
923f30d
Merge T056's head (openDox-code#66 a7bda066) into T058's branch
brettheap Sep 30, 2026
5322efe
Merge main (a23e4224, T056 landed as openDox-code#66) into T058's branch
brettheap Sep 30, 2026
1678ccd
T058: the syntax message names the kind as a kind, "a document of kin…
brettheap Sep 30, 2026
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
39 changes: 35 additions & 4 deletions src/opendox/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,12 +365,37 @@
"dashboard's empty funnel reads the same either way", file=sys.stderr)


class _RepeatedKey(ValueError):
"""A JSON object in the written snapshot gives one key twice."""


def _refuse_repeated_keys(pairs: list[tuple[str, object]]) -> dict:
document: dict = {}
for key, value in pairs:
if key in document:
raise _RepeatedKey(f"the key {key!r} twice in one object")
document[key] = value
return document


def _written_kind(written: Path) -> str | None:
"""The `kind` the written snapshot declares, which chooses its validator,
or None where the file declares none it can be read by."""
or None where the file declares none it can be read by.

A KEY GIVEN TWICE IS REFUSED, `_RepeatedKey` (plan 034 T058; Copilot at
openDox-code#68 09cd1e8a, r4139769819). Python's `json` keeps the last
of two, so `"kind": "opendox-snapshot", "kind": "unknown"` chose no
registered validator, and an ordinary run then warned and exited 0,
though no reader could say which contract the file meant. Such a
document has no one meaning, whatever its kind, so no validator is chosen
for it. Which constants or numbers a contract admits is the chosen
validator's to judge, since none of them makes the kind ambiguous."""
try:
document = json.loads(written.read_text(encoding="utf-8"))
except (OSError, UnicodeDecodeError, ValueError):
document = json.loads(written.read_text(encoding="utf-8"),
object_pairs_hook=_refuse_repeated_keys)
except _RepeatedKey:
raise
except (OSError, UnicodeDecodeError, ValueError, RecursionError):

Check warning on line 398 in src/opendox/cli.py

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Remove this redundant Exception class; it derives from another which is already caught.

See more on https://sonarcloud.io/project/issues?id=opensoft_openDox-code&issues=AaDv5HnovWE33729Elvw&open=AaDv5HnovWE33729Elvw&pullRequest=68
return None
kind = document.get("kind") if isinstance(document, dict) else None
return kind if isinstance(kind, str) and kind else None
Expand Down Expand Up @@ -487,7 +512,13 @@
print(" validation skipped (--no-validate)")
return 0
repo_root = Path(args.repo_root).resolve()
kind = _written_kind(written)
try:
kind = _written_kind(written)
except _RepeatedKey as exc:
print(f" validation FAILED — {written} gives {exc}, so it has no one "
f"meaning: its kind cannot be read, and no validator can be "
f"chosen for it.", file=sys.stderr)
return 1
if kind is None:
print(f" validation FAILED — {written} declares no kind, so no "
f"validator can be chosen for it, and a snapshot that does not "
Expand Down
Loading
Loading