dsl41 0.1.0__tar.gz

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.
Files changed (70) hide show
  1. dsl41-0.1.0/.github/workflows/release.yml +40 -0
  2. dsl41-0.1.0/.gitignore +9 -0
  3. dsl41-0.1.0/CLAUDE.md +86 -0
  4. dsl41-0.1.0/COMMERCIAL.md +14 -0
  5. dsl41-0.1.0/LICENSE +661 -0
  6. dsl41-0.1.0/LICENSING.md +26 -0
  7. dsl41-0.1.0/PKG-INFO +251 -0
  8. dsl41-0.1.0/README.md +218 -0
  9. dsl41-0.1.0/docs/autosys-semantics.md +380 -0
  10. dsl41-0.1.0/docs/decision-log.md +723 -0
  11. dsl41-0.1.0/docs/ir-design.md +334 -0
  12. dsl41-0.1.0/docs/jil-statement-syntax.md +124 -0
  13. dsl41-0.1.0/docs/stonebranch-semantics.md +216 -0
  14. dsl41-0.1.0/grammars/condition.lark +80 -0
  15. dsl41-0.1.0/pyproject.toml +61 -0
  16. dsl41-0.1.0/src/dsl41/__init__.py +18 -0
  17. dsl41-0.1.0/src/dsl41/ast_jil.py +709 -0
  18. dsl41-0.1.0/src/dsl41/backend_uc.py +588 -0
  19. dsl41-0.1.0/src/dsl41/cli.py +482 -0
  20. dsl41-0.1.0/src/dsl41/conditions.py +430 -0
  21. dsl41-0.1.0/src/dsl41/derive.py +825 -0
  22. dsl41-0.1.0/src/dsl41/dsl.py +1288 -0
  23. dsl41-0.1.0/src/dsl41/equiv.py +868 -0
  24. dsl41-0.1.0/src/dsl41/ir.py +1362 -0
  25. dsl41-0.1.0/src/dsl41/lint.py +891 -0
  26. dsl41-0.1.0/src/dsl41/oracle.py +835 -0
  27. dsl41-0.1.0/src/dsl41/placeholders.py +217 -0
  28. dsl41-0.1.0/src/dsl41/py.typed +0 -0
  29. dsl41-0.1.0/src/dsl41/uc_oracle.py +490 -0
  30. dsl41-0.1.0/src/dsl41/viz.py +730 -0
  31. dsl41-0.1.0/tests/corpus/calendars_autocal.jil +23 -0
  32. dsl41-0.1.0/tests/corpus/comments_layout.jil +9 -0
  33. dsl41-0.1.0/tests/corpus/continuation_multiline.jil +12 -0
  34. dsl41-0.1.0/tests/corpus/fold_t003_or_join.jil +63 -0
  35. dsl41-0.1.0/tests/corpus/fold_t004_typed_links.jil +79 -0
  36. dsl41-0.1.0/tests/corpus/fold_t006_resources.jil +40 -0
  37. dsl41-0.1.0/tests/corpus/fold_t007_schedules.jil +38 -0
  38. dsl41-0.1.0/tests/corpus/kitchen_sink.jil +61 -0
  39. dsl41-0.1.0/tests/corpus/l016_resource_ref.jil +12 -0
  40. dsl41-0.1.0/tests/corpus/l018_calendar_ref.jil +17 -0
  41. dsl41-0.1.0/tests/corpus/m07_mutex.jil +32 -0
  42. dsl41-0.1.0/tests/corpus/machines_base.jil +15 -0
  43. dsl41-0.1.0/tests/corpus/machines_xinst.jil +15 -0
  44. dsl41-0.1.0/tests/corpus/names_colon_join.jil +38 -0
  45. dsl41-0.1.0/tests/corpus/oneline_form.jil +6 -0
  46. dsl41-0.1.0/tests/corpus/sem04_lookback.jil +32 -0
  47. dsl41-0.1.0/tests/corpus/sem04_lookback_pitfall.jil +19 -0
  48. dsl41-0.1.0/tests/corpus/sem06_dangling.jil +6 -0
  49. dsl41-0.1.0/tests/corpus/sem08_globals.jil +10 -0
  50. dsl41-0.1.0/tests/corpus/sem10_box_basic.jil +16 -0
  51. dsl41-0.1.0/tests/corpus/sem12_external_gate.jil +25 -0
  52. dsl41-0.1.0/tests/corpus/sem24_status_resource.jil +59 -0
  53. dsl41-0.1.0/tests/corpus/sem30_dead_config.jil +8 -0
  54. dsl41-0.1.0/tests/corpus/sem30_schedule.jil +19 -0
  55. dsl41-0.1.0/tests/corpus/sem31_xor.jil +17 -0
  56. dsl41-0.1.0/tests/corpus/torture_colon.jil +15 -0
  57. dsl41-0.1.0/tests/test_ast_fidelity.py +455 -0
  58. dsl41-0.1.0/tests/test_backend_uc.py +288 -0
  59. dsl41-0.1.0/tests/test_condition_grammar.py +88 -0
  60. dsl41-0.1.0/tests/test_conditions.py +424 -0
  61. dsl41-0.1.0/tests/test_derive.py +1039 -0
  62. dsl41-0.1.0/tests/test_dsl.py +2099 -0
  63. dsl41-0.1.0/tests/test_equiv.py +1117 -0
  64. dsl41-0.1.0/tests/test_ir.py +1167 -0
  65. dsl41-0.1.0/tests/test_lint.py +743 -0
  66. dsl41-0.1.0/tests/test_oracle.py +1677 -0
  67. dsl41-0.1.0/tests/test_placeholders.py +325 -0
  68. dsl41-0.1.0/tests/test_uc_oracle.py +1274 -0
  69. dsl41-0.1.0/tests/test_viz.py +777 -0
  70. dsl41-0.1.0/uv.lock +532 -0
