Repository navigation
feat(standards): implement Ada & SPARK structural signatures (#76) - #1140
Merged
Merged
Conversation
Adds the full 54-key baseline signature dict for Ada/SPARK to
LANGUAGE_DEFINITIONS, following how_to_add_a_language.md's generation and
strict-testing protocol.
The epic/issue's suggested lexical_family ("hybrid_dash") doesn't exist
anywhere in the engine and doesn't match Ada's real comment grammar (no
native block-comment form). Using it verbatim would have silently disabled
comment stripping for every Ada file: Prism's generic stripper falls
through with an empty compiled pattern for any family name it doesn't
recognize. Registered a new, properly-wired "line_exclusive_dash" family
instead (gitgalaxy_config.py's LEXICAL_FAMILY_HEURISTICS + a new branch in
prism.py's _compile_regex_matrix) scoped to Ada's actual single-token `--`
comment grammar, rather than widening the existing shared "line_exclusive"
family (which would have silently truncated real code in Perl/Assembly,
both of which use `--` as a real operator -- the same failure mode #621
already fixed once by narrowing "standard_block").
Verified via tests/extraction/languages/test_ada.py (extraction gauntlet:
func_start/args/class_start/_dependency_capture) and test_ada_strict.py
(per-signature coverage, schema completeness, symbolic-boundary/nested-
delimiter/ReDoS/ambiguity audits, and an end-to-end Prism.split_streams()
proof that -- comments are actually stripped). Full test suite, ruff/mypy/
dead-key baseline audits, and crucible_check.py (both full-precision and
zero-dependency modes) all pass with zero diff -- the language-crucible
corpus has no Ada files yet, confirmed via find, so the zero diff proves no
off-target blast radius on the other ~80 languages rather than Ada-specific
coverage.
Co-Authored-By: Claude Sonnet 5 <[email protected]>
Contributor
The shared aspect-mark vocabulary (decorators/import/_dependency_capture) only covered the foundational SPARK contract aspects (Pre/Post/Global/ Depends/SPARK_Mode), missing the data-flow refinement aspects (Abstract_State/Initializes/Refined_Global/Refined_Post/Refined_State/ Refined_Depends) used to formally model a package's private state for the prover -- common in real SPARK code. They didn't misfire as false imports (the `=>` already breaks import's required trailing-`;` grammar shape either way), they were just invisible to every signature. Also adds the `pragma SPARK_Mode (On);` form, structurally distinct from the `with SPARK_Mode => On` aspect form already covered -- both are real and common. Co-Authored-By: Claude Sonnet 5 <[email protected]>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements #76 (epic #75, "Aerospace Compliance & Enterprise Integration",
Phase 1) -- adds native Ada/SPARK structural-signature support to
gitgalaxy/standards/language_standards.py, followinggitgalaxy/standards/how_to_add_a_language.md's generation andstrict-testing protocol.
rulesdict forada(extensions.adb/.ads/.ada).5 keys are explicit
Nonewhere Ada genuinely has no equivalent(
ui_framework,closures,tabs_vs_spaces,ssr_boundaries,dependency_injection) -- Strict Feature Parity, not an oversight.safetycovers Implement Ada & SPARK Structural Signatures #76's explicit ask: strict-typing range constraints(
type ... is range, and the equally commonsubtype X is Base range Lo .. Hiform) plus a scoped safety-pragma vocabulary (pragma Assert,Precondition,Postcondition,Invariant) -- deliberately not barepragma, since most pragmas (Pack,Import, ...) have nothing to dowith safety.
apicovers package specs (package ... is), correctly excludingpackage body ...and generic-instantiationpackage X is new ...via negative lookaheads (not optional groups, per Rule 15).
class_startcovers Ada's real OOP entity -- tagged types, both rootdeclarations (
type Foo is tagged record) and derived/extended ones(
type Dog is new Animal with record, where the literal wordtaggedis never repeated, so the derived form needs its own alternative or an
entire inheritance chain becomes invisible).
func_startrequires a real subprogram body (Rule 7: strict executionanchoring), excluding spec-only declarations,
abstract/nullprocedures, and generic-subprogram instantiations -- while still
matching SPARK's common
with Pre => ..., Post => ...aspect clausebetween the profile and
is.A real pipeline bug caught before it shipped
Both the issue and epic label Ada's
lexical_family"hybrid_dash". Thatname doesn't exist anywhere in the engine. Using it verbatim would have
silently broken comment stripping for every Ada file:
prism.py's genericstripper falls through with an empty compiled pattern for any family name
it doesn't recognize, so
--comments would never be removed from the codestream, contaminating every downstream signature count with comment noise.
Root cause: Ada genuinely has no block-comment form ("no native block
comments historically" is in #76's own checklist, directly contradicting
the
"hybrid_dash"name it also asks for). Reusing the existing"line_exclusive"family was also rejected -- its shared delimiter list isconsumed by several other languages (Perl, Assembly) that use
--as areal operator/decrement; widening it would silently truncate their real
code, the exact failure mode #621 already fixed once by narrowing
"standard_block".Fix: registered a new, properly-wired
"line_exclusive_dash"family(single
--delimiter, no block form) ingitgalaxy_config.py'sLEXICAL_FAMILY_HEURISTICS, and added the matching branch inprism.py's_compile_regex_matrix(). Verified end-to-end with a realPrism.split_streams()call (seetest_ada_lexical_family_is_correctly_ wired_not_just_labeled), not just that the config key exists.Test plan
tests/extraction/languages/test_ada.py-- extraction gauntlet(func_start/args/class_start/_dependency_capture: valid/invalid/
pathological/ReDoS-immunity cases)
tests/extraction/languages/test_ada_strict.py-- per-signaturepositive/negative coverage for all 49 non-
Nonekeys, schemacompleteness audit, symbolic-boundary audit (Ada attributes like
'Class/'Access), nested-delimiter audit,re.Mcompletenessaudit, ambiguity sweep (documents intentional double-classifications
like
protected/delayfiring bothconcurrencyand their morespecific sibling, mirroring COBOL's existing
EXEC CICS ENQprecedent), and a geometric ReDoS scaling sweep
python tests/tools/audit_check.py-- ruff/mypy/dead-key baselinesall clean,
ruff format .cleanpython tests/tools/crucible_check.py-- both full-precision andzero-dependency modes pass with zero diff (the language-crucible
corpus has no Ada files yet, confirmed via
find, so this proves nooff-target blast radius on the other ~80 languages rather than
Ada-specific regression coverage)
python -m pytest tests/-- full suite green (6700 passed)Closes #76.