-
Notifications
You must be signed in to change notification settings - Fork 28
Description
Relevant prior PR and discussion: #4351 and #4352
The goal of this issue is to deal with the remaining 'chunk overwriting' errors that currently pop up when you run any of Drasil's case studies. For example, Projectile:
WARNING! Overwriting `instance:verifyInVals` :: ConceptInstance
WARNING! Overwriting `instance:calcValues` :: ConceptInstance
WARNING! Overwriting `instance:outputValues` :: ConceptInstanceThese occur because these chunks are already added to the ChunkDB but fillReqs adds them again:
Drasil/code/drasil-docLang/lib/Drasil/DocumentLanguage.hs
Lines 177 to 185 in 9af23cb
| -- | Fills in the requirements section of the system information using the document description. | |
| fillReqs :: DocDesc -> System -> System | |
| fillReqs [] si = si | |
| fillReqs (ReqrmntSec (ReqsProg x):_) si@SI{_systemdb = db} = genReqs x -- This causes overwrites in the ChunkDB for all requirements. | |
| where | |
| genReqs [] = si | |
| genReqs (FReqsSub c _:_) = si { _systemdb = insertAll (nub c) db } | |
| genReqs (_:xs) = genReqs xs | |
| fillReqs (_:xs) si = fillReqs xs si |
This function is needed because for some of our examples, we generate the "input-values" functional requirement by passing a non-empty "input-values" FR description to FReqsSub in the SRSDecl:
Drasil/code/drasil-example/glassbr/lib/Drasil/GlassBR/Body.hs
Lines 108 to 111 in 9af23cb
| ReqrmntSec $ ReqsProg [ | |
| FReqsSub inReqDesc funcReqsTables, | |
| NonFReqsSub | |
| ], |
Drasil/code/drasil-docLang/lib/Drasil/DocDecl.hs
Lines 126 to 129 in 9af23cb
| reqSec :: ReqsSub -> DL.ReqsSub | |
| reqSec (FReqsSub d t) = DL.FReqsSub (fullReqs is d $ fromConcInsDB funcReqDom) (fullTables is t) | |
| reqSec (FReqsSub' t) = DL.FReqsSub' (fromConcInsDB funcReqDom) t | |
| reqSec NonFReqsSub = DL.NonFReqsSub $ fromConcInsDB nonFuncReqDom |
Drasil/code/drasil-docLang/lib/Drasil/Sections/Requirements.hs
Lines 40 to 44 in 9af23cb
| -- | Prepends a 'ConceptInstance' referencing an input-value table to a list of other 'ConceptInstance's. | |
| -- For listing input requirements. | |
| fullReqs :: (Quantity i, MayHaveUnit i) => [i] -> Sentence -> [ConceptInstance] -> [ConceptInstance] | |
| fullReqs [] _ _ = [] | |
| fullReqs i d r = inReq (inReqDesc (mkInputPropsTable i) d) : r -- ++ [outReq (outReqDesc outTable)] |
Objective
Generating input-values FRs is a good idea, but not in this route that heavily ties drasil-docLang to ICO problems. #4352 can be used for figuring out how to do this 'correctly', but, for now, the goal of this issue is just to undo some of this generation in favour of doing it 'better' later. It is more important to not have chunk overwrites.
Prospective Solution
- Creating an "input-values" FR for each of the case studies. This doesn't mean copy/pasting the same code everywhere, it could just mean importing the same common FR chunk from elsewhere.
- Registering said chunk and disabling the automated input-values FR generation.
- Removing
fillReqsandfullReqs.