Repository navigation
refactor: remove the second copy of four rules - #12
Merged
Merged
Conversation
Each of these was a place where one rule lived twice, so a change could land in one copy only. - `_access_name` wrapped `gai_access_name` and the file already called the free function elsewhere. Gone; every caller uses the free function. - `audit_path` was written at startup and never read. Gone. - `lock.release` and `lock.renew` each repeated the params check, the lookup, and the owner rule. One `_lock_for` returns the lock or the error, so the owner rule has one home. - `_forbidden` built a dictionary holding one string, which the caller unwrapped with `Dictionary(...)["$gai_forbidden"]`. It returns the string. On the game side, the stub harness built its argument key in four places and its slot in three; `_args_key` and `_slot` do it once. In `bin/gai`, `build_is_stale` read the stamp and then re-read it through `stamp_is_current`, and `--check` had a half-applied special case for a missing stamp; one `stamp_state` answers `current`, `stale`, or `absent`. Net: 45 lines added, 43 removed, and four rules with one home each. Verified: the module compiles for editor, template, and Windows/MinGW; 17 game tests, the agent suite, and the build, next, and check suites pass; pre-commit passes.
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
The last weeks added four rules in two places each, plus two build-stamp readers that disagreed. A rule with two homes is a rule that lands in one of them.
What changed
Engine (
modules/gai_agent):_access_namewrapped the freegai_access_name, while the same file already called the free function. Removed.audit_pathwas assigned at startup and never read. Removed.lock.releaseandlock.renewrepeated the params check, the lock lookup, and the owner rule. One_lock_for(params, error)now owns that rule._forbiddenreturned a dictionary holding a single string, unwrapped by the caller. It returns the string.Game (
game/tests/gai_test_case.gd): the stub key"" if args == null else var_to_str(args)was written in four places and the "create the slot" shape in three._args_keyand_slotdo it once.CLI (
bin/gai):build_is_staleread the stamp and then re-read it throughstamp_is_current, and--checkcarried a half-applied special case for a missing stamp. Onestamp_stateanswerscurrent,stale, orabsent, and the special case is gone.Verification
target=template_releaseobject, and Windows/MinGW object (8.1 s).test_agent19,test_build16,test_next18,test_check14 pass;bin/gai checkgreen;bin/gai build --checkup to date.