surfaceplate 0.16.0__py3-none-any.whl

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 (96) hide show
  1. surfaceplate/MANIFEST.sha256 +230 -0
  2. surfaceplate/VERSION +1 -0
  3. surfaceplate/__init__.py +18 -0
  4. surfaceplate/about.py +48 -0
  5. surfaceplate/adapters/python.md +5 -0
  6. surfaceplate/adapters/r.md +3 -0
  7. surfaceplate/adapters/typescript.md +5 -0
  8. surfaceplate/adopt/__init__.py +15 -0
  9. surfaceplate/adopt/catalogue.py +78 -0
  10. surfaceplate/adopt/defaults.py +278 -0
  11. surfaceplate/adopt/detect.py +141 -0
  12. surfaceplate/adopt/discover.py +614 -0
  13. surfaceplate/adopt/example_answers.py +128 -0
  14. surfaceplate/adopt/explanations.py +551 -0
  15. surfaceplate/adopt/flow.py +559 -0
  16. surfaceplate/adopt/interview.py +237 -0
  17. surfaceplate/adopt/plan.py +1330 -0
  18. surfaceplate/adopt/provenance.py +300 -0
  19. surfaceplate/adopt/render.py +282 -0
  20. surfaceplate/adopt/scaffold.py +343 -0
  21. surfaceplate/adopt/sections.py +287 -0
  22. surfaceplate/adopt/tui/__init__.py +7 -0
  23. surfaceplate/adopt/tui/app.py +211 -0
  24. surfaceplate/adopt/tui/app.tcss +294 -0
  25. surfaceplate/adopt/tui/mark.py +77 -0
  26. surfaceplate/adopt/tui/screens.py +1772 -0
  27. surfaceplate/adopt/validators.py +224 -0
  28. surfaceplate/adopt/wizard.py +932 -0
  29. surfaceplate/check_conformance.py +3664 -0
  30. surfaceplate/cli.py +268 -0
  31. surfaceplate/core/AI_OPERATING_MODEL.md +45 -0
  32. surfaceplate/core/CONFORMANCE_LEVELS.md +299 -0
  33. surfaceplate/core/CONTROL_PRINCIPLES.md +14 -0
  34. surfaceplate/core/PREREQUISITE_GATES.md +322 -0
  35. surfaceplate/core/REVIEW_AND_EVIDENCE.md +55 -0
  36. surfaceplate/core/SECURITY_BASELINE.md +29 -0
  37. surfaceplate/doctor.py +249 -0
  38. surfaceplate/examples/application-profile.essential.example.yaml +126 -0
  39. surfaceplate/examples/application-profile.full.example.yaml +315 -0
  40. surfaceplate/examples/method-registry-entry.example.yaml +78 -0
  41. surfaceplate/examples/method-run-lineage.example.yaml +44 -0
  42. surfaceplate/examples/override-record.approved.example.yaml +39 -0
  43. surfaceplate/install_standard.py +880 -0
  44. surfaceplate/rules.py +148 -0
  45. surfaceplate/schemas/README.md +24 -0
  46. surfaceplate/schemas/application-profile.schema.yaml +320 -0
  47. surfaceplate/schemas/assurance-evidence.schema.yaml +33 -0
  48. surfaceplate/schemas/gate-exception.schema.yaml +47 -0
  49. surfaceplate/schemas/method-registry-entry.schema.yaml +132 -0
  50. surfaceplate/schemas/method-run-lineage.schema.yaml +72 -0
  51. surfaceplate/schemas/override-record.schema.yaml +76 -0
  52. surfaceplate/seeds/CHANGELOG.md +18 -0
  53. surfaceplate/seeds/activity-register.md +47 -0
  54. surfaceplate/seeds/adoption-decision-record.md +30 -0
  55. surfaceplate/seeds/data-source-register.md +18 -0
  56. surfaceplate/seeds/decision-log.md +28 -0
  57. surfaceplate/seeds/dependency-review-log.md +18 -0
  58. surfaceplate/seeds/findings-register.md +26 -0
  59. surfaceplate/seeds/method-registry-readme.md +7 -0
  60. surfaceplate/seeds/options-log.md +18 -0
  61. surfaceplate/seeds/output-validation-log.md +18 -0
  62. surfaceplate/seeds/overrides-readme.md +7 -0
  63. surfaceplate/seeds/release-checklist.md +19 -0
  64. surfaceplate/seeds/risk-classification.md +24 -0
  65. surfaceplate/seeds/run-lineage-readme.md +7 -0
  66. surfaceplate/seeds/source-of-truth-matrix.yaml +25 -0
  67. surfaceplate/seeds/test-conventions.md +20 -0
  68. surfaceplate/standard/.githooks/.gitattributes +1 -0
  69. surfaceplate/standard/.githooks/pre-commit +35 -0
  70. surfaceplate/standard/.github/skills/bug-fix/SKILL.md +57 -0
  71. surfaceplate/standard/.github/skills/change/SKILL.md +62 -0
  72. surfaceplate/standard/.github/skills/dependency-update/SKILL.md +61 -0
  73. surfaceplate/standard/.github/skills/fix-ci/SKILL.md +68 -0
  74. surfaceplate/standard/.github/skills/release/SKILL.md +71 -0
  75. surfaceplate/standard/.github/skills/review/SKILL.md +56 -0
  76. surfaceplate/standard/.github/skills/security-review/SKILL.md +61 -0
  77. surfaceplate/standard/.github/workflows/standards-conformance.yml +38 -0
  78. surfaceplate/standard/agent-instructions/activity.md +78 -0
  79. surfaceplate/standard/agent-instructions/ai-workflow.md +109 -0
  80. surfaceplate/standard/agent-instructions/authority.md +72 -0
  81. surfaceplate/standard/agent-instructions/provenance.md +93 -0
  82. surfaceplate/standard/agent-instructions/security.md +78 -0
  83. surfaceplate/standard/agent-instructions/tests.md +71 -0
  84. surfaceplate/standard/conformance-block.md +31 -0
  85. surfaceplate/templates/application-profile.yaml +113 -0
  86. surfaceplate/templates/decision-record.md +42 -0
  87. surfaceplate/templates/gate-exception.yaml +23 -0
  88. surfaceplate/templates/override-record.yaml +25 -0
  89. surfaceplate/templates/work-packet.md +33 -0
  90. surfaceplate-0.16.0.dist-info/METADATA +19 -0
  91. surfaceplate-0.16.0.dist-info/RECORD +96 -0
  92. surfaceplate-0.16.0.dist-info/WHEEL +4 -0
  93. surfaceplate-0.16.0.dist-info/entry_points.txt +2 -0
  94. surfaceplate-0.16.0.dist-info/licenses/LICENSE +201 -0
  95. surfaceplate-0.16.0.dist-info/licenses/LICENSE-DOCS +121 -0
  96. surfaceplate-0.16.0.dist-info/licenses/NOTICE +24 -0
@@ -0,0 +1,128 @@
1
+ """Recognition-over-recall defaults for rationale fields: a real example to react to, not a blank
2
+ box to stare at.
3
+
4
+ `DR-35` records the design principle: every rationale field a real adopter answers offers an
5
+ editable example, shown as the prompt's `default=` - the same "shown, must be explicitly
6
+ submitted" pattern `review_by` and `enforcement` already use elsewhere in this wizard. Accepting a
7
+ default is still answering; nothing here is written unless a human's actual keystroke (even just
8
+ Enter) submits it.
9
+
10
+ Sourced, not invented: every string below is drawn from `examples/application-profile.essential
11
+ .example.yaml` or `examples/application-profile.full.example.yaml` - this framework's own two
12
+ worked, schema-valid example profiles - or, where those don't cover an item, composed directly
13
+ from that item's own rule text in `core/PREREQUISITE_GATES.md`.
14
+
15
+ **Deliberately scoped, not complete over every field.** Only rationale fields get an example - not
16
+ a gate's precondition artefact, gated paths, or effective date, which are too repository-specific
17
+ to usefully example and where a plausible-looking example risks being copied unedited. Within
18
+ rationale fields, only items whose rationale prompt is genuinely reachable get an entry here:
19
+
20
+ - The three baseline controls and the nine conformance-level controls: every one is covered, since
21
+ `ask_controls` always asks a rationale for each.
22
+ - Of the nineteen gates, only the eleven whose `required`/`deferred`/`not_applicable` choice is
23
+ ever actually asked. `work_registration`, `authority_map`, `decision_before_implementation`, and
24
+ `change_record_before_completion` are mandatory `required` at every level that asks about them at
25
+ all (`sections.py`'s `_ask_one_gate` skips the choice entirely when `mandatory=True`), and the
26
+ four interface gates (`catalogue.DESIGN_GATES`) are either forced `required` (a UI-building
27
+ repository) or auto-filled `not_applicable` with their own existing default (a repository with no
28
+ UI) before `_ask_one_gate` is ever reached for them. None of those eight ever shows the
29
+ `not_applicable`/`deferred` rationale prompt this module's gate examples are for.
30
+ `tests/test_adopt.py` derives this eleven-gate set the same way `sections.py` itself decides
31
+ which gates are optional - `GATE_CATALOGUE` minus `DESIGN_GATES` minus
32
+ `LEVEL_REQUIRED_GATES["standard"]` - rather than a hand-copied list, so it cannot silently drift
33
+ from what the wizard actually asks.
34
+ """
35
+
36
+ from __future__ import annotations
37
+
38
+ # --- Baseline controls (all three; always asked) -----------------------------------------------
39
+ # Sourced from application-profile.essential.example.yaml, which states each in its punchiest form.
40
+
41
+ _BASELINE_CONTROL_RATIONALE: dict[str, str] = {
42
+ "agent_work_packets": "All agent work is bounded, scoped, and reviewable.",
43
+ "actual_diff_review": "Material changes require actual diff content, not a file list.",
44
+ "secret_hygiene": "No secrets or customer data may enter the repository or fixtures.",
45
+ }
46
+
47
+ # --- Conformance-level controls (all nine; always asked when required at the chosen level) ------
48
+ # Sourced from application-profile.full.example.yaml (essential.example.yaml for dependency_lock,
49
+ # which full.example.yaml does not declare at all - full already exceeds essential's own floor).
50
+
51
+ _LEVEL_CONTROL_RATIONALE: dict[str, str] = {
52
+ "dependency_lock": "Supply-chain exposure exists regardless of output materiality.",
53
+ "deterministic_tests": "Outputs must be reproducible before they can be reviewed.",
54
+ "contract_tests": "The API is consumed by a separate frontend and would break silently.",
55
+ "documentation_authority": "Contradictory specification authority is treated as a blocking defect.",
56
+ "provenance": "Every material figure must be traceable to its inputs and parameter version.",
57
+ "run_lineage": "Material calculations must be reproducible from a recorded execution.",
58
+ "method_registry": "Governed rules carry lifecycle, validation, and approval state.",
59
+ "overrides": "A manual adjustment must never be hidden in calculation code.",
60
+ "assurance_findings": "Limitations are recorded rather than smoothed away.",
61
+ }
62
+
63
+ # --- Gates whose status is ever a genuine choice (eleven of nineteen; see module docstring) ------
64
+ # Composed from each gate's own rule text and group description in core/PREREQUISITE_GATES.md,
65
+ # phrased as a plausible not_applicable-leaning rationale an early-stage adopter might actually
66
+ # give - editable, and deliberately not phrased as an endorsement that the reasoning is sound for
67
+ # every repository.
68
+
69
+ _GATE_RATIONALE: dict[str, str] = {
70
+ "work_contract": (
71
+ "No AI-assisted implementation happens in this repository yet; every change is made by a "
72
+ "human contributor directly."
73
+ ),
74
+ "risk_classification": (
75
+ "Risk classification is not yet a formal step in this repository's workflow; changes are "
76
+ "reviewed informally through code review today."
77
+ ),
78
+ "register_currency": (
79
+ "This repository's work register is small enough to check manually at each handover; no "
80
+ "generated view exists yet to gate against."
81
+ ),
82
+ "test_convention": (
83
+ "No formal, written test-naming or location convention exists yet; tests are added ad hoc "
84
+ "and their placement is reviewed in code review."
85
+ ),
86
+ "authority_same_change": (
87
+ "This repository has no authority_map gate declared, so there is no controlling document "
88
+ "for a change to keep in step with yet."
89
+ ),
90
+ "regression_before_merge": (
91
+ "No logic in this repository is critical enough yet to name a dedicated regression suite; "
92
+ "ordinary test coverage runs on every change instead."
93
+ ),
94
+ "equivalence_evidence": (
95
+ "This repository has not yet made a performance or refactoring change on a critical path; "
96
+ "nothing has needed equivalence evidence so far."
97
+ ),
98
+ "data_source_lifecycle": (
99
+ "This repository selects from a fixed, small set of data sources chosen at build time; "
100
+ "there is no runtime selection step for this gate to guard."
101
+ ),
102
+ "output_validation_before_external_use": (
103
+ "Nothing this repository generates leaves the delivery team today; outputs are consumed "
104
+ "only by the team that produced them."
105
+ ),
106
+ "dependency_output_delta": (
107
+ "This repository's dependencies do not influence its output - they support the build and "
108
+ "test process only."
109
+ ),
110
+ "records_before_release": (
111
+ "This repository has not yet prepared a release; there is no release process for this gate "
112
+ "to guard yet."
113
+ ),
114
+ }
115
+
116
+ RATIONALE_EXAMPLES: dict[str, str] = {
117
+ **_BASELINE_CONTROL_RATIONALE,
118
+ **_LEVEL_CONTROL_RATIONALE,
119
+ **_GATE_RATIONALE,
120
+ }
121
+
122
+
123
+ def rationale_example(item_id: str) -> str:
124
+ """The example rationale for `item_id`, or `""` if none exists - the same "no default" shape
125
+ `_nonempty_text`'s own `default=""` already uses everywhere this module doesn't apply. Never
126
+ raises: unlike `explanations.explain`, an absent example is an expected, scoped state for the
127
+ eight gates the module docstring names, not a coverage gap."""
128
+ return RATIONALE_EXAMPLES.get(item_id, "")