Repository navigation
Add lint.inactive_ok: pattern rules for citations of retired documents that need no acknowledgement - #378
Open
dmarx wants to merge 2 commits into
Open
Add lint.inactive_ok: pattern rules for citations of retired documents that need no acknowledgement#378dmarx wants to merge 2 commits into
dmarx wants to merge 2 commits into
Conversation
A scheme may now declare which citers may cite one of its retired
statuses without an acknowledgement:
citable_from:
Answered: [QUESTION:Open]
A site whose citer document matches a declared (status, prefix, status)
triple is `sanctioned`: acknowledgements.lp no longer reads it as
retired, so it needs no inactive-ok and one written over it is reported
stale, with the reason. Citation.loud is the single test the flagged
report, `luria ack` and the pending report now use. The loader refuses
an unknown cited status, the scheme's own `active` word, an undeclared
citer scheme and an unknown citer status (consistency.lp), and malformed
shapes (config.py).
Fired on a copy of nucleation: its 13 parent-question inactive-ok
annotations go stale and no other finding changes.
Record: ADR-tmpfu1s6, changelog fragment, devlog entry.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KC8NN4NtUf8sd5unC6dpFV
Review asked for a generic shape: the per-scheme `citable_from` could
only express status, and status words are scheme-specific. A citation
that needs no acknowledgement is now declared once, as the config-level
form of the `inactive-ok` directive:
lint:
inactive_ok:
- match: "(:QUESTION {status: 'Open'})-[:cites]->(:QUESTION {status: 'Answered'})"
reason: a split parent cites the Answered child split off it
The pattern is read by the existing pattern grammar over a reserved
`cites` edge; labels and properties go through check_patterns, which
(with patterns.parse) now takes where the pattern was declared. The
loader refuses, by lint.inactive_ok[N], anything but one `cites` hop,
variable length, WHERE NOT, unknown schemes or fields, unlabelled nodes,
and a missing reason. Matching sites still emit sanctioned(I); a
directive made redundant names the rule, and a rule that sanctions no
citation is a stale-directives row with its reason (DP-015).
Scheme.citable_from and its four consistency refusals are removed.
Fired on a copy of nucleation: the 13 parent annotations go stale,
naming lint.inactive_ok[0]; unacknowledged rows unchanged (480).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KC8NN4NtUf8sd5unC6dpFV
This branch has not been deployed
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.
Why
In nucleation, the QUESTION scheme has
active: Open. When an Open parent question is split, its answered part becomes a child question with status Answered (nucleation's ADR-049). The parent then cites that child, and theretired-citationscheck warns on every such citation, because any status other thanactivecounts as retired. The owner's rule is that an Open question citing an Answered one is legitimate. A citation from anywhere else should still warn: it either still treats the question as open, or it should cite the CLAIM or THEORY that answers it. Today the only remedy is aninactive-okcomment at each site.What
lint.inactive_okis the config-level form of theinactive-okdirective. It is a list of rules written in the existing pattern syntax (patterns.lark), with a reserved hop typecites:A citation of a retired document is sanctioned, and needs no acknowledgement, when the document it appears in matches the source node and the cited document matches the target node. Properties match any front-matter field (status, role, warrant and so on), as they do in
patterns.X. Thematch:value has to be quoted in YAML, because an unquoted{starts a mapping.Refused at load, each naming
lint.inactive_ok[N]:matchandreason;reason, mandatory for the same reason directive reasons are;citesalone;WHERE NOT;MATCHand similar keywords.Labels and properties are checked by the same code that checks
patterns.X. The grammar is not forked:patterns.parseandcheck_patternseach take an optional argument naming where the pattern was declared.Dead rules (DP-015). A rule that sanctions nothing is reported as a
stale-directivesrow, with its pattern and reason. Aninactive-okcomment that a rule has made redundant is reported stale, with a message naming the rule.Internals. A matching site emits
sanctioned(I), andretired(I)inacknowledgements.lpnow requiresnot sanctioned(I).Citationgainssanctionedand aloudproperty, whichflagged(),ack.pyandadr_pending.pyuse to decide what is unacknowledged. Sanctioned sites are not counted as acknowledged, because they aren't suppressions. The export'sexcusedcolumn keeps its meaning, "a directive acknowledges it".History of this PR
The first commit added a per-scheme
citable_from: {Answered: [QUESTION:Open]}. The owner asked for something more general, since status words are specific to one scheme and that form could only express status. The second commit replaces it with the pattern rules above. The ADR recordscitable_fromas a rejected alternative, alongside:activeas a list, which would also silence a document still citing a now-Answered question as open;Record
ADR-tmpfu1s6, numbered at merge.inactive-okcomments went stale, each naminglint.inactive_ok[0];config_docgains a section, so the configuration reference documents the key.Tests
tests/test_inactive_ok_rules.py, 27 tests; the 26 written first failed before the change.luria lintgives the same finding classes and counts as main.🤖 Generated with Claude Code
https://claude.ai/code/session_01KC8NN4NtUf8sd5unC6dpFV