@@ -0,0 +1,40 @@
1
+ # Publish to PyPI via trusted publishing (OIDC, no stored tokens) on version
2
+ # tags. One-time setup on pypi.org: Account -> Publishing -> add pending
3
+ # publisher (project dsl41, owner mrbald, repo dsl41, workflow release.yml,
4
+ # environment pypi). Release: git tag vX.Y.Z && git push origin vX.Y.Z.
5
+
6
+ name: release
7
+
8
+ on:
9
+ push:
10
+ tags: ["v*"]
11
+
12
+ jobs:
13
+ build:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - uses: astral-sh/setup-uv@v6
18
+ - run: uv sync --extra dev
19
+ - run: uv run pytest -q
20
+ - run: uv build
21
+ - run: uvx twine check --strict dist/*
22
+ - uses: actions/upload-artifact@v4
23
+ with:
24
+ name: dist
25
+ path: dist/
26
+
27
+ publish:
28
+ needs: build
29
+ runs-on: ubuntu-latest
30
+ environment:
31
+ name: pypi
32
+ url: https://pypi.org/p/dsl41
33
+ permissions:
34
+ id-token: write
35
+ steps:
36
+ - uses: actions/download-artifact@v4
37
+ with:
38
+ name: dist
39
+ path: dist
40
+ - uses: pypa/gh-action-pypi-publish@release/v1
dsl41-0.1.0/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .pytest_cache/
4
+ .ruff_cache/
5
+ .mypy_cache/
6
+ dist/
7
+ *.egg-info/
8
+ .idea/
9
+ .hypothesis/
dsl41-0.1.0/CLAUDE.md ADDED
@@ -0,0 +1,86 @@
1
+ # CLAUDE.md — working agreement for dsl41
2
+
3
+ You are implementing a migration compiler designed in a prior session. The design
4
+ is finished and normative; it lives in `docs/`. Do not re-derive it — read it.
5
+
6
+ ## Read first, in this order
7
+ 1. `docs/ir-design.md` — the central spec (pipeline, AST/IR-F/IR-G models, oracle,
8
+ equivalence tiers, linter rules L001–L015). Model sketches there are the API.
9
+ 2. `docs/jil-statement-syntax.md` — statement scanner spec + fidelity tests F1–F4.
10
+ 3. `docs/autosys-semantics.md` — SEM entries; every one implies a trace test (§8).
11
+ 4. `docs/stonebranch-semantics.md` — UCS entries + M01–M36 mapping table; the UC
12
+ backend refuses R-rows and reports A-row assumptions (Part II requirements 1–3).
13
+ 5. `docs/decision-log.md` — do not relitigate DL entries; append new ones.
14
+
15
+ ## Non-negotiable disciplines
16
+ - **No silent loss.** AST→IR-F lowering errors on unknown non-allow-listed
17
+ attributes (DL-07). UC compile refuses R-classified edges and emits migration-
18
+ report items instead. Every A-classified edge records its assumption.
19
+ - **Fidelity is tested, not asserted.** `render(parse(x)) == x` on the whole corpus
20
+ before anything else is built. Canonical mode is a fixpoint (F2).
21
+ - **IR-G is derived, never authoritative.** Pure function of IR-F; regenerate, do
22
+ not edit or persist as truth.
23
+ - **Pure compiler.** No runtime dependency in any emitted artifact.
24
+ - **Corpus hygiene.** `tests/corpus/` is synthetic/doc-derived ONLY. Never accept
25
+ production JIL from any employer estate into the repo, tests, or docs (LICENSING.md).
26
+ - **Open questions stay open.** Q1–Q7 (autosys dossier §9), U1–U8 (stonebranch
27
+ Part III) are unresolved. Those with an implemented default (Q1–Q4, Q7, U1–U5,
28
+ U8) are marked in code with `# PENDING: Qn/Un`; the rest have no code switch —
29
+ Q5/Q6 live in the autosys dossier only (Q6-adjacent aside in oracle.py), U6/U7
30
+ in backend_uc's `_U_QUESTIONS` report table. Do not guess-resolve any of them;
31
+ implement the documented default and keep the switch (see condition.lark Q1 banner).
32
+
33
+ ## Implementation order (DL-03) — one phase per PR-sized unit
34
+ All ten phases are built and tested (README's implementation memo has the source
35
+ map); this list stays as the normative order and scope of each unit.
36
+ 1. `ast_jil`: scanner per spec + preserve/canonical renderers + F1–F4 tests.
37
+ Definition of done: all corpus files round-trip byte-identical; fuzz test green.
38
+ 2. `conditions`: lark loader (both start rules, `CONDITION_PRECEDENCE` setting),
39
+ Tree→Cond transformer, lookback token validation (L015 shapes), span retention.
40
+ 3. `ir`: Pydantic models exactly as ir-design §3–4 + lowering + model validators
41
+ (XOR rules SEM-31, lookback-on-global ban SEM-04).
42
+ 4. `lint`: Violation model (stable codes, `exit_code(strict)`) + L001–L005, L015
43
+ first (pure IR-F rules); graph rules follow phase 5.
44
+ 5. `derive`: passes 1–7 from ir-design §5, including mutex/OR/same-cycle detectors.
45
+ 6. `viz`: Markdown report of per-component Mermaid charts from IR-G (boxes →
46
+ subgraph, predicate-labeled edges, collapse threshold; visual grammar,
47
+ component split, and appendices per DL-35).
48
+ 7. `oracle`: event loop + status store + box fold; port dossier §8 trace tests.
49
+ 8. `equiv`: canonical form, tier a (structural), tier b (truth table w/ atom
50
+ ceiling), tier c (oracle traces, hypothesis event scripts).
51
+ 9. `backend_uc`: BLOCKED on U3 (pull `/resources/openapi.json` from the live
52
+ controller, freeze `docs/uc-edge-schema.md`, generate client). Until then only
53
+ the migration-report emitter and edge-classification plumbing.
54
+ 10. DSL (`decompiler` + surface): LAST, extracted from patterns the corpus shows
55
+ (DL-03). Do not design combinators speculatively.
56
+
57
+ ## Testing conventions
58
+ - pytest + hypothesis; trace tests named `test_semXX_*` / pairs `test_pMxx_*`.
59
+ - Every linter rule ships with a corpus fixture that triggers it and one that
60
+ doesn't.
61
+ - The Q1 sentinel test (`test_precedence_modes_differ_where_expected`) must keep
62
+ passing until Q1 resolves; then replace it with the pinning trace test and
63
+ delete the losing grammar rule.
64
+
65
+ ## Style
66
+ - Python ≥3.12, Pydantic V2, typer CLI, ruff line length 100, mypy clean.
67
+ - snake_case throughout; small pure functions for analysis passes; no clever
68
+ metaprogramming in the IR.
69
+
70
+ ## When live-instance access is available (ask the user, don't assume)
71
+ - Resolve Q1 (precedence), Q2 (lookback-0 anchor), Q3 (time+condition composition)
72
+ with tiny throwaway jobs; record answers as SEM amendments + trace tests.
73
+ - Pull OpenAPI (U3), pin UC version, freeze edge schema.
74
+ - `autorep -q` samples may be INSPECTED by the user to inform synthetic fixture
75
+ shapes but never committed (corpus hygiene).
76
+
77
+ <!-- hats:core -->
78
+ ## Engineering core (hats)
79
+
80
+ This project uses the shared **hats engineering core**. Before substantive
81
+ work, read and follow `~/.hats/docs/USING.md`; it loads the hard rules
82
+ (`GUARDRAILS.md`), the engineering priors (`PRIORS.md`), and the validated
83
+ thinking tools. Re-read each session: the core is the source of truth and
84
+ its updates propagate here automatically. If `~/.hats` does not resolve,
85
+ the core is not linked on this machine (see the hats repo's README).
86
+ <!-- /hats:core -->
@@ -0,0 +1,14 @@
1
+ # Commercial licensing
2
+
3
+ dsl41 is dual-licensed. The public repository is offered under the GNU Affero
4
+ General Public License v3.0 only ([LICENSE](LICENSE)). If the AGPL's terms do
5
+ not fit your use — for example embedding dsl41 in a proprietary product, or
6
+ running a modified version as a network service without offering source — a
7
+ separate commercial license is available from the copyright holders.
8
+
9
+ Contact: mail@bobah.net
10
+
11
+ > This document is an availability notice, not a license grant or a contract.
12
+ > Commercial terms are agreed per customer in a signed agreement drafted with
13
+ > counsel. Until such an agreement is executed, your use of dsl41 is governed
14
+ > solely by the AGPL-3.0-only terms in [LICENSE](LICENSE).