Repository navigation
Registry reads per predicate, and a CLI loader that keeps every battery's manifest - #1
Merged
Merged
Conversation
A default is not a fact, so a proof that falls back on one leaves nothing for a host to point at, and DataGrout listed every default in a battery's contract on every answer (late_fee_flat on a days_overdue question). check_inputs.reads_for follows each exported predicate through the battery's own clauses and records the contract facts it can read; build_registry.py writes them as `reads`, beside `inputs`.
Consulting battery files one by one redefined battery_module/3, battery_export/3 and battery_input/6 with each file, so only the last battery's manifest and contract survived (invoice_rules kept 0 of its 15 contract entries once pricing_rules loaded). install and remove now keep a batteries.pl that includes every installed battery with those predicates declared discontiguous: all clauses kept in SWI-Prolog and in Scryer, which rejects ensure_loaded/consult as directives and panics on include+multifile. A user-written batteries.pl is left alone. The seven batteries whose id is hyphenated while their directory is not (invoice-rules lives in invoice_rules/) were missing from list and install; the directory is looked up under either spelling. The CHANGELOG records this and the registry's new `reads`.
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.
What
Registry:
reads. Each battery with an input contract now publishes, for every exported predicate, the contract facts that predicate can read through the battery's own clauses (check_inputs.reads_for, emitted bybuild_registry.pybesideinputs).A default is not a fact, so a proof that falls back on one leaves nothing for a host to point at. Without
reads, a host had to report every default in the contract on every answer: a days-overdue answer listed the late-fee default. With it, a host reports only the defaults and gaps the question's predicates can reach. Batteries without a contract get noreads, and hosts that ignore the key are unaffected.CLI:
batteries.plloader.battery installandbattery removenow keep abatteries.plthat includes every installed battery, withbattery_module/3,battery_export/3andbattery_input/6declared discontiguous. Consulting battery files one by one redefined those predicates with each file, so only the last battery's manifest and contract survived. Apps now load everything withconsult('batteries.pl'). Abatteries.plthe user wrote is never overwritten, and the loader is removed with the last battery.CLI: hyphenated ids. The seven batteries whose id is hyphenated while their directory is not (
invoice-rulesininvoice_rules/, and six others) were missing frombattery listand could not be installed. The directory is now looked up under either spelling.Checked
make checkpasses;build_registry.py --checkis clean.readsspot-checked againstinvoice-rules:days_overduereaches no billing setting;late_feereaches the three fee settings;escalation_levelreaches the two thresholds.assign_reject,part_exempt) and pure functions of their arguments (bulk_discount/3,hier_own).batteries.pland hyphenated ids.battery_inputentries kept in both.Notes
ensure_loadedandconsultas directives and panics onincludewithmultifile, which is why the loader usesincludewithdiscontiguous.include/1against the working directory, so Scryer users start it from the install directory; the loader header says so.battery_input/6with an unbound battery underdiscontiguousskips entries. Querying a given battery is correct